1
0
forked from akanyan/mu3-mods

fix(MoreProfileOptions): a better way

This commit is contained in:
2025-01-03 17:39:16 +00:00
parent 61eec6770e
commit 15f2fe6f57
7 changed files with 80 additions and 63 deletions

View File

@ -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;
}
}
}

View File

@ -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);
}
}