forked from akanyan/mu3-mods
fix(MoreProfileOptions): a better way
This commit is contained in:
@ -1,36 +1,19 @@
|
||||
using MU3.Mod;
|
||||
using MU3.User;
|
||||
using MU3.User;
|
||||
|
||||
namespace MU3.CustomUI;
|
||||
|
||||
class patch_MU3UICounter: MU3UICounter {
|
||||
public bool isRatingDisplay { get; set; }
|
||||
|
||||
protected extern void orig_calcNumFiguresFloat(double value);
|
||||
protected new void calcNumFiguresFloat(double value) {
|
||||
orig_calcNumFiguresFloat(value);
|
||||
|
||||
if(isRatingDisplay) {
|
||||
var b = CustomRating.GetSuffix();
|
||||
if(b != 0) {
|
||||
pushFigureFront(b);
|
||||
}
|
||||
}
|
||||
public void SetRating(int value, byte suffix) {
|
||||
Counter = UserUtil.toRatingFloat(value);
|
||||
AddSuffix(suffix);
|
||||
}
|
||||
protected void pushFigureFront(byte c) {
|
||||
|
||||
public void AddSuffix(byte c) {
|
||||
for(int i = numFigures_; i > 0; --i) {
|
||||
figures_[i] = figures_[i - 1];
|
||||
}
|
||||
figures_[0] = c;
|
||||
numFigures_ += 1;
|
||||
}
|
||||
|
||||
public extern void orig_set_Counter(double value);
|
||||
public void set_Counter(double value) {
|
||||
if(isRatingDisplay && CustomRating.IsEnabled()) {
|
||||
orig_set_Counter(UserUtil.toRatingFloat(CustomRating.Get()));
|
||||
} else {
|
||||
orig_set_Counter(value);
|
||||
}
|
||||
SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
using MU3.DB;
|
||||
using MU3.Mod;
|
||||
|
||||
namespace MU3.Data;
|
||||
|
||||
class patch_GameData: GameData {
|
||||
public extern static RatingColorID orig_getRatingColorIDFromRating100(int rating100);
|
||||
public static new RatingColorID getRatingColorIDFromRating100(int rating100) {
|
||||
if(CustomRating.IsEnabled()) {
|
||||
return orig_getRatingColorIDFromRating100(CustomRating.Get());
|
||||
} else {
|
||||
return orig_getRatingColorIDFromRating100(rating100);
|
||||
}
|
||||
}
|
||||
}
|
@ -68,29 +68,29 @@ public static class CustomRating {
|
||||
}
|
||||
|
||||
public static int Get() {
|
||||
switch(eRating) {
|
||||
case patch_UserOption.eRating.Naive:
|
||||
return GetNaive();
|
||||
case patch_UserOption.eRating.Reachable:
|
||||
return GetReachable();
|
||||
case patch_UserOption.eRating.Recent:
|
||||
return GetRecent();
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return eRating switch {
|
||||
patch_UserOption.eRating.Naive => GetNaive(),
|
||||
patch_UserOption.eRating.Reachable => GetReachable(),
|
||||
patch_UserOption.eRating.Recent => GetRecent(),
|
||||
_ => 0,
|
||||
};
|
||||
}
|
||||
|
||||
public static byte GetSuffix() {
|
||||
switch(eRating) {
|
||||
case patch_UserOption.eRating.Naive:
|
||||
return MU3CounterBase.FigurePlus;
|
||||
case patch_UserOption.eRating.Reachable:
|
||||
return MU3CounterBase.FigureMinus;
|
||||
case patch_UserOption.eRating.Recent:
|
||||
return MU3CounterBase.FigureComma;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return eRating switch {
|
||||
patch_UserOption.eRating.Naive => GetSuffix(0),
|
||||
patch_UserOption.eRating.Reachable => GetSuffix(1),
|
||||
patch_UserOption.eRating.Recent => GetSuffix(2),
|
||||
_ => 0,
|
||||
};
|
||||
}
|
||||
public static byte GetSuffix(int idx) {
|
||||
return idx switch {
|
||||
0 => MU3CounterBase.FigurePlus,
|
||||
1 => MU3CounterBase.FigureMinus,
|
||||
2 => MU3CounterBase.FigureComma,
|
||||
_ => 0,
|
||||
};
|
||||
}
|
||||
|
||||
// Adapted from MU3.User.UserRating.calcBest()
|
||||
|
@ -1,4 +1,8 @@
|
||||
using MU3.CustomUI;
|
||||
using MU3.Data;
|
||||
using MU3.DB;
|
||||
using MU3.Mod;
|
||||
using MU3.User;
|
||||
|
||||
namespace MU3.SceneObject;
|
||||
|
||||
@ -7,8 +11,15 @@ class patch_ANM_CMN_UserDeta_01: ANM_CMN_UserDeta_01 {
|
||||
|
||||
public extern void orig_setUserDetail();
|
||||
public new void setUserDetail() {
|
||||
rating.isRatingDisplay = true;
|
||||
orig_setUserDetail();
|
||||
rating.setForceDirty();
|
||||
|
||||
if(CustomRating.IsEnabled()) {
|
||||
var r = CustomRating.Get();
|
||||
rating.Counter = UserUtil.toRatingFloat(r);
|
||||
rating.AddSuffix(CustomRating.GetSuffix());
|
||||
RatingColorID ratingColorIDFromRating = GameData.getRatingColorIDFromRating100(r);
|
||||
transform.Find("NUM_CMN_UserData_01/NUM_Rating").GetComponent<MU3UICounter>().SpriteIndex = (int)ratingColorIDFromRating;
|
||||
transform.Find("NUM_CMN_UserData_01/NUM_Rating/PAT_Header").GetComponent<MU3UIImageChanger>().patternNumber = (float)ratingColorIDFromRating;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
using MU3.Collab;
|
||||
using MU3.CustomUI;
|
||||
using MU3.Mod;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MU3.SceneObject;
|
||||
|
||||
class patch_ANM_SWH_LocalMatching_User: ANM_SWH_LocalMatching_User {
|
||||
private GameObject _objRatingNum;
|
||||
private patch_MU3UICounter _counterRating;
|
||||
private GameObject _objRatingMask;
|
||||
|
||||
private extern void orig_set_sub(Party.UserInfo userInfo, bool isHost, bool isWaitPlay, bool forRecruit);
|
||||
private void set_sub(Party.UserInfo userInfo, bool isHost, bool isWaitPlay, bool forRecruit) {
|
||||
orig_set_sub(userInfo, isHost, isWaitPlay, forRecruit);
|
||||
|
||||
var flag = userInfo._optRatingID >= 1;
|
||||
_objRatingNum.SetActive(flag);
|
||||
if(userInfo._optRatingID > 1) {
|
||||
_counterRating.AddSuffix(userInfo._optRatingID switch {
|
||||
2 => CustomRating.GetSuffix(0),
|
||||
3 => CustomRating.GetSuffix(1),
|
||||
4 => CustomRating.GetSuffix(2),
|
||||
_ => 0
|
||||
});
|
||||
}
|
||||
|
||||
_objRatingMask.SetActive(!flag);
|
||||
}
|
||||
}
|
9
Extras/MoreProfileOptions/MU3.Sequence/patch_Play.cs
Normal file
9
Extras/MoreProfileOptions/MU3.Sequence/patch_Play.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using MU3.Util;
|
||||
|
||||
namespace MU3.Sequence;
|
||||
|
||||
class patch_Play: Play {
|
||||
private void Leave_Login() {
|
||||
SingletonMonoBehaviour<SystemUI>.instance.userData.setUserDetail();
|
||||
}
|
||||
}
|
@ -21,8 +21,6 @@ class patch_UIResultBattlePoint: UIResultBattlePoint {
|
||||
|
||||
public extern void orig_initTechRating(PlayInfo playInfo);
|
||||
public new void initTechRating(PlayInfo playInfo) {
|
||||
counterScore_.isRatingDisplay = true;
|
||||
|
||||
if(!CustomRating.IsEnabled()) {
|
||||
orig_initTechRating(playInfo);
|
||||
return;
|
||||
@ -36,6 +34,7 @@ class patch_UIResultBattlePoint: UIResultBattlePoint {
|
||||
int ratingPatternNo = UserUtil.toRatingPatternNo(rating1);
|
||||
counterScore_.SpriteIndex = ratingPatternNo;
|
||||
imageHeader_.patternNumber = ratingPatternNo;
|
||||
counterScore_.AddSuffix(CustomRating.GetSuffix());
|
||||
int rating2 = rating1 - prevRating;
|
||||
if(rating2 == 0) {
|
||||
disable(counterScorePlus_);
|
||||
|
Reference in New Issue
Block a user