mu3-mods/NaiveRating/MU3/patch_UIResultBattlePoint.cs

48 lines
1.8 KiB
C#
Raw Normal View History

2024-07-07 14:47:46 +00:00
using MU3.CustomUI;
using MU3.Sequence;
using MU3.User;
using UnityEngine;
namespace MU3;
class patch_UIResultBattlePoint: UIResultBattlePoint {
private Animator animator_;
private MU3UICounter counterScore_;
private MU3UIImageChanger imageHeader_;
private MU3UICounter counterScorePlus_;
private MU3UICounter counterScoreMinus_;
private GameObject hideScore_;
private extern void orig_disable(MU3UICounter counter);
private void disable(MU3UICounter counter) => orig_disable(counter);
public extern void orig_initTechRating(PlayInfo playInfo);
public new void initTechRating(PlayInfo playInfo) {
((patch_MU3UICounter)counterScore_).isDispSuffix = NaiveRating.IsEnabled();
if(!NaiveRating.IsEnabled()) {
orig_initTechRating(playInfo);
return;
}
int prevRating = NaiveRating.PrevRating;
int rating1 = NaiveRating.Get();
if((bool)hideScore_) {
hideScore_.SetActive(false);
}
counterScore_.Counter = (double)UserUtil.toRatingFloat(rating1);
int ratingPatternNo = UserUtil.toRatingPatternNo(rating1);
counterScore_.SpriteIndex = ratingPatternNo;
imageHeader_.patternNumber = (float)ratingPatternNo;
int rating2 = rating1 - prevRating;
if(rating2 == 0) {
disable(counterScorePlus_);
disable(counterScoreMinus_);
animator_.SetInteger(MU3.Sys.Const.AnimatorID_State, 2);
} else if(0 < rating2) {
disable(counterScoreMinus_);
if((bool)counterScorePlus_) {
counterScorePlus_.Counter = rating2 * 0.01f + 1E-05f;
}
animator_.SetInteger(MU3.Sys.Const.AnimatorID_State, 0);
}
animator_.SetTrigger(MU3.Sys.Const.AnimatorID_In);
}
}