Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion HitScoreVisualizer/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public static void resetToDefault()
instance = DEFAULT_CONFIG;
}

public static void judge(FlyingScoreEffect scoreEffect, NoteCutInfo noteCutInfo, SaberAfterCutSwingRatingCounter saberAfterCutSwingRatingCounter, int score, int before, int after, int accuracy)
public static void judge(FlyingScoreEffect scoreEffect, int score, int before, int after, int accuracy)
{
// as of 0.13, the TextMeshPro is private; use reflection to grab it out of a private field
TextMeshPro text = scoreEffect.getPrivateField<TextMeshPro>("_text");
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Harmony;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace HitScoreVisualizer.Harmony_Patches
{
[HarmonyPatch(typeof(FlyingScoreEffect), "HandleSaberSwingRatingCounterDidChangeEvent",
new Type[] { typeof(SaberSwingRatingCounter), typeof(float) })]
class FlyingScoreEffectHandleSaberSwingRatingCounterDidChangeEvent
{
static bool Prefix(SaberSwingRatingCounter saberSwingRatingCounter, FlyingScoreEffect __instance, NoteCutInfo ____noteCutInfo)
{
if (Config.instance.doIntermediateUpdates)
{
ScoreController.RawScoreWithoutMultiplier(____noteCutInfo, out int before, out int after, out int accuracy);
int total = before + after + accuracy;
Config.judge(__instance, total, before, after, accuracy);
}
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ namespace HitScoreVisualizer.Harmony_Patches
typeof(int),
typeof(float),
typeof(Vector3),
typeof(Color),
typeof(SaberAfterCutSwingRatingCounter)})]
typeof(Color)})]
class FlyingScoreEffectInitAndPresent
{
public static FlyingScoreEffect currentEffect = null;
Expand All @@ -39,6 +38,7 @@ static void Prefix(ref Vector3 targetPos, FlyingScoreEffect __instance)
// Save the existing effect to clear if a new one spawns
currentEffect = __instance;
// In case it despawns before the next note is hit, don't try to clear it
currentEffect.didFinishEvent -= handleEffectDidFinish; // Just in case
currentEffect.didFinishEvent += handleEffectDidFinish;
}
}
Expand All @@ -49,21 +49,25 @@ static void handleEffectDidFinish(FlyingObjectEffect effect)
if (currentEffect == effect) currentEffect = null;
}

static void Postfix(SaberAfterCutSwingRatingCounter saberAfterCutSwingRatingCounter, FlyingScoreEffect __instance, ref Color ____color, NoteCutInfo noteCutInfo)
static void Postfix(FlyingScoreEffect __instance, ref Color ____color, NoteCutInfo noteCutInfo)
{
void judge(SaberAfterCutSwingRatingCounter counter)
void judge(SaberSwingRatingCounter counter)
{
ScoreController.RawScoreWithoutMultiplier(noteCutInfo, counter, out int before_plus_acc, out int after, out int accuracy);
int total = before_plus_acc + after;
Config.judge(__instance, noteCutInfo, counter, total, before_plus_acc - accuracy, after, accuracy);
ScoreController.RawScoreWithoutMultiplier(noteCutInfo, out int before, out int after, out int accuracy);
int total = before + after + accuracy;
Config.judge(__instance, total, before, after, accuracy);

// If the counter is finished, remove our event from it
counter.didFinishEvent -= judge;
}

// Apply judgments a total of twice - once when the effect is created, once when it finishes.
judge(saberAfterCutSwingRatingCounter);
saberAfterCutSwingRatingCounter.didFinishEvent += judge;
judge(noteCutInfo.swingRatingCounter);
if (!Config.instance.doIntermediateUpdates) // Don't need a judge on didFinishEvent if doIntermediateUpdates is on
{
noteCutInfo.swingRatingCounter.didFinishEvent -= judge; // Just in case
noteCutInfo.swingRatingCounter.didFinishEvent += judge;
}
}
}
}
5 changes: 1 addition & 4 deletions HitScoreVisualizer/HitScoreVisualizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="IllusionPlugin">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\IllusionPlugin.dll</HintPath>
</Reference>
<Reference Include="IPA.Loader, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\IPA.Loader.dll</HintPath>
Expand Down Expand Up @@ -74,7 +71,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Config.cs" />
<Compile Include="Harmony Patches\FlyingScoreEffectHandleSaberAfterCutSwingRatingCounterDidChangeEvent.cs" />
<Compile Include="Harmony Patches\FlyingScoreEffectHandleSaberSwingRatingCounterDidChangeEvent.cs" />
<Compile Include="Harmony Patches\FlyingScoreEffectInitAndPresent.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
2 changes: 1 addition & 1 deletion HitScoreVisualizer/Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Harmony;
using IllusionPlugin;
using IPA.Old;
using System;
using System.Reflection;
using UnityEngine.SceneManagement;
Expand Down