diff --git a/AquaMai/AquaMai.csproj b/AquaMai/AquaMai.csproj index d5b1378f..e16e0956 100644 --- a/AquaMai/AquaMai.csproj +++ b/AquaMai/AquaMai.csproj @@ -277,6 +277,7 @@ + diff --git a/AquaMai/AquaMai.toml b/AquaMai/AquaMai.toml index 5fa2302f..fe73057e 100644 --- a/AquaMai/AquaMai.toml +++ b/AquaMai/AquaMai.toml @@ -8,6 +8,8 @@ TicketUnlock=true MapUnlock=true # Unlock Utage without the need of DXRating 10000 UnlockUtage=true +# Restore AutoPlay(Home) and Pause(Enter) for SDGA +DebugFeature=true # =================================== # UX: User Experience Improvements diff --git a/AquaMai/AquaMai.zh.toml b/AquaMai/AquaMai.zh.toml index 67210bea..c4de6459 100644 --- a/AquaMai/AquaMai.zh.toml +++ b/AquaMai/AquaMai.zh.toml @@ -8,6 +8,8 @@ TicketUnlock=true MapUnlock=true # 不需要万分也可以进宴会场 UnlockUtage=true +# 恢复 SDGA 的自动播放(Home)和暂停(Enter)按键 +DebugFeature=true # =================================== # 用户体验改进 diff --git a/AquaMai/Cheat/DebugFeature.cs b/AquaMai/Cheat/DebugFeature.cs new file mode 100644 index 00000000..e7924441 --- /dev/null +++ b/AquaMai/Cheat/DebugFeature.cs @@ -0,0 +1,33 @@ +using System; +using HarmonyLib; +using Manager; +using Process; +using UnityEngine; + +namespace AquaMai.Cheat; + +public class DebugFeature +{ +# if SDGA145 + private static bool isPause = false; + + [HarmonyPostfix] + [HarmonyPatch(typeof(GameProcess), "OnUpdate")] + public static void PostGameProcessUpdate(GameProcess __instance, byte ____sequence, MovieController ____gameMovie) + { + if (____sequence != 4) return; + // GameSequence.Play + if (Input.GetKeyDown(KeyCode.Home)) + { + GameManager.AutoPlay = (GameManager.AutoPlayMode)((int)(GameManager.AutoPlay + 1) % Enum.GetNames(typeof(GameManager.AutoPlayMode)).Length); + } + else if (DebugInput.GetKeyDown(KeyCode.Return)) + { + isPause = !isPause; + SoundManager.PauseMusic(isPause); + ____gameMovie.Pause(isPause); + NotesManager.Pause(isPause); + } + } +# endif +} diff --git a/AquaMai/Config.cs b/AquaMai/Config.cs index a10a3cdd..25beb98c 100644 --- a/AquaMai/Config.cs +++ b/AquaMai/Config.cs @@ -15,6 +15,7 @@ namespace AquaMai public bool TicketUnlock { get; set; } public bool MapUnlock { get; set; } public bool UnlockUtage { get; set; } + public bool DebugFeature { get; set; } } public class UXConfig diff --git a/AquaMai/Main.cs b/AquaMai/Main.cs index b28dd39f..083e42a3 100644 --- a/AquaMai/Main.cs +++ b/AquaMai/Main.cs @@ -12,20 +12,20 @@ namespace AquaMai public const string Description = "Mod for Sinmai"; public const string Author = "Aza"; public const string Company = null; - public const string Version = "1.0.0"; + public const string Version = "1.0.1"; public const string DownloadLink = null; } public class AquaMai : MelonMod { public static Config AppConfig { get; private set; } - + private static void Patch(Type type) { MelonLogger.Msg($"> Patching {type}"); HarmonyLib.Harmony.CreateAndPatchAll(type); } - + /** * Apply patches using reflection, based on the settings */ @@ -44,10 +44,10 @@ namespace AquaMai { // The property should be a boolean if (settingProp.PropertyType != typeof(bool)) continue; - + // Check if the boolean value is true if (!(bool) settingProp.GetValue(categoryValue)) continue; - + // Get the Type from the config directive name var directiveType = Type.GetType($"AquaMai.{categoryProp.Name}.{settingProp.Name}"); @@ -57,8 +57,8 @@ namespace AquaMai } } } - - public override void OnInitializeMelon() + + public override void OnInitializeMelon() { MelonLogger.Msg("Loading mod settings..."); @@ -71,10 +71,10 @@ namespace AquaMai // Read AquaMai.toml to load settings AppConfig = TomletMain.To(System.IO.File.ReadAllText("AquaMai.toml")); - + // Apply patches based on the settings ApplyPatches(); - + // Fixes that does not have side effects // These don't need to be configurable Patch(typeof(FixCharaCrash));