1
0
forked from akanyan/mu3-mods

feat(MPO): add textures and fix an edge case

This commit is contained in:
2024-12-27 20:11:39 +00:00
parent 076fb75a6d
commit c6884bff7e
12 changed files with 2664 additions and 41 deletions

BIN
Assets/abort.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -6,8 +6,12 @@ class patch_MU3UICounter: MU3UICounter {
protected extern void orig_calcNumFiguresFloat(double value); protected extern void orig_calcNumFiguresFloat(double value);
protected new void calcNumFiguresFloat(double value) { protected new void calcNumFiguresFloat(double value) {
orig_calcNumFiguresFloat(value); orig_calcNumFiguresFloat(value);
if(isDispSuffix) { if(isDispSuffix) {
pushFigureFront(CustomRating.GetSuffix()); var b = CustomRating.GetSuffix();
if(b != 0) {
pushFigureFront(b);
}
} }
} }
public bool isDispSuffix { get; set; } public bool isDispSuffix { get; set; }

File diff suppressed because it is too large Load Diff

View File

@ -75,20 +75,20 @@ public static class CustomRating {
return res / 55; return res / 55;
} }
public static bool IsNaiveEnabled() { private static bool isNaiveEnabled() {
return Singleton<UserManager>.instance.userOption.customSet.Rating == (UserOption.eRating)patch_UserOption.eRating.Naive; return Singleton<UserManager>.instance.userOption.customSet.Rating == (UserOption.eRating)patch_UserOption.eRating.Naive;
} }
public static bool IsReachableEnabled() { private static bool isReachableEnabled() {
return Singleton<UserManager>.instance.userOption.customSet.Rating == (UserOption.eRating)patch_UserOption.eRating.Reachable; return Singleton<UserManager>.instance.userOption.customSet.Rating == (UserOption.eRating)patch_UserOption.eRating.Reachable;
} }
public static bool IsEnabled() { public static bool IsEnabled() {
return IsNaiveEnabled() || IsReachableEnabled(); return isNaiveEnabled() || isReachableEnabled();
} }
public static int Get() { public static int Get() {
if(IsNaiveEnabled()) { if(isNaiveEnabled()) {
return GetNaive(); return GetNaive();
} else if(IsReachableEnabled()) { } else if(isReachableEnabled()) {
return GetReachable(); return GetReachable();
} else { } else {
return 0; return 0;
@ -96,10 +96,12 @@ public static class CustomRating {
} }
public static byte GetSuffix() { public static byte GetSuffix() {
if(IsNaiveEnabled()) { if(isNaiveEnabled()) {
return MU3CounterBase.FigurePlus; return MU3CounterBase.FigurePlus;
} else { } else if(isReachableEnabled()) {
return MU3CounterBase.FigureMinus; return MU3CounterBase.FigureMinus;
} else {
return 0;
} }
} }
} }

View File

@ -1,13 +1,15 @@
using MU3.CustomUI; using MU3.CustomUI;
using MU3.Mod;
namespace MU3.SceneObject; namespace MU3.SceneObject;
class patch_ANM_CMN_UserDeta_01: ANM_CMN_UserDeta_01 { class patch_ANM_CMN_UserDeta_01: ANM_CMN_UserDeta_01 {
private patch_MU3UICounter rating; private patch_MU3UICounter rating;
public extern void orig_setUserDetail(); public extern void orig_setUserDetail();
public new void setUserDetail() { public new void setUserDetail() {
rating.isDispSuffix = CustomRating.IsEnabled(); rating.isDispSuffix = true;
orig_setUserDetail(); orig_setUserDetail();
rating.setForceDirty();
} }
} }

View File

@ -0,0 +1,33 @@
using MU3.CustomUI;
using System.Reflection;
using UnityEngine;
namespace MU3;
class patch_ANM_PLY_retire_score: ANM_PLY_retire_score {
private MU3UIImageChanger _rank;
private extern void orig_Awake();
private void Awake() {
orig_Awake();
var spritesFi = typeof(MU3UIImageChanger).GetField("_sprites", BindingFlags.Instance | BindingFlags.NonPublic);
var oldSprites = (Sprite[])spritesFi.GetValue(_rank);
spritesFi.SetValue(_rank, new Sprite[6]);
for(var i = 0; i < 3; ++i) {
_rank.setSprite(i, oldSprites[i]);
}
var pivot = oldSprites[0].pivot;
Texture2D tex = new Texture2D(2, 2);
tex.LoadImage(Mod.AbortTexture.Bytes);
tex.anisoLevel = 1;
tex.filterMode = FilterMode.Bilinear;
_rank.setSprite(3, Sprite.Create(tex, new Rect(54, 256 - 117, 57, 31), pivot));
_rank.setSprite(4, Sprite.Create(tex, new Rect(0, 256 - 117, 53, 31), pivot));
_rank.setSprite(5, Sprite.Create(tex, new Rect(0, 256 - 149, 53, 31), pivot));
}
}

View File

@ -9,44 +9,44 @@ class patch_BattleUI: BattleUI {
private UIRetireInfo _retireInfo; private UIRetireInfo _retireInfo;
private SessionInfo _sessionInfo; private SessionInfo _sessionInfo;
public new void setRetireInfo(UserOption.eAbort abort) { public new void setRetireInfo(UserOption.eAbort abort) {
UIRetireInfo.Rank rank; patch_UIRetireInfo.Rank rank;
int num; int num;
var pabort = (patch_UserOption.eAbort)abort; var pabort = (patch_UserOption.eAbort)abort;
switch(pabort) { switch(pabort) {
case patch_UserOption.eAbort.S: case patch_UserOption.eAbort.S:
rank = UIRetireInfo.Rank.S; rank = patch_UIRetireInfo.Rank.S;
num = 1010000 - TechnicalRankID.S.getLower(); num = 1010000 - TechnicalRankID.S.getLower();
break; break;
case patch_UserOption.eAbort.SS: case patch_UserOption.eAbort.SS:
rank = UIRetireInfo.Rank.SS; rank = patch_UIRetireInfo.Rank.SS;
num = 1010000 - TechnicalRankID.SS.getLower(); num = 1010000 - TechnicalRankID.SS.getLower();
break; break;
case patch_UserOption.eAbort.SSS: case patch_UserOption.eAbort.SSS:
rank = UIRetireInfo.Rank.SSS; rank = patch_UIRetireInfo.Rank.SSS;
num = 1010000 - TechnicalRankID.SSS.getLower(); num = 1010000 - TechnicalRankID.SSS.getLower();
break; break;
case patch_UserOption.eAbort.SSS1: case patch_UserOption.eAbort.SSS1:
rank = UIRetireInfo.Rank.S; rank = patch_UIRetireInfo.Rank.SSS1;
num = 1010000 - TechnicalRankID.SSS1.getLower(); num = 1010000 - TechnicalRankID.SSS1.getLower();
break; break;
case patch_UserOption.eAbort.PB: case patch_UserOption.eAbort.PB:
UserManager userManager = Singleton<UserManager>.instance; UserManager userManager = Singleton<UserManager>.instance;
var userFumen = userManager.getUserFumen(_sessionInfo.musicData.id, _sessionInfo.musicLevel, create: false); var userFumen = userManager.getUserFumen(_sessionInfo.musicData.id, _sessionInfo.musicLevel, create: false);
var previousPb = userFumen?.TechScoreMax ?? 0; var previousPb = userFumen?.TechScoreMax ?? 0;
rank = UIRetireInfo.Rank.S; rank = patch_UIRetireInfo.Rank.PB;
num = 1010000 - Math.Max(previousPb, TechnicalRankID.AA.getLower()); num = 1010000 - Math.Max(previousPb, TechnicalRankID.AA.getLower());
break; break;
case patch_UserOption.eAbort.FB: case patch_UserOption.eAbort.FB:
case patch_UserOption.eAbort.AA: case patch_UserOption.eAbort.AA:
rank = UIRetireInfo.Rank.S; rank = patch_UIRetireInfo.Rank.AA;
num = 1010000 - TechnicalRankID.AA.getLower(); num = 1010000 - TechnicalRankID.AA.getLower();
break; break;
default: default:
rank = UIRetireInfo.Rank.MAX; rank = patch_UIRetireInfo.Rank.MAX;
num = 0; num = 0;
break; break;
} }
_retireInfo.setupRetireInfo(rank, num); _retireInfo.setupRetireInfo((UIRetireInfo.Rank)rank, num);
} }
} }

