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;
|
namespace MU3.CustomUI;
|
||||||
|
|
||||||
class patch_MU3UICounter: MU3UICounter {
|
class patch_MU3UICounter: MU3UICounter {
|
||||||
public bool isRatingDisplay { get; set; }
|
public void SetRating(int value, byte suffix) {
|
||||||
|
Counter = UserUtil.toRatingFloat(value);
|
||||||
protected extern void orig_calcNumFiguresFloat(double value);
|
AddSuffix(suffix);
|
||||||
protected new void calcNumFiguresFloat(double value) {
|
|
||||||
orig_calcNumFiguresFloat(value);
|
|
||||||
|
|
||||||
if(isRatingDisplay) {
|
|
||||||
var b = CustomRating.GetSuffix();
|
|
||||||
if(b != 0) {
|
|
||||||
pushFigureFront(b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
protected void pushFigureFront(byte c) {
|
|
||||||
|
public void AddSuffix(byte c) {
|
||||||
for(int i = numFigures_; i > 0; --i) {
|
for(int i = numFigures_; i > 0; --i) {
|
||||||
figures_[i] = figures_[i - 1];
|
figures_[i] = figures_[i - 1];
|
||||||
}
|
}
|
||||||
figures_[0] = c;
|
figures_[0] = c;
|
||||||
numFigures_ += 1;
|
numFigures_ += 1;
|
||||||
}
|
SetVerticesDirty();
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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() {
|
public static int Get() {
|
||||||
switch(eRating) {
|
return eRating switch {
|
||||||
case patch_UserOption.eRating.Naive:
|
patch_UserOption.eRating.Naive => GetNaive(),
|
||||||
return GetNaive();
|
patch_UserOption.eRating.Reachable => GetReachable(),
|
||||||
case patch_UserOption.eRating.Reachable:
|
patch_UserOption.eRating.Recent => GetRecent(),
|
||||||
return GetReachable();
|
_ => 0,
|
||||||
case patch_UserOption.eRating.Recent:
|
};
|
||||||
return GetRecent();
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte GetSuffix() {
|
public static byte GetSuffix() {
|
||||||
switch(eRating) {
|
return eRating switch {
|
||||||
case patch_UserOption.eRating.Naive:
|
patch_UserOption.eRating.Naive => GetSuffix(0),
|
||||||
return MU3CounterBase.FigurePlus;
|
patch_UserOption.eRating.Reachable => GetSuffix(1),
|
||||||
case patch_UserOption.eRating.Reachable:
|
patch_UserOption.eRating.Recent => GetSuffix(2),
|
||||||
return MU3CounterBase.FigureMinus;
|
_ => 0,
|
||||||
case patch_UserOption.eRating.Recent:
|
};
|
||||||
return MU3CounterBase.FigureComma;
|
}
|
||||||
default:
|
public static byte GetSuffix(int idx) {
|
||||||
return 0;
|
return idx switch {
|
||||||
}
|
0 => MU3CounterBase.FigurePlus,
|
||||||
|
1 => MU3CounterBase.FigureMinus,
|
||||||
|
2 => MU3CounterBase.FigureComma,
|
||||||
|
_ => 0,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adapted from MU3.User.UserRating.calcBest()
|
// Adapted from MU3.User.UserRating.calcBest()
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
using MU3.CustomUI;
|
using MU3.CustomUI;
|
||||||
|
using MU3.Data;
|
||||||
|
using MU3.DB;
|
||||||
|
using MU3.Mod;
|
||||||
|
using MU3.User;
|
||||||
|
|
||||||
namespace MU3.SceneObject;
|
namespace MU3.SceneObject;
|
||||||
|
|
||||||
@ -7,8 +11,15 @@ class patch_ANM_CMN_UserDeta_01: ANM_CMN_UserDeta_01 {
|
|||||||
|
|
||||||
public extern void orig_setUserDetail();
|
public extern void orig_setUserDetail();
|
||||||
public new void setUserDetail() {
|
public new void setUserDetail() {
|
||||||
rating.isRatingDisplay = true;
|
|
||||||
orig_setUserDetail();
|
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 extern void orig_initTechRating(PlayInfo playInfo);
|
||||||
public new void initTechRating(PlayInfo playInfo) {
|
public new void initTechRating(PlayInfo playInfo) {
|
||||||
counterScore_.isRatingDisplay = true;
|
|
||||||
|
|
||||||
if(!CustomRating.IsEnabled()) {
|
if(!CustomRating.IsEnabled()) {
|
||||||
orig_initTechRating(playInfo);
|
orig_initTechRating(playInfo);
|
||||||
return;
|
return;
|
||||||
@ -36,6 +34,7 @@ class patch_UIResultBattlePoint: UIResultBattlePoint {
|
|||||||
int ratingPatternNo = UserUtil.toRatingPatternNo(rating1);
|
int ratingPatternNo = UserUtil.toRatingPatternNo(rating1);
|
||||||
counterScore_.SpriteIndex = ratingPatternNo;
|
counterScore_.SpriteIndex = ratingPatternNo;
|
||||||
imageHeader_.patternNumber = ratingPatternNo;
|
imageHeader_.patternNumber = ratingPatternNo;
|
||||||
|
counterScore_.AddSuffix(CustomRating.GetSuffix());
|
||||||
int rating2 = rating1 - prevRating;
|
int rating2 = rating1 - prevRating;
|
||||||
if(rating2 == 0) {
|
if(rating2 == 0) {
|
||||||
disable(counterScorePlus_);
|
disable(counterScorePlus_);
|
||||||
|
Reference in New Issue
Block a user