3 Commits

Author SHA1 Message Date
artemiswkearney
f15dd367a2 Update README for 2.1.0 2018-08-26 16:02:11 -07:00
Arti Kearney
45658d5d46 Merge branch 'master' of github.com:artemiswkearney/HitScoreVisualizer
merge readme (added on GitHub)
2018-08-26 16:00:36 -07:00
artemiswkearney
a30fd6a772 Create README.md 2018-08-24 15:20:44 -07:00
3 changed files with 35 additions and 147 deletions

View File

@@ -14,28 +14,6 @@ namespace HitScoreVisualizer
{ {
public static Config instance; public static Config instance;
public const string mode_hardcoreCompetetive = "hardcoreCompetetive";
public const string mode_format = "format";
public const string mode_textOnly = "textOnly";
public const string mode_numeric = "numeric";
public const string mode_scoreOnTop = "scoreOnTop";
public const char format_indicator = '%';
public const char format_beforeCutScore = 'b';
public const char format_accuracyScore = 'c';
public const char format_afterCutScore = 'a';
public const char FORMAT_BEFORECUTSCORE = 'B';
public const char FORMAT_ACCUTRACYSCORE = 'C';
public const char FORMAT_AFTERCUTSCORE = 'A';
public const char format_score = 's';
public const char format_indicatorChar = format_indicator;
public const char format_lineBreak = 'n';
public const bool percentages = true;
public const int maxBeforeCutScore = 70;
public const int maxAfterCutScore = 30;
public const int maxAccuracyScore = 10;
// If true, this config will not overwrite the existing config file. // If true, this config will not overwrite the existing config file.
// (This gets set if a config from a newer version is detected.) // (This gets set if a config from a newer version is detected.)
[JsonIgnore] [JsonIgnore]
@@ -124,7 +102,6 @@ namespace HitScoreVisualizer
// path to where the config is saved // path to where the config is saved
private const string FILE_PATH = "/UserData/HitScoreVisualizerConfig.json"; private const string FILE_PATH = "/UserData/HitScoreVisualizerConfig.json";
private const string FILE_PATH_RATINGS = "\\Ratings\\Latest.txt";
private const string DEFAULT_JSON = @"{ private const string DEFAULT_JSON = @"{
""majorVersion"": 2, ""majorVersion"": 2,
@@ -256,7 +233,6 @@ namespace HitScoreVisualizer
}; };
public static string fullPath => Environment.CurrentDirectory.Replace('\\', '/') + FILE_PATH; public static string fullPath => Environment.CurrentDirectory.Replace('\\', '/') + FILE_PATH;
public static string fullPathRatings => Environment.CurrentDirectory + FILE_PATH_RATINGS;
public static void load() public static void load()
{ {
@@ -363,11 +339,6 @@ namespace HitScoreVisualizer
instance = DEFAULT_CONFIG; instance = DEFAULT_CONFIG;
} }
public static string floatToHexColor(float dec)
{
return ((int)(255f * dec)).ToString("X2");
}
public static void judge(FlyingScoreTextEffect text, NoteCutInfo noteCutInfo, SaberAfterCutSwingRatingCounter saberAfterCutSwingRatingCounter, ref Color color, int score) public static void judge(FlyingScoreTextEffect text, NoteCutInfo noteCutInfo, SaberAfterCutSwingRatingCounter saberAfterCutSwingRatingCounter, ref Color color, int score)
{ {
Judgment judgment = DEFAULT_JUDGMENT; Judgment judgment = DEFAULT_JUDGMENT;
@@ -394,77 +365,7 @@ namespace HitScoreVisualizer
color = toColor(judgment.color); color = toColor(judgment.color);
} }
//Hardcore Competetive Mode by wulkanat if (instance.displayMode == "format")
if (instance.displayMode == mode_hardcoreCompetetive)
{
float beforeCut = noteCutInfo.swingRating;
float accuracy = 1f - Mathf.Clamp01(noteCutInfo.cutDistanceToCenter / 0.2f);
float afterCut = 0f;
if (saberAfterCutSwingRatingCounter != null)
afterCut = saberAfterCutSwingRatingCounter.rating;
int beforeCutScore, accuracyScore, afterCutScore;
int beforeMax, accuracyMax, afterMax;
if (percentages)
{
beforeMax = 100;
accuracyMax = 100;
afterMax = 100;
}
else
{
beforeMax = 70;
accuracyMax = 10;
afterMax = 30;
}
beforeCutScore = Mathf.RoundToInt(beforeMax * beforeCut);
accuracyScore = Mathf.RoundToInt(accuracyMax * accuracy);
afterCutScore = Mathf.RoundToInt(afterMax * afterCut);
if (beforeCutScore == beforeMax && accuracyScore == accuracyMax && afterCutScore == afterMax)
{
text.text = "Perfect";
return;
}
StringBuilder formattedBuilder = new StringBuilder();
if (percentages)
formattedBuilder.Append( "<color=#" + floatToHexColor(1f - score / 110f) + floatToHexColor(score / 110f) + "00>" + (int) ((score / 110f) * 100f) + "%\n");
else
formattedBuilder.Append("<color=#" + floatToHexColor(1f - score / 110f) + floatToHexColor(score / 110f) + "00>" + score + "\n");
if (beforeCutScore == beforeMax)
formattedBuilder.Append("<color=#FFFFFF>P ");
else
formattedBuilder.Append("<color=#" + floatToHexColor(1f - beforeCut) + (floatToHexColor(beforeCut) + "00>" + beforeCutScore + " "));
if (accuracyScore == accuracyMax)
formattedBuilder.Append("<color=#FFFFFF>P ");
else
formattedBuilder.Append("<color=#" + floatToHexColor(1f - accuracy) + floatToHexColor(accuracy) + "00>" + accuracyScore + " ");
if (afterCutScore == afterMax)
formattedBuilder.Append("<color=#FFFFFF>P");
else
formattedBuilder.Append("<color=#" + floatToHexColor(1f - afterCut) + floatToHexColor(afterCut) + "00>" + afterCutScore);
text.text = formattedBuilder.ToString();
//Feature doesn't work
/*if (saberAfterCutSwingRatingCounter.didFinish)
{
using (StreamWriter file = File.AppendText(fullPathRatings))
{
file.WriteLine(saberAfterCutSwingRatingCounter.RequestId + " <<>> " + beforeCut + " " + accuracy + " " + afterCut + " | " + score);
}
}*/
return;
}
else if (instance.displayMode == mode_format)
{ {
int beforeCutScore, accuracyScore, afterCutScore; int beforeCutScore, accuracyScore, afterCutScore;
@@ -479,7 +380,7 @@ namespace HitScoreVisualizer
StringBuilder formattedBuilder = new StringBuilder(); StringBuilder formattedBuilder = new StringBuilder();
string formatString = judgment.text; string formatString = judgment.text;
int nextPercentIndex = formatString.IndexOf(format_indicator); int nextPercentIndex = formatString.IndexOf('%');
while (nextPercentIndex != -1) while (nextPercentIndex != -1)
{ {
formattedBuilder.Append(formatString.Substring(0, nextPercentIndex)); formattedBuilder.Append(formatString.Substring(0, nextPercentIndex));
@@ -491,54 +392,62 @@ namespace HitScoreVisualizer
switch (specifier) switch (specifier)
{ {
case format_beforeCutScore: case 'b':
formattedBuilder.Append(beforeCutScore); formattedBuilder.Append(beforeCutScore);
break; break;
case format_accuracyScore: case 'c':
formattedBuilder.Append(accuracyScore); formattedBuilder.Append(accuracyScore);
break; break;
case format_afterCutScore: case 'a':
formattedBuilder.Append(afterCutScore); formattedBuilder.Append(afterCutScore);
break; break;
case FORMAT_BEFORECUTSCORE: case 'B':
formattedBuilder.Append(judgeSegment(beforeCutScore, instance.beforeCutAngleJudgments)); formattedBuilder.Append(judgeSegment(beforeCutScore, instance.beforeCutAngleJudgments));
break; break;
case FORMAT_ACCUTRACYSCORE: case 'C':
formattedBuilder.Append(judgeSegment(accuracyScore, instance.accuracyJudgments)); formattedBuilder.Append(judgeSegment(accuracyScore, instance.accuracyJudgments));
break; break;
case FORMAT_AFTERCUTSCORE: case 'A':
formattedBuilder.Append(judgeSegment(afterCutScore, instance.afterCutAngleJudgments)); formattedBuilder.Append(judgeSegment(afterCutScore, instance.afterCutAngleJudgments));
break; break;
case format_score: case 's':
formattedBuilder.Append(score); formattedBuilder.Append(score);
break; break;
case format_indicatorChar: case '%':
formattedBuilder.Append(format_indicatorChar); formattedBuilder.Append("%");
break; break;
case format_lineBreak: case 'n':
formattedBuilder.Append("\n"); formattedBuilder.Append("\n");
break; break;
default: default:
formattedBuilder.Append(format_indicator + specifier); formattedBuilder.Append("%" + specifier);
break; break;
} }
formatString = formatString.Remove(0, nextPercentIndex + 2); formatString = formatString.Remove(0, nextPercentIndex + 2);
nextPercentIndex = formatString.IndexOf(format_indicator); nextPercentIndex = formatString.IndexOf('%');
} }
formattedBuilder.Append(formatString); formattedBuilder.Append(formatString);
text.text = formattedBuilder.ToString(); text.text = formattedBuilder.ToString();
return; return;
} }
else if (instance.displayMode == mode_textOnly)
if (instance.displayMode == "textOnly")
{
text.text = judgment.text; text.text = judgment.text;
else if (instance.displayMode == mode_numeric)
return; return;
else if (instance.displayMode == mode_scoreOnTop) }
if (instance.displayMode == "numeric")
{
return;
}
if (instance.displayMode == "scoreOnTop")
{
text.text = score + "\n" + judgment.text + "\n"; text.text = score + "\n" + judgment.text + "\n";
else return;
text.text = judgment.text + "\n" + score + "\n"; }
text.text = judgment.text + "\n" + score + "\n";
} }
public static Color toColor(float[] rgba) public static Color toColor(float[] rgba)

