-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compatibility with game version 0.13.0; default config improvements
- Loading branch information
1 parent
7c760e6
commit a185569
Showing
7 changed files
with
128 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...r/Harmony Patches/FlyingScoreEffectHandleSaberAfterCutSwingRatingCounterDidChangeEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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), "HandleSaberAfterCutSwingRatingCounterDidChangeEvent", | ||
new Type[] { typeof(SaberAfterCutSwingRatingCounter), typeof(float) })] | ||
class FlyingScoreEffectHandleSaberAfterCutSwingRatingCounterDidChangeEvent | ||
{ | ||
static bool Prefix(SaberAfterCutSwingRatingCounter saberAfterCutSwingRatingCounter, FlyingScoreEffect __instance, ref Color ____color, NoteCutInfo ____noteCutInfo) | ||
{ | ||
ScoreController.ScoreWithoutMultiplier(____noteCutInfo, saberAfterCutSwingRatingCounter, out int before_plus_acc, out int after, out int accuracy); | ||
int total = before_plus_acc + after; | ||
Config.judge(__instance, ____noteCutInfo, saberAfterCutSwingRatingCounter, ref ____color, total, before_plus_acc - accuracy, after, accuracy); | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
...rmony Patches/FlyingScoreTextEffectHandleSaberAfterCutSwingRatingCounterDidChangeEvent.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System.Reflection; | ||
|
||
namespace HitScoreVisualizer.Utils | ||
{ | ||
static class ReflectionUtil | ||
{ | ||
public static void SetPrivateField(object obj, string fieldName, object value) | ||
{ | ||
var prop = obj.GetType().GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); | ||
prop.SetValue(obj, value); | ||
} | ||
|
||
public static T GetPrivateField<T>(object obj, string fieldName) | ||
{ | ||
var prop = obj.GetType().GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance); | ||
var value = prop.GetValue(obj); | ||
return (T)value; | ||
} | ||
|
||
public static void SetPrivateProperty(object obj, string propertyName, object value) | ||
{ | ||
var prop = obj.GetType().GetProperty(propertyName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); | ||
prop.SetValue(obj, value, null); | ||
} | ||
|
||
public static void SetPrivateFieldBase(object obj, string fieldName, object value) | ||
{ | ||
var prop = obj.GetType().BaseType.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); | ||
prop.SetValue(obj, value); | ||
} | ||
|
||
public static T GetPrivateFieldBase<T>(object obj, string fieldName) | ||
{ | ||
var prop = obj.GetType().BaseType.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance); | ||
var value = prop.GetValue(obj); | ||
return (T)value; | ||
} | ||
|
||
public static void SetPrivatePropertyBase(object obj, string propertyName, object value) | ||
{ | ||
var prop = obj.GetType().BaseType.GetProperty(propertyName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); | ||
prop.SetValue(obj, value, null); | ||
} | ||
|
||
public static void InvokePrivateMethod(object obj, string methodName, object[] methodParams) | ||
{ | ||
MethodInfo dynMethod = obj.GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance); | ||
dynMethod.Invoke(obj, methodParams); | ||
} | ||
|
||
public static T getPrivateField<T>(this object obj, string fieldName) => | ||
GetPrivateField<T>(obj, fieldName); | ||
public static void setPrivateField(this object obj, string fieldName, object value) => | ||
SetPrivateField(obj, fieldName, value); | ||
public static T getPrivateFieldBase<T>(this object obj, string fieldName) => | ||
GetPrivateFieldBase<T>(obj, fieldName); | ||
public static void setPrivateFieldBase(this object obj, string fieldName, object value) => | ||
SetPrivateFieldBase(obj, fieldName, value); | ||
public static void setPrivateProperty(this object obj, string propertyName, object value) => | ||
setPrivateProperty(obj, propertyName, value); | ||
public static void setPrivatePropertyBase(this object obj, string propertyName, object value) => | ||
setPrivatePropertyBase(obj, propertyName, value); | ||
public static void invokePrivateMethod(this object obj, string methodName, object[] methodParams) => | ||
InvokePrivateMethod(obj, methodName, methodParams); | ||
} | ||
} |