From fb72317c6f91d09358134d4e48126aeac8c0a757 Mon Sep 17 00:00:00 2001
From: Azalea <22280294+hykilpikonna@users.noreply.github.com>
Date: Wed, 8 May 2024 21:47:36 +0800
Subject: [PATCH] [+] AquaMai: Skip event and info screen for new users
---
AquaMai/AquaMai.csproj | 1 +
AquaMai/AquaMai.toml | 2 ++
AquaMai/README.md | 1 +
AquaMai/UX/SkipEventInfo.cs | 38 +++++++++++++++++++++++++++++++++++++
4 files changed, 42 insertions(+)
create mode 100644 AquaMai/UX/SkipEventInfo.cs
diff --git a/AquaMai/AquaMai.csproj b/AquaMai/AquaMai.csproj
index a509da8a..bd63a1d7 100644
--- a/AquaMai/AquaMai.csproj
+++ b/AquaMai/AquaMai.csproj
@@ -275,6 +275,7 @@
+
diff --git a/AquaMai/AquaMai.toml b/AquaMai/AquaMai.toml
index e82ffda1..b4ac7e07 100644
--- a/AquaMai/AquaMai.toml
+++ b/AquaMai/AquaMai.toml
@@ -22,6 +22,8 @@ LoadJacketPng=true
QuickSkip=true
# Add ".ab" image resources without the need of rebuilding a manifest
LoadAssetBundleWithoutManifest=true
+# Skip "New Event" and "Information" text boxes for new users
+SkipEventInfo=true
[Performance]
# Disable some useless delays to speed up the game boot process
diff --git a/AquaMai/README.md b/AquaMai/README.md
index 6e22f3f1..e0392764 100644
--- a/AquaMai/README.md
+++ b/AquaMai/README.md
@@ -16,6 +16,7 @@ This mod is heavily WIP. More details will be added as the development progresse
* Disable daily automatic reboot
* Customize version text
* Skip the current song by holding 7
+* Skip "new event" and "information" screen for new players.
**Bug Fixes**
diff --git a/AquaMai/UX/SkipEventInfo.cs b/AquaMai/UX/SkipEventInfo.cs
new file mode 100644
index 00000000..330cfbdc
--- /dev/null
+++ b/AquaMai/UX/SkipEventInfo.cs
@@ -0,0 +1,38 @@
+using HarmonyLib;
+using MelonLoader;
+using Monitor.Information;
+using UnityEngine.Assertions;
+
+namespace AquaMai.UX
+{
+ public class SkipEventInfo
+ {
+ // public override void Initialize(int monIndex, bool active)
+ // Postfix: Set this.state to DispState.End
+ [HarmonyPostfix]
+ [HarmonyPatch(typeof(InformationMonitor), "Initialize", new []{typeof(int), typeof(bool)})]
+ public static void Initialize(InformationMonitor __instance, int monIndex, bool active)
+ {
+ // State is private, cannot access directly
+ // __instance.state = InformationMonitor.DispState.End;
+
+ // Use reflection to set the state
+ // var stateField = typeof(InformationMonitor).GetField("state", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
+ // if (stateField == null)
+ // {
+ // MelonLogger.Msg("Failed to get state field");
+ // return;
+ // }
+ // stateField.SetValue(__instance, InformationMonitor.DispState.End);
+
+ // Use reflection to set _dispTime to 0
+ var dispTimeField = typeof(InformationMonitor).GetField("_dispTime", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
+ if (dispTimeField == null)
+ {
+ MelonLogger.Msg("Failed to get _dispTime field");
+ return;
+ }
+ dispTimeField.SetValue(__instance, 0);
+ }
+ }
+}
\ No newline at end of file