Skip to content

Commit

Permalink
[+] Fix level display everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Oct 4, 2024
1 parent 2ef1042 commit 7deb395
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 19 deletions.
1 change: 1 addition & 0 deletions AquaMai/AquaMai.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ DEBUG</DefineConstants>
<Compile Include="Fix\FixCharaCrash.cs" />
<Compile Include="Fix\FixCheckAuth.cs" />
<Compile Include="Fix\FixConnSlide.cs" />
<Compile Include="Fix\FixLevelDisplay.cs" />
<Compile Include="Fix\FontFix.cs" />
<Compile Include="Fix\ForceAsServer.cs" />
<Compile Include="Fix\ForceFreePlay.cs" />
Expand Down
19 changes: 0 additions & 19 deletions AquaMai/Fix/BasicFix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,6 @@ private static bool CalcSpecialNum(ref int __result)
return false;
}

[HarmonyPostfix]
[HarmonyPatch(typeof(MusicChainCardObejct), "SetLevel")]
private static void FixLevelShift(MusicLevelID levelID, ref SpriteCounter ____digitLevel, ref SpriteCounter ____doubleDigitLevel)
{
switch (levelID)
{
case > MusicLevelID.Level9P:
____digitLevel.gameObject.SetActive(value: false);
____doubleDigitLevel.gameObject.SetActive(value: true);
____doubleDigitLevel.ChangeText(levelID.GetLevelNum().PadRight(3));
break;
case >= MusicLevelID.None:
____digitLevel.gameObject.SetActive(value: true);
____doubleDigitLevel.gameObject.SetActive(value: false);
____digitLevel.ChangeText(levelID.GetLevelNum().PadRight(2));
break;
}
}

[HarmonyPrefix]
[HarmonyPatch(typeof(NetHttpClient), "CheckServerHash")]
private static bool CheckServerHash(ref bool __result)
Expand Down
73 changes: 73 additions & 0 deletions AquaMai/Fix/FixLevelDisplay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using HarmonyLib;
using MAI2.Util;
using Manager;
using Monitor;
using Monitor.MusicSelect.ChainList;
using UnityEngine;

namespace AquaMai.Fix;

public class FixLevelDisplay
{
[HarmonyPostfix]
[HarmonyPatch(typeof(MusicChainCardObejct), "SetLevel")]
private static void FixLevelShiftMusicChainCardObejct(MusicLevelID levelID, SpriteCounter ____digitLevel, SpriteCounter ____doubleDigitLevel, bool utage, GameObject ____difficultyUtageQuesionMarkSingleDigit, GameObject ____difficultyUtageQuesionMarkDoubleDigit)
{
switch (levelID)
{
case > MusicLevelID.Level9P:
____digitLevel.gameObject.SetActive(value: false);
____doubleDigitLevel.gameObject.SetActive(value: true);
____doubleDigitLevel.ChangeText(levelID.GetLevelNum().PadRight(3));
break;
case >= MusicLevelID.None:
____digitLevel.gameObject.SetActive(value: true);
____doubleDigitLevel.gameObject.SetActive(value: false);
____digitLevel.ChangeText(levelID.GetLevelNum().PadRight(2));
break;
}

if (!utage) return;
switch (levelID)
{
case > MusicLevelID.Level9P:
____difficultyUtageQuesionMarkSingleDigit.SetActive(value: false);
____difficultyUtageQuesionMarkDoubleDigit.SetActive(value: true);
break;
case >= MusicLevelID.None:
____difficultyUtageQuesionMarkSingleDigit.SetActive(value: true);
____difficultyUtageQuesionMarkDoubleDigit.SetActive(value: false);
break;
}
}

[HarmonyPostfix]
[HarmonyPatch(typeof(SingleResultCardController), "SetLevel")]
private static void FixLevelShiftSingleResultCardController(MusicLevelID levelID, bool isUtage, ref SpriteCounter ____difficultySingle, ref SpriteCounter ____difficultyDouble, GameObject ____utageQuestionMarkSingleDigit, GameObject ____utageQuestionMarkDoubleDigit)
{
FixLevelShiftMusicChainCardObejct(levelID, ____difficultySingle, ____difficultyDouble, isUtage, ____utageQuestionMarkSingleDigit, ____utageQuestionMarkDoubleDigit);
}

[HarmonyPostfix]
[HarmonyPatch(typeof(TotalResultPlayer), "SetLevel")]
private static void FixLevelShiftTotalResultPlayer(MusicLevelID levelID, bool isUtage, ref SpriteCounter ____difficultySingle, ref SpriteCounter ____difficultyDouble, GameObject ____utageQuestionMarkSingleDigit, GameObject ____utageQuestionMarkDoubleDigit)
{
FixLevelShiftMusicChainCardObejct(levelID, ____difficultySingle, ____difficultyDouble, isUtage, ____utageQuestionMarkSingleDigit, ____utageQuestionMarkDoubleDigit);
}

[HarmonyPostfix]
[HarmonyPatch(typeof(ResultMonitor), "SetLevel")]
private static void FixLevelShiftTotalResultPlayer(MusicLevelID levelID, ref SpriteCounter ____difficultySingle, ref SpriteCounter ____difficultyDouble)
{
FixLevelShiftMusicChainCardObejct(levelID, ____difficultySingle, ____difficultyDouble, false, null, null);
}

[HarmonyPostfix]
[HarmonyPatch(typeof(TrackStartMonitor), "SetTrackStart")]
private static void FixLevelShiftTrackStartMonitor(int ___monitorIndex, ref SpriteCounter ____difficultySingle, ref SpriteCounter ____difficultyDouble, GameObject ____utageQuestionSingleDigit, GameObject ____utageQuestionDoubleDigit)
{
var music = Singleton<DataManager>.Instance.GetMusic(GameManager.SelectMusicID[___monitorIndex]);
var levelID = (MusicLevelID)music.notesData[GameManager.SelectDifficultyID[___monitorIndex]].musicLevelID;
FixLevelShiftMusicChainCardObejct(levelID, ____difficultySingle, ____difficultyDouble, music.name.id >= 100000, ____utageQuestionSingleDigit, ____utageQuestionDoubleDigit);
}
}
1 change: 1 addition & 0 deletions AquaMai/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public override void OnInitializeMelon()
Patch(typeof(DebugFeature));
Patch(typeof(FixConnSlide));
Patch(typeof(SlideAutoPlayTweak));
Patch(typeof(FixLevelDisplay));
// UX
Patch(typeof(CustomVersionString));
Patch(typeof(CustomPlaceName));
Expand Down

0 comments on commit 7deb395

Please sign in to comment.