forked from akanyan/mu3-mods
feat(MPO): implement TYPE-D
This commit is contained in:
@ -10,6 +10,89 @@ using System.Reflection;
|
||||
namespace MU3.Mod;
|
||||
|
||||
public static class CustomRating {
|
||||
private static patch_UserOption.eRating eRating => (patch_UserOption.eRating)Singleton<UserManager>.instance.userOption.customSet.Rating;
|
||||
|
||||
public static int GetNaive() {
|
||||
int res = 0;
|
||||
foreach(Rating best in calcNaive().Take(45)) {
|
||||
res += best.rate100;
|
||||
}
|
||||
return res / 45;
|
||||
}
|
||||
|
||||
public static int GetReachable() {
|
||||
FieldInfo piOld = typeof(UserRating).GetField("_bestOldList", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
FieldInfo piNew = typeof(UserRating).GetField("_bestNewList", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
|
||||
var ur = Singleton<UserManager>.instance.userRating;
|
||||
|
||||
int res = 0;
|
||||
int top = 0;
|
||||
foreach(Rating src in ((RatingList)piOld.GetValue(ur))) {
|
||||
res += src.rate100;
|
||||
|
||||
if(src.level100 == 0 || src.musicTbl.isLunatic || src.musicTbl.isBonusTrack) {
|
||||
continue;
|
||||
}
|
||||
top = Math.Max(top, src.rate100);
|
||||
}
|
||||
foreach(Rating src in ((RatingList)piNew.GetValue(ur))) {
|
||||
res += src.rate100;
|
||||
|
||||
if(src.level100 == 0 || src.musicTbl.isLunatic || src.musicTbl.isBonusTrack) {
|
||||
continue;
|
||||
}
|
||||
top = Math.Max(top, src.rate100);
|
||||
}
|
||||
|
||||
res += top * 10;
|
||||
|
||||
return res / 55;
|
||||
}
|
||||
|
||||
public static int GetRecent() {
|
||||
FieldInfo piHot = typeof(UserRating).GetField("_hotList", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
|
||||
var ur = Singleton<UserManager>.instance.userRating;
|
||||
|
||||
int res = 0;
|
||||
foreach(Rating src in ((RatingList)piHot.GetValue(ur))) {
|
||||
res += src.rate100;
|
||||
}
|
||||
|
||||
return res / 10;
|
||||
}
|
||||
|
||||
public static bool IsEnabled() {
|
||||
return eRating >= patch_UserOption.eRating.Naive;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// Adapted from MU3.User.UserRating.calcBest()
|
||||
private static RatingList calcNaive() {
|
||||
RatingList ratingList = [];
|
||||
@ -41,67 +124,4 @@ public static class CustomRating {
|
||||
ratingList.Sort();
|
||||
return ratingList;
|
||||
}
|
||||
public static int GetNaive() {
|
||||
int res = 0;
|
||||
foreach(Rating best in calcNaive().Take(45)) {
|
||||
res += best.rate100;
|
||||
}
|
||||
return res / 45;
|
||||
}
|
||||
|
||||
public static int GetReachable() {
|
||||
FieldInfo piOld = typeof(UserRating).GetField("_bestOldList", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
FieldInfo piNew = typeof(UserRating).GetField("_bestNewList", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
|
||||
var ur = Singleton<UserManager>.instance.userRating;
|
||||
|
||||
int res = 0;
|
||||
int top = 0;
|
||||
foreach(Rating best in ((RatingList)piOld.GetValue(ur))) {
|
||||
res += best.rate100;
|
||||
if(best.musicID < 7000) {
|
||||
top = Math.Max(top, best.rate100);
|
||||
}
|
||||
}
|
||||
foreach(Rating best in ((RatingList)piNew.GetValue(ur))) {
|
||||
res += best.rate100;
|
||||
if(best.musicID < 7000) {
|
||||
top = Math.Max(top, best.rate100);
|
||||
}
|
||||
}
|
||||
|
||||
res += top * 10;
|
||||
|
||||
return res / 55;
|
||||
}
|
||||
|
||||
private static bool isNaiveEnabled() {
|
||||
return Singleton<UserManager>.instance.userOption.customSet.Rating == (UserOption.eRating)patch_UserOption.eRating.Naive;
|
||||
}
|
||||
private static bool isReachableEnabled() {
|
||||
return Singleton<UserManager>.instance.userOption.customSet.Rating == (UserOption.eRating)patch_UserOption.eRating.Reachable;
|
||||
}
|
||||
public static bool IsEnabled() {
|
||||
return isNaiveEnabled() || isReachableEnabled();
|
||||
}
|
||||
|
||||
public static int Get() {
|
||||
if(isNaiveEnabled()) {
|
||||
return GetNaive();
|
||||
} else if(isReachableEnabled()) {
|
||||
return GetReachable();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static byte GetSuffix() {
|
||||
if(isNaiveEnabled()) {
|
||||
return MU3CounterBase.FigurePlus;
|
||||
} else if(isReachableEnabled()) {
|
||||
return MU3CounterBase.FigureMinus;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,8 @@ class patch_UserOption: UserOption {
|
||||
ON = 1,
|
||||
Naive = 2,
|
||||
Reachable = 3,
|
||||
MAX = 3
|
||||
Recent = 4,
|
||||
MAX = 4
|
||||
}
|
||||
|
||||
[MonoModEnumReplace]
|
||||
|
@ -23,6 +23,9 @@ class patch_OptionMiniSummaryController: OptionMiniSummaryController {
|
||||
case 3:
|
||||
comp.text = "TYPE-C";
|
||||
break;
|
||||
case 4:
|
||||
comp.text = "TYPE-D";
|
||||
break;
|
||||
}
|
||||
} else if(id == UserOption.OptionName.Abort) {
|
||||
switch(value) {
|
||||
|
@ -16,7 +16,7 @@ class patch_OptionSelecterController: OptionSelecterController {
|
||||
private extern void orig_setupCpFuncArray();
|
||||
private void setupCpFuncArray() {
|
||||
orig_setupCpFuncArray();
|
||||
cpFuncArray[33].max = 3;
|
||||
cpFuncArray[33].max = 4;
|
||||
cpFuncArray[4].max = 7;
|
||||
}
|
||||
|
||||
@ -34,13 +34,13 @@ class patch_OptionSelecterController: OptionSelecterController {
|
||||
rct.sizeDelta = new Vector2(158, 70);
|
||||
|
||||
var tex = ((Sprite[])spritesFi.GetValue(changer))[0].texture;
|
||||
spritesFi.SetValue(changer, new Sprite[4]);
|
||||
spritesFi.SetValue(changer, new Sprite[5]);
|
||||
|
||||
changer.setSprite(0, Sprite.Create(tex, new Rect(1552, 366, 160, 65), new Vector2(80, 0)));
|
||||
changer.setSprite(1, Sprite.Create(tex, new Rect(1221, 1488, 160, 70), new Vector2(80, 35)));
|
||||
changer.setSprite(2, Sprite.Create(tex, new Rect(1223, 1410, 160, 70), new Vector2(80, 35)));
|
||||
changer.setSprite(3, Sprite.Create(tex, new Rect(1508, 1346, 160, 70), new Vector2(80, 35)));
|
||||
//changer.setSprite(4, Sprite.Create(tex, new Rect(1389, 1424, 160, 70), new Vector2(8, 35)));
|
||||
changer.setSprite(4, Sprite.Create(tex, new Rect(1389, 1424, 160, 70), new Vector2(8, 35)));
|
||||
//changer.setSprite(5, Sprite.Create(tex, new Rect(941, 1502, 160, 70), new Vector2(8, 35)));
|
||||
//changer.setSprite(6, Sprite.Create(tex, new Rect(797, 1604, 160, 70), new Vector2(8, 35)));
|
||||
|
||||
|
@ -28,9 +28,8 @@ class patch_UIResultBattlePoint: UIResultBattlePoint {
|
||||
int prevRating = ((patch_SessionResult)playInfo.sessionResult).prevCustomRating;
|
||||
int rating1 = CustomRating.Get();
|
||||
|
||||
if((bool)hideScore_) {
|
||||
hideScore_.SetActive(false);
|
||||
}
|
||||
hideScore_?.SetActive(false);
|
||||
counterScore_.isDispSuffix = true;
|
||||
counterScore_.Counter = (double)UserUtil.toRatingFloat(rating1);
|
||||
int ratingPatternNo = UserUtil.toRatingPatternNo(rating1);
|
||||
counterScore_.SpriteIndex = ratingPatternNo;
|
||||
@ -42,10 +41,16 @@ class patch_UIResultBattlePoint: UIResultBattlePoint {
|
||||
animator_.SetInteger(Sys.Const.AnimatorID_State, 2);
|
||||
} else if(0 < rating2) {
|
||||
disable(counterScoreMinus_);
|
||||
if((bool)counterScorePlus_) {
|
||||
if(counterScorePlus_ != null) {
|
||||
counterScorePlus_.Counter = rating2 * 0.01f + 1E-05f;
|
||||
}
|
||||
animator_.SetInteger(Sys.Const.AnimatorID_State, 0);
|
||||
} else {
|
||||
disable(counterScorePlus_);
|
||||
if(counterScoreMinus_ != null) {
|
||||
counterScoreMinus_.Counter = rating2 * 0.01f + 1E-05f;
|
||||
}
|
||||
animator_.SetInteger(MU3.Sys.Const.AnimatorID_State, 1);
|
||||
}
|
||||
animator_.SetTrigger(Sys.Const.AnimatorID_In);
|
||||
}
|
||||
|
Reference in New Issue
Block a user