First Release

This commit is contained in:
2018-10-06 14:41:19 +02:00
parent 97d8ee28b6
commit dc2f5882b5
3 changed files with 35 additions and 2 deletions

View File

@@ -124,6 +124,7 @@ namespace HitScoreVisualizer
// path to where the config is saved
private const string FILE_PATH = "/UserData/HitScoreVisualizerConfig.json";
private const string FILE_PATH_RATINGS = "\\Ratings\\Latest.txt";
private const string DEFAULT_JSON = @"{
""majorVersion"": 2,
@@ -255,6 +256,7 @@ namespace HitScoreVisualizer
};
public static string fullPath => Environment.CurrentDirectory.Replace('\\', '/') + FILE_PATH;
public static string fullPathRatings => Environment.CurrentDirectory + FILE_PATH_RATINGS;
public static void load()
{
@@ -450,6 +452,16 @@ namespace HitScoreVisualizer
formattedBuilder.Append("<color=#" + floatToHexColor(1f - afterCut) + floatToHexColor(afterCut) + "00>" + afterCutScore);
text.text = formattedBuilder.ToString();
if (saberAfterCutSwingRatingCounter.didFinish)
{
using (StreamWriter file = File.AppendText(fullPathRatings))
{
file.WriteLine(saberAfterCutSwingRatingCounter.RequestId + " <<>> " + beforeCut + " " + accuracy + " " + afterCut + " | " + score);
}
}
return;
}
else if (instance.displayMode == mode_format)
{

View File

@@ -16,7 +16,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>..\..\..\..\Steam Games\steamapps\common\Beat Saber\Plugins\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>

View File

@@ -17,6 +17,8 @@ namespace HitScoreVisualizer
public void OnApplicationStart()
{
System.IO.File.WriteAllText(Config.fullPathRatings, "NO DATA");
SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged;
SceneManager.sceneLoaded += SceneManager_sceneLoaded;
try
@@ -33,8 +35,27 @@ namespace HitScoreVisualizer
Config.load();
}
private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1)
private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene newScene)
{
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)