View File

@@ -16,7 +16,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>..\..\..\..\Steam Games\steamapps\common\Beat Saber\Plugins\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@@ -31,16 +31,16 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="0Harmony"> <Reference Include="0Harmony">
<HintPath>..\..\..\..\Steam Games\steamapps\common\Beat Saber\Beat Saber_Data\Managed\0Harmony.dll</HintPath> <HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\0Harmony.dll</HintPath>
</Reference> </Reference>
<Reference Include="Assembly-CSharp"> <Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\Steam Games\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp.dll</HintPath> <HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="Assembly-CSharp-firstpass"> <Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\..\..\..\Steam Games\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath> <HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference> </Reference>
<Reference Include="IllusionPlugin"> <Reference Include="IllusionPlugin">
<HintPath>..\..\..\..\Steam Games\steamapps\common\Beat Saber\Beat Saber_Data\Managed\IllusionPlugin.dll</HintPath> <HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\IllusionPlugin.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -54,10 +54,10 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="UnityEngine"> <Reference Include="UnityEngine">
<HintPath>..\..\..\..\Steam Games\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.dll</HintPath> <HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.CoreModule"> <Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\..\Steam Games\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll</HintPath> <HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -17,8 +17,6 @@ namespace HitScoreVisualizer
public void OnApplicationStart() public void OnApplicationStart()
{ {
System.IO.File.WriteAllText(Config.fullPathRatings, "NO DATA");
SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged; SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged;
SceneManager.sceneLoaded += SceneManager_sceneLoaded; SceneManager.sceneLoaded += SceneManager_sceneLoaded;
try try
@@ -35,27 +33,8 @@ namespace HitScoreVisualizer
Config.load(); Config.load();
} }
private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene newScene) private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1)
{ {
switch (newScene.buildIndex)
{
case 1:
case 2:
// Return if we're not playing in a song.
return;
case 8:
case 9:
// We're in a song
//System.IO.File.WriteAllText(Config.fullPathRatings, newScene.name);
return;
default:
// Unknown, fallback to matching the name.
if (newScene.name.Contains("Environment"))
goto case 8;
else
return;
}
} }
private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1) private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)