mirror of
https://github.com/Theaninova/HitScoreVisualizer.git
synced 2026-01-09 11:12:47 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1d7070548 |
@@ -74,7 +74,7 @@ namespace HitScoreVisualizer
|
|||||||
private const string DEFAULT_JSON = @"{
|
private const string DEFAULT_JSON = @"{
|
||||||
""majorVersion"": 2,
|
""majorVersion"": 2,
|
||||||
""minorVersion"": 0,
|
""minorVersion"": 0,
|
||||||
""patchVersion"": 0,
|
""patchVersion"": 2,
|
||||||
""isDefaultConfig"": true,
|
""isDefaultConfig"": true,
|
||||||
""displayMode"": ""textOnTop"",
|
""displayMode"": ""textOnTop"",
|
||||||
""judgments"": [
|
""judgments"": [
|
||||||
@@ -227,7 +227,6 @@ namespace HitScoreVisualizer
|
|||||||
{
|
{
|
||||||
if (config.majorVersion < Plugin.majorVersion) return true;
|
if (config.majorVersion < Plugin.majorVersion) return true;
|
||||||
if (config.minorVersion < Plugin.minorVersion) return true;
|
if (config.minorVersion < Plugin.minorVersion) return true;
|
||||||
if (config.patchVersion < Plugin.patchVersion) return true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,24 +245,28 @@ namespace HitScoreVisualizer
|
|||||||
public static void judge(FlyingScoreTextEffect text, ref Color color, int score)
|
public static void judge(FlyingScoreTextEffect text, ref Color color, int score)
|
||||||
{
|
{
|
||||||
Judgment judgment = DEFAULT_JUDGMENT;
|
Judgment judgment = DEFAULT_JUDGMENT;
|
||||||
Judgment fadeJudgment = DEFAULT_JUDGMENT;
|
int index; // save in case we need to fade
|
||||||
for (int i = 0; i < instance.judgments.Length; i++)
|
for (index = 0; index < instance.judgments.Length; index++)
|
||||||
{
|
{
|
||||||
Judgment j = instance.judgments[i];
|
Judgment j = instance.judgments[index];
|
||||||
if (score >= j.threshold)
|
if (score >= j.threshold)
|
||||||
{
|
{
|
||||||
if (j.fade) fadeJudgment = instance.judgments[i-1];
|
|
||||||
else fadeJudgment = j;
|
|
||||||
|
|
||||||
judgment = j;
|
judgment = j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (judgment.fade)
|
||||||
|
{
|
||||||
|
Judgment fadeJudgment = instance.judgments[index - 1];
|
||||||
Color baseColor = toColor(judgment.color);
|
Color baseColor = toColor(judgment.color);
|
||||||
Color fadeColor = toColor(fadeJudgment.color);
|
Color fadeColor = toColor(fadeJudgment.color);
|
||||||
float lerpDistance = Mathf.InverseLerp(judgment.threshold, fadeJudgment.threshold, score);
|
float lerpDistance = Mathf.InverseLerp(judgment.threshold, fadeJudgment.threshold, score);
|
||||||
color = Color.Lerp(baseColor, fadeColor, lerpDistance);
|
color = Color.Lerp(baseColor, fadeColor, lerpDistance);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
color = toColor(judgment.color);
|
||||||
|
}
|
||||||
|
|
||||||
if (instance.displayMode == "textOnly")
|
if (instance.displayMode == "textOnly")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ namespace HitScoreVisualizer.Harmony_Patches
|
|||||||
new Type[] { typeof(SaberAfterCutSwingRatingCounter), typeof(float) })]
|
new Type[] { typeof(SaberAfterCutSwingRatingCounter), typeof(float) })]
|
||||||
class FlyingScoreTextEffectHandleSaberAfterCutSwingRatingCounterDidChangeEvent
|
class FlyingScoreTextEffectHandleSaberAfterCutSwingRatingCounterDidChangeEvent
|
||||||
{
|
{
|
||||||
static void Postfix(SaberAfterCutSwingRatingCounter afterCutRating, FlyingScoreTextEffect __instance,
|
static bool Prefix(SaberAfterCutSwingRatingCounter afterCutRating, FlyingScoreTextEffect __instance, ref Color ____color, NoteCutInfo ____noteCutInfo, int ____multiplier)
|
||||||
ref Color ____color, NoteCutInfo ____noteCutInfo, int ____multiplier)
|
|
||||||
{
|
{
|
||||||
ScoreController.ScoreWithoutMultiplier(____noteCutInfo, afterCutRating, out int before, out int after);
|
ScoreController.ScoreWithoutMultiplier(____noteCutInfo, afterCutRating, out int before, out int after);
|
||||||
int total = before + after;
|
int total = before + after;
|
||||||
Config.judge(__instance, ref ____color, total);
|
Config.judge(__instance, ref ____color, total);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
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(FlyingScoreTextEffect), "InitAndPresent",
|
||||||
|
new Type[] {
|
||||||
|
typeof(NoteCutInfo),
|
||||||
|
typeof(int),
|
||||||
|
typeof(Vector3),
|
||||||
|
typeof(Color),
|
||||||
|
typeof(SaberAfterCutSwingRatingCounter)})]
|
||||||
|
*/
|
||||||
|
class FlyingScoreTextEffectInitAndPresent
|
||||||
|
{
|
||||||
|
static void Postfix(SaberAfterCutSwingRatingCounter saberAfterCutSwingRatingCounter, FlyingScoreTextEffect __instance, ref Color ____color, NoteCutInfo noteCutInfo)
|
||||||
|
{
|
||||||
|
ScoreController.ScoreWithoutMultiplier(noteCutInfo, saberAfterCutSwingRatingCounter, out int before, out int after);
|
||||||
|
int total = before + after;
|
||||||
|
Config.judge(__instance, ref ____color, total);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,6 +63,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Config.cs" />
|
<Compile Include="Config.cs" />
|
||||||
<Compile Include="Harmony Patches\FlyingScoreTextEffectHandleSaberAfterCutSwingRatingCounterDidChangeEvent.cs" />
|
<Compile Include="Harmony Patches\FlyingScoreTextEffectHandleSaberAfterCutSwingRatingCounterDidChangeEvent.cs" />
|
||||||
|
<Compile Include="Harmony Patches\FlyingScoreTextEffectInitAndPresent.cs" />
|
||||||
<Compile Include="Plugin.cs" />
|
<Compile Include="Plugin.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ namespace HitScoreVisualizer
|
|||||||
public class Plugin : IPlugin
|
public class Plugin : IPlugin
|
||||||
{
|
{
|
||||||
public string Name => "HitScoreVisualizer";
|
public string Name => "HitScoreVisualizer";
|
||||||
public string Version => "2.0.0";
|
public string Version => "2.0.2";
|
||||||
|
|
||||||
internal const int majorVersion = 2;
|
internal const int majorVersion = 2;
|
||||||
internal const int minorVersion = 0;
|
internal const int minorVersion = 0;
|
||||||
internal const int patchVersion = 0;
|
internal const int patchVersion = 2;
|
||||||
|
|
||||||
public void OnApplicationStart()
|
public void OnApplicationStart()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user