mirror of https://github.com/hykilpikonna/AquaDX
60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
![]() |
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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|