From 247f8f132bfb5d1aed5d6605edce5eb3108877eb Mon Sep 17 00:00:00 2001 From: Clansty Date: Tue, 30 Jul 2024 00:39:58 +0800 Subject: [PATCH] [F] Some compatability for 2p mode --- AquaMai/AquaMai.toml | 2 ++ AquaMai/UX/DemoMaster.cs | 11 +++++++---- AquaMai/UX/ExtendTimer.cs | 28 +++++++++++++++++++++++++++- AquaMai/UX/LoadLocalBga.cs | 13 ++++++------- AquaMai/UX/QuickSkip.cs | 28 +--------------------------- 5 files changed, 43 insertions(+), 39 deletions(-) diff --git a/AquaMai/AquaMai.toml b/AquaMai/AquaMai.toml index c532ab29..b81e560e 100644 --- a/AquaMai/AquaMai.toml +++ b/AquaMai/AquaMai.toml @@ -32,6 +32,7 @@ LoadAssetBundleWithoutManifest=true # Skip "New Event" and "Information" text boxes for new users SkipEventInfo=true # Random BGM, put Mai2Cue.{acb,awb} of old version of the game in `LocalAssets\Mai2Cue` and rename them +# Do not enable when SinglePlayer is off RandomBgm=false # Play "Master" difficulty on Demo screen DemoMaster=true @@ -39,6 +40,7 @@ DemoMaster=true ExecOnIdle="" ExecOnEntry="" # Disable timers +# Not recommand to enable when SinglePlayer is off ExtendTimer=true # Save immediate after playing a song ImmediateSave=true diff --git a/AquaMai/UX/DemoMaster.cs b/AquaMai/UX/DemoMaster.cs index 1f640dcf..052d0fcc 100644 --- a/AquaMai/UX/DemoMaster.cs +++ b/AquaMai/UX/DemoMaster.cs @@ -12,10 +12,13 @@ namespace AquaMai.UX [HarmonyPatch(typeof(AdvDemoProcess), "OnStart")] public static void AdvDemoProcessPostStart() { - var userOption = Singleton.Instance.GetGameScore(0).UserOption; - userOption.NoteSpeed = OptionNotespeedID.Speed7_0; + for (int i = 0; i < 2; i++) + { + var userOption = Singleton.Instance.GetGameScore(i).UserOption; + userOption.NoteSpeed = OptionNotespeedID.Speed6_5; + } } - + [HarmonyPrefix] [HarmonyPatch(typeof(GamePlayManager), "InitializeAdvertise")] public static void PreInitializeAdvertise() @@ -24,4 +27,4 @@ namespace AquaMai.UX GameManager.SelectDifficultyID[1] = 3; } } -} \ No newline at end of file +} diff --git a/AquaMai/UX/ExtendTimer.cs b/AquaMai/UX/ExtendTimer.cs index 57eb7a6a..5e7f8e1a 100644 --- a/AquaMai/UX/ExtendTimer.cs +++ b/AquaMai/UX/ExtendTimer.cs @@ -52,5 +52,31 @@ namespace AquaMai.UX ____monitors[0].SetButtonPressed(InputManager.ButtonSetting.Button04); Traverse.Create(__instance).Method("OnTimeUp").GetValue(); } + + [HarmonyPrefix] + [HarmonyPatch(typeof(PlInformationMonitor), "IsPlayPlInfoEnd")] + public static bool IWontTapOrSlideVigorously(ref bool __result) + { + __result = true; + return false; + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(GameOverMonitor), "IsPlayEnd")] + public static bool GameOverMonitorPlayEnd(ref bool __result) + { + __result = true; + return false; + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(GameOverProcess), "OnUpdate")] + public static void GameOverProcessOnUpdate(ref GameOverProcess.GameOverSequence ____state) + { + if (____state == GameOverProcess.GameOverSequence.SkyChange) + { + ____state = GameOverProcess.GameOverSequence.Disp; + } + } } -} \ No newline at end of file +} diff --git a/AquaMai/UX/LoadLocalBga.cs b/AquaMai/UX/LoadLocalBga.cs index 2d186f1b..2cbc4bc0 100644 --- a/AquaMai/UX/LoadLocalBga.cs +++ b/AquaMai/UX/LoadLocalBga.cs @@ -14,10 +14,6 @@ public class LoadLocalBga [HarmonyPatch(typeof(GameCtrl), "IsReady")] public static void LoadLocalBgaAwake(GameObject ____movieMaskObj) { - var components = ____movieMaskObj.GetComponentsInChildren(false); - var movie = components.FirstOrDefault(it => it.name == "Movie"); - if (movie is null) return; - var music = Singleton.Instance.GetMusic(GameManager.SelectMusicID[0]); if (music is null) return; @@ -28,8 +24,13 @@ public class LoadLocalBga if (jacket is null) { MelonLogger.Msg("No jacket found for music " + music); + return; } - else + + var components = ____movieMaskObj.GetComponentsInChildren(false); + var movies = components.Where(it => it.name == "Movie"); + + foreach (var movie in movies) { // If I create a new RawImage component, the jacket will be not be displayed // I think it will be difficult to make it work with RawImage @@ -39,7 +40,5 @@ public class LoadLocalBga sprite.sprite = Sprite.Create(jacket, new Rect(0, 0, jacket.width, jacket.height), new Vector2(0.5f, 0.5f)); sprite.material = new Material(Shader.Find("Sprites/Default")); } - - // movie.gameObject.SetActive(false); } } diff --git a/AquaMai/UX/QuickSkip.cs b/AquaMai/UX/QuickSkip.cs index 8cbd3c1a..2f489f79 100644 --- a/AquaMai/UX/QuickSkip.cs +++ b/AquaMai/UX/QuickSkip.cs @@ -92,31 +92,5 @@ namespace AquaMai.UX Singleton.Instance.SetQuickRetryFrag(flag: true); } } - - [HarmonyPrefix] - [HarmonyPatch(typeof(PlInformationMonitor), "IsPlayPlInfoEnd")] - public static bool IWontTapOrSlideVigorously(ref bool __result) - { - __result = true; - return false; - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(GameOverMonitor), "IsPlayEnd")] - public static bool GameOverMonitorPlayEnd(ref bool __result) - { - __result = true; - return false; - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(GameOverProcess), "OnUpdate")] - public static void GameOverProcessOnUpdate(ref GameOverProcess.GameOverSequence ____state) - { - if (____state == GameOverProcess.GameOverSequence.SkyChange) - { - ____state = GameOverProcess.GameOverSequence.Disp; - } - } } -} \ No newline at end of file +}