mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-13 07:57:26 +08:00
[+] QuickEndPlay button when notes play end
This commit is contained in:
59
AquaMai/TimeSaving/ShowQuickEndPlay.cs
Normal file
59
AquaMai/TimeSaving/ShowQuickEndPlay.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System.Collections.Generic;
|
||||
using AquaMai.Helpers;
|
||||
using AquaMai.Resources;
|
||||
using HarmonyLib;
|
||||
using MAI2.Util;
|
||||
using Manager;
|
||||
using Monitor;
|
||||
using Process;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AquaMai.TimeSaving;
|
||||
|
||||
public class ShowQuickEndPlay
|
||||
{
|
||||
private static bool _showUi;
|
||||
|
||||
[HarmonyPatch(typeof(GameProcess), "OnStart")]
|
||||
[HarmonyPostfix]
|
||||
public static void GameProcessPostStart(GameMonitor[] ____monitors)
|
||||
{
|
||||
_showUi = false;
|
||||
____monitors[0].gameObject.AddComponent<Ui>();
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(GameProcess), "OnUpdate")]
|
||||
[HarmonyPostfix]
|
||||
public static void GameProcessPostUpdate(GameProcess __instance, Message[] ____message, ProcessDataContainer ___container, byte ____sequence)
|
||||
{
|
||||
if (____sequence > 4)
|
||||
{
|
||||
_showUi = true;
|
||||
}
|
||||
|
||||
if (_showUi && (InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.B4) || InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.E4)))
|
||||
{
|
||||
var traverse = Traverse.Create(__instance);
|
||||
___container.processManager.SendMessage(____message[0]);
|
||||
Singleton<GamePlayManager>.Instance.SetSyncResult(0);
|
||||
traverse.Method("SetRelease").GetValue();
|
||||
}
|
||||
}
|
||||
|
||||
private class Ui : MonoBehaviour
|
||||
{
|
||||
public void OnGUI()
|
||||
{
|
||||
if (!_showUi) return;
|
||||
var style = GUI.skin.GetStyle("button");
|
||||
style.fontSize = GuiSizes.FontSize;
|
||||
|
||||
var x = GuiSizes.PlayerCenter;
|
||||
var y = Screen.height - GuiSizes.PlayerWidth * .37f;
|
||||
var width = GuiSizes.PlayerWidth * .25f;
|
||||
var height = GuiSizes.PlayerWidth * .13f;
|
||||
|
||||
GUI.Button(new Rect(x, y, width, height), Locale.Skip);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user