Add ability to skip a bunch of stuff directly to music selection

pull/7/head
Tianyi Cao 2024-02-07 02:16:24 -08:00
parent 8152b9ab0d
commit 279fe5dcb8
5 changed files with 47 additions and 11 deletions

View File

@ -268,6 +268,7 @@
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
<Compile Include="UX\SinglePlayer.cs" /> <Compile Include="UX\SinglePlayer.cs" />
<Compile Include="UX\SkipWarningScreen.cs" /> <Compile Include="UX\SkipWarningScreen.cs" />
<Compile Include="UX\SkipToMusicSelection.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />

View File

@ -11,6 +11,7 @@ namespace AquaMai
{ {
public bool SkipWarningScreen { get; set; } public bool SkipWarningScreen { get; set; }
public bool SinglePlayer { get; set; } public bool SinglePlayer { get; set; }
public bool SkipToMusicSelection { get; set; }
} }
} }
} }

View File

@ -44,6 +44,12 @@ namespace AquaMai
HarmonyLib.Harmony.CreateAndPatchAll(typeof(SinglePlayer)); HarmonyLib.Harmony.CreateAndPatchAll(typeof(SinglePlayer));
} }
if (AppConfig.UX.SkipToMusicSelection)
{
MelonLogger.Msg($"> Patching {nameof(SkipToMusicSelection)}");
HarmonyLib.Harmony.CreateAndPatchAll(typeof(SkipToMusicSelection));
}
MelonLogger.Msg("Loaded!"); MelonLogger.Msg("Loaded!");
} }
} }

View File

@ -2,10 +2,12 @@ using System;
using HarmonyLib; using HarmonyLib;
using UnityEngine; using UnityEngine;
namespace AquaMai { namespace AquaMai.UX
{
// Hides the 2p (right hand side) UI. // Hides the 2p (right hand side) UI.
// Note: this is not my original work. I simply interpreted the code and rewrote it as a mod. // Note: this is not my original work. I simply interpreted the code and rewrote it as a mod.
public class SinglePlayer { public class SinglePlayer
{
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(Main.GameMain), "LateInitialize", new Type[] { typeof(MonoBehaviour), typeof(Transform), typeof(Transform) })] [HarmonyPatch(typeof(Main.GameMain), "LateInitialize", new Type[] { typeof(MonoBehaviour), typeof(Transform), typeof(Transform) })]
public static bool LateInitialize(MonoBehaviour gameMainObject, ref Transform left, ref Transform right) public static bool LateInitialize(MonoBehaviour gameMainObject, ref Transform left, ref Transform right)

View File

@ -0,0 +1,26 @@
using HarmonyLib;
using Manager;
using Process;
using Process.Information;
namespace AquaMai.UX
{
public class SkipToMusicSelection
{
/*
* Highly experimental, may well break some stuff
* Works by overriding the info screen (where it shows new events and stuff)
* to directly exit to the music selection screen, skipping character and
* event selection, among others
*/
[HarmonyPrefix]
[HarmonyPatch(typeof(InformationProcess), "OnUpdate")]
public static bool OnUpdate(InformationProcess __instance, ProcessDataContainer ___container)
{
GameManager.SetMaxTrack();
___container.processManager.AddProcess(new MusicSelectProcess(___container), 50);
___container.processManager.ReleaseProcess(__instance);
return false;
}
}
}