From 23331f8d5608d4787d0465e6ac4be28d82938641 Mon Sep 17 00:00:00 2001 From: akanyan Date: Sat, 21 Dec 2024 05:32:50 +0000 Subject: [PATCH] feat: a decent rating selector? Except it shows an arrow to the right when it shouldn't --- .../MU3.CustomUI/patch_MU3UICounter.cs | 1 + .../MU3.SceneObject/patch_ANM_CMN_User.cs | 1 + .../MU3/patch_OptionSelecterController.cs | 28 +++++++++++++++++-- NaiveRating/MU3/patch_UIResultBattlePoint.cs | 9 ++++-- 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/NaiveRating/MU3.CustomUI/patch_MU3UICounter.cs b/NaiveRating/MU3.CustomUI/patch_MU3UICounter.cs index 71534e0..0d569b7 100644 --- a/NaiveRating/MU3.CustomUI/patch_MU3UICounter.cs +++ b/NaiveRating/MU3.CustomUI/patch_MU3UICounter.cs @@ -1,4 +1,5 @@ namespace MU3.CustomUI; + class patch_MU3UICounter: MU3UICounter { protected extern void orig_calcNumFiguresFloat(double value); protected new void calcNumFiguresFloat(double value) { diff --git a/NaiveRating/MU3.SceneObject/patch_ANM_CMN_User.cs b/NaiveRating/MU3.SceneObject/patch_ANM_CMN_User.cs index f3099c8..dfd55bd 100644 --- a/NaiveRating/MU3.SceneObject/patch_ANM_CMN_User.cs +++ b/NaiveRating/MU3.SceneObject/patch_ANM_CMN_User.cs @@ -1,6 +1,7 @@ using MU3.CustomUI; namespace MU3.SceneObject; + class patch_ANM_CMN_UserDeta_01: ANM_CMN_UserDeta_01 { private MU3UICounter rating; public extern void orig_setUserDetail(); diff --git a/NaiveRating/MU3/patch_OptionSelecterController.cs b/NaiveRating/MU3/patch_OptionSelecterController.cs index ffa0615..304fc4a 100644 --- a/NaiveRating/MU3/patch_OptionSelecterController.cs +++ b/NaiveRating/MU3/patch_OptionSelecterController.cs @@ -1,19 +1,43 @@ using MU3.CustomUI; using MU3.User; using MU3.Util; +using System.Reflection; +using UnityEngine; namespace MU3; + class patch_OptionSelecterController: OptionSelecterController { private chengeParamFuncArray[] cpFuncArray = new chengeParamFuncArray[35]; public extern void orig_init(UserOption.OptionName id); - private extern void orig_chengeParamOther(int currentParam); public new void init(UserOption.OptionName id) { orig_init(id); cpFuncArray[33].max = 2; + + if(id == UserOption.OptionName.Rating) { + var rct = transform.Find("NUL_SWH_Option_00/NUL_Select/PAT_OnOff").GetComponent(); + var changer = transform.Find("NUL_SWH_Option_00/NUL_Select/PAT_OnOff").GetComponent(); + + rct.anchoredPosition = new Vector3(0f, -5f, 0); + rct.sizeDelta = new Vector2(158, 70); + + var spritesFi = typeof(MU3UIImageChanger).GetField("_sprites", BindingFlags.Instance | BindingFlags.NonPublic); + var tex = ((Sprite[])spritesFi.GetValue(changer))[0].texture; + var newSprites = new Sprite[3]; + newSprites[0] = Sprite.Create(tex, new Rect(1552.0f, 366.0f, 160.0f, 65.0f), new Vector2(80.0f, 0.0f)); + newSprites[1] = Sprite.Create(tex, new Rect(1221.0f, 1488.0f, 160.0f, 70.0f), new Vector2(80.0f, 35.0f)); + newSprites[2] = Sprite.Create(tex, new Rect(1221.0f, 1410.0f, 160.0f, 70.0f), new Vector2(80.0f, 35.0f)); + + spritesFi.SetValue(changer, newSprites); + + changer.patternNumber = (int)Singleton.instance.userOption.customSet.Rating; + } } + + private extern void orig_chengeParamOther(int currentParam); private void chengeParamOther(int currentParam) { if(myOptionId == UserOption.OptionName.Rating) { - transform.Find("NUL_SWH_Option_00/NUL_Select/PAT_OnOff").GetComponent().patternNumber = currentParam != 0 ? 0f : 1f; + var changer = transform.Find("NUL_SWH_Option_00/NUL_Select/PAT_OnOff").GetComponent(); + changer.patternNumber = currentParam; Singleton.instance.userOption.customSet.Rating = (UserOption.eRating)currentParam; SingletonMonoBehaviour.instance.userData.setUserDetail(); } else { diff --git a/NaiveRating/MU3/patch_UIResultBattlePoint.cs b/NaiveRating/MU3/patch_UIResultBattlePoint.cs index db9df6b..5fde59e 100644 --- a/NaiveRating/MU3/patch_UIResultBattlePoint.cs +++ b/NaiveRating/MU3/patch_UIResultBattlePoint.cs @@ -1,9 +1,11 @@ -using MU3.CustomUI; +using MonoMod; +using MU3.CustomUI; using MU3.Sequence; using MU3.User; using UnityEngine; namespace MU3; + class patch_UIResultBattlePoint: UIResultBattlePoint { private Animator animator_; private MU3UICounter counterScore_; @@ -12,8 +14,9 @@ class patch_UIResultBattlePoint: UIResultBattlePoint { private MU3UICounter counterScoreMinus_; private GameObject hideScore_; - private extern void orig_disable(MU3UICounter counter); - private void disable(MU3UICounter counter) => orig_disable(counter); + [MonoModIgnore] + private extern void disable(MU3UICounter counter); + public extern void orig_initTechRating(PlayInfo playInfo); public new void initTechRating(PlayInfo playInfo) { ((patch_MU3UICounter)counterScore_).isDispSuffix = NaiveRating.IsEnabled();