Skip to content

Commit dce0fbd

Browse files
Update for game version 1.0.0; fix config updating bug
1 parent c6cb9ff commit dce0fbd

File tree

4 files changed

+39
-14
lines changed

4 files changed

+39
-14
lines changed

HitScoreVisualizer/Config.cs

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
using Newtonsoft.Json;
22
using System;
3-
using System.Collections.Generic;
43
using System.ComponentModel;
54
using System.IO;
6-
using System.Linq;
75
using System.Text;
8-
using System.Threading.Tasks;
96
using TMPro;
107
using UnityEngine;
118

@@ -78,7 +75,7 @@ public struct SegmentJudgment
7875
// - %a: The score contributed by the part of the swing after cutting the block.
7976
// - %B, %C, %A: As above, except using the appropriate judgment from that part of the swing (as configured for "beforeCutAngleJudgments", "accuracyJudgments", or "afterCutAngleJudgments").
8077
// - %s: The total score for the cut.
81-
// - %p: The percent out of 110 you achieved with your swing's score
78+
// - %p: The percent out of 115 you achieved with your swing's score
8279
// - %%: A literal percent symbol.
8380
// - %n: A newline.
8481
//
@@ -109,8 +106,8 @@ public struct SegmentJudgment
109106

110107
private const string DEFAULT_JSON = @"{
111108
""majorVersion"": 2,
112-
""minorVersion"": 1,
113-
""patchVersion"": 6,
109+
""minorVersion"": 2,
110+
""patchVersion"": 0,
114111
""isDefaultConfig"": true,
115112
""displayMode"": ""format"",
116113
""judgments"": [
@@ -267,11 +264,37 @@ public static void load()
267264
loaded.patchVersion = 0;
268265
isDirty = true;
269266
}
270-
if (loaded.majorVersion == 2 && loaded.minorVersion == 1 && loaded.patchVersion < Plugin.patchVersion)
267+
if (loaded.majorVersion == 2 && loaded.minorVersion == 1)
271268
{
272-
loaded.patchVersion = Plugin.patchVersion;
269+
// Beat Saber version 1.0.0 increased the max score given for cut accuracy from 10 to 15, and thus the max total score from 110 to 115.
270+
// We assume that anyone whose config contained a judgment requiring an accuracy score of 10 or a total score of 110 intended those values
271+
// to refer to the highest achievable score rather than those exact numbers, and thus update them accordingly.
272+
// As we can't know what users would want done with their other judgment thresholds, those are left unchanged.
273+
if (loaded.judgments != null)
274+
{
275+
for (int i = 0; i < loaded.judgments.Length; i++)
276+
{
277+
if (loaded.judgments[i].threshold == 110)
278+
{
279+
loaded.judgments[i].threshold = 115;
280+
}
281+
}
282+
}
283+
if (loaded.accuracyJudgments != null)
284+
{
285+
for (int i = 0; i < loaded.accuracyJudgments.Length; i++)
286+
{
287+
if (loaded.accuracyJudgments[i].threshold == 10)
288+
{
289+
loaded.accuracyJudgments[i].threshold = 15;
290+
}
291+
}
292+
}
293+
loaded.minorVersion = 2;
294+
loaded.patchVersion = 0;
273295
isDirty = true;
274296
}
297+
instance = loaded;
275298
if (isDirty) save();
276299
}
277300
instance = loaded;
@@ -406,7 +429,7 @@ public static void judge(FlyingScoreEffect scoreEffect, NoteCutInfo noteCutInfo,
406429
formattedBuilder.Append(score);
407430
break;
408431
case 'p':
409-
formattedBuilder.Append(string.Format("{0:0}", score / 110d * 100));
432+
formattedBuilder.Append(string.Format("{0:0}", score / 115d * 100));
410433
break;
411434
case '%':
412435
formattedBuilder.Append("%");

HitScoreVisualizer/HitScoreVisualizer.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<DefineConstants>DEBUG;TRACE</DefineConstants>
2222
<ErrorReport>prompt</ErrorReport>
2323
<WarningLevel>4</WarningLevel>
24+
<LangVersion>7.3</LangVersion>
2425
</PropertyGroup>
2526
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2627
<DebugType>pdbonly</DebugType>
@@ -29,6 +30,7 @@
2930
<DefineConstants>TRACE</DefineConstants>
3031
<ErrorReport>prompt</ErrorReport>
3132
<WarningLevel>4</WarningLevel>
33+
<LangVersion>7.3</LangVersion>
3234
</PropertyGroup>
3335
<ItemGroup>
3436
<Reference Include="0Harmony">

HitScoreVisualizer/Plugin.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ namespace HitScoreVisualizer
99
public class Plugin : IPlugin
1010
{
1111
public string Name => "HitScoreVisualizer";
12-
public string Version => "2.1.6";
12+
public string Version => "2.2.0";
1313

1414
internal const int majorVersion = 2;
15-
internal const int minorVersion = 1;
16-
internal const int patchVersion = 6;
15+
internal const int minorVersion = 2;
16+
internal const int patchVersion = 0;
1717

1818
public void OnApplicationStart()
1919
{

HitScoreVisualizer/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("2.1.6.0")]
36-
[assembly: AssemblyFileVersion("2.1.6.0")]
35+
[assembly: AssemblyVersion("2.2.0.0")]
36+
[assembly: AssemblyFileVersion("2.2.0.0")]

0 commit comments

Comments
 (0)