View File

@ -13,11 +13,18 @@ class patch_OptionSelecterController: OptionSelecterController {
[MonoModIgnore] [MonoModIgnore]
private extern void setInputCursor(int currentParam); private extern void setInputCursor(int currentParam);
private extern void orig_setupCpFuncArray();
private void setupCpFuncArray() {
orig_setupCpFuncArray();
cpFuncArray[33].max = 3;
cpFuncArray[4].max = 7;
}
public extern void orig_init(UserOption.OptionName id); public extern void orig_init(UserOption.OptionName id);
public new void init(UserOption.OptionName id) { public new void init(UserOption.OptionName id) {
orig_init(id); orig_init(id);
cpFuncArray[33].max = 3;
cpFuncArray[4].max = 7; var spritesFi = typeof(MU3UIImageChanger).GetField("_sprites", BindingFlags.Instance | BindingFlags.NonPublic);
if(id == UserOption.OptionName.Rating) { if(id == UserOption.OptionName.Rating) {
var rct = transform.Find("NUL_SWH_Option_00/NUL_Select/PAT_OnOff").GetComponent<RectTransform>(); var rct = transform.Find("NUL_SWH_Option_00/NUL_Select/PAT_OnOff").GetComponent<RectTransform>();
@ -26,19 +33,38 @@ class patch_OptionSelecterController: OptionSelecterController {
rct.anchoredPosition = new Vector3(0f, -5f, 0); rct.anchoredPosition = new Vector3(0f, -5f, 0);
rct.sizeDelta = new Vector2(158, 70); rct.sizeDelta = new Vector2(158, 70);
var spritesFi = typeof(MU3UIImageChanger).GetField("_sprites", BindingFlags.Instance | BindingFlags.NonPublic);
var tex = ((Sprite[])spritesFi.GetValue(changer))[0].texture; var tex = ((Sprite[])spritesFi.GetValue(changer))[0].texture;
spritesFi.SetValue(changer, new Sprite[4]); spritesFi.SetValue(changer, new Sprite[4]);
changer.setSprite(0, Sprite.Create(tex, new Rect(1552.0f, 366.0f, 160.0f, 65.0f), new Vector2(80.0f, 0.0f))); 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.0f, 1488.0f, 160.0f, 70.0f), new Vector2(80.0f, 35.0f))); 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.0f, 1410.0f, 160.0f, 70.0f), new Vector2(80.0f, 35.0f))); 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.0f, 1346.0f, 160.0f, 70.0f), new Vector2(80.0f, 35.0f))); 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.0f, 1424.0f, 160.0f, 70.0f), new Vector2(80.0f, 35.0f))); //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.0f, 1502.0f, 160.0f, 70.0f), new Vector2(80.0f, 35.0f))); //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.0f, 1604.0f, 160.0f, 70.0f), new Vector2(80.0f, 35.0f))); //changer.setSprite(6, Sprite.Create(tex, new Rect(797, 1604, 160, 70), new Vector2(8, 35)));
setInputCursor((int)Singleton<UserManager>.instance.userOption.customSet.Rating); setInputCursor((int)Singleton<UserManager>.instance.userOption.customSet.Rating);
} else if(id == UserOption.OptionName.Abort) {
var changer = transform.Find("NUL_SWH_Option_00/NUL_Select/PAT_Clear").GetComponent<MU3UIImageChanger>();
var oldSprites = (Sprite[])spritesFi.GetValue(changer);
spritesFi.SetValue(changer, new Sprite[8]);
for(var i = 0; i < 4; ++i) {
changer.setSprite(i, oldSprites[i]);
}
var pivot = oldSprites[0].pivot;
Texture2D tex = new Texture2D(2, 2);
tex.LoadImage(Mod.AbortTexture.Bytes);
tex.anisoLevel = 1;
tex.filterMode = FilterMode.Bilinear;
changer.setSprite(4, Sprite.Create(tex, new Rect(3, 256 - 82, 115, 81), pivot));
changer.setSprite(5, Sprite.Create(tex, new Rect(119, 256 - 200, 110, 75), pivot));
changer.setSprite(6, Sprite.Create(tex, new Rect(2, 256 - 240, 110, 75), pivot));
changer.setSprite(7, Sprite.Create(tex, new Rect(137, 256 - 105, 110, 75), pivot));
} }
} }
@ -53,12 +79,4 @@ class patch_OptionSelecterController: OptionSelecterController {
orig_chengeParamOther(currentParam); orig_chengeParamOther(currentParam);
} }
} }
private extern void orig_chengeParamAbort(int currentParam);
private void chengeParamAbort(int currentParam) {
string text = "NUL_SWH_Option_00/NUL_Select/PAT_Clear";
GameObject gameObject = transform.Find(text).gameObject;
MU3UIImageChanger component = gameObject.GetComponent<MU3UIImageChanger>();
component.patternNumber = currentParam > 4 ? 0 : currentParam;
}
} }

View File

@ -21,7 +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_.isDispSuffix = CustomRating.IsEnabled();
if(!CustomRating.IsEnabled()) { if(!CustomRating.IsEnabled()) {
orig_initTechRating(playInfo); orig_initTechRating(playInfo);
return; return;

View File

@ -0,0 +1,30 @@
using MonoMod;
namespace MU3;
class patch_UIRetireInfo: UIRetireInfo {
private ANM_PLY_retire_score _retireScore;
private bool _isEnable;
[MonoModEnumReplace]
public new enum Rank {
S,
SS,
SSS,
SSS1,
PB,
AA,
MAX
}
public extern void orig_setupRetireInfo(Rank rank, int score);
public void setupRetireInfo(Rank rank, int score) {
if(rank == Rank.MAX) {
_isEnable = false;
return;
}
_isEnable = true;
_retireScore.setRank((UIRetireInfo.Rank)rank);
_retireScore.setScore(score);
}
}

View File

@ -1,7 +1,6 @@
namespace MU3.Mod; namespace MU3.Mod;
public static class InternalSortPreview { public static class InternalSortTexture {
// This really shouldn't be a png but it's just one texture
public static byte[] Bytes = { public static byte[] Bytes = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x79, 0x08, 0x02, 0x00, 0x00, 0x00, 0x96, 0x41, 0x0b, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x79, 0x08, 0x02, 0x00, 0x00, 0x00, 0x96, 0x41, 0x0b,

View File

@ -22,7 +22,9 @@ class patch_UISortButton: UISortButton {
} }
Texture2D tex = new Texture2D(2, 2); Texture2D tex = new Texture2D(2, 2);
tex.LoadImage(Mod.InternalSortPreview.Bytes); tex.LoadImage(Mod.InternalSortTexture.Bytes);
tex.anisoLevel = 1;
tex.filterMode = FilterMode.Bilinear;
newSprites[n] = Sprite.Create(tex, new Rect(0, 0, 254, 121), newSprites[0].pivot); newSprites[n] = Sprite.Create(tex, new Rect(0, 0, 254, 121), newSprites[0].pivot);