-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[+] QuickEndPlay button when notes play end
- Loading branch information
Showing
7 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} |