2024-07-04 12:39:11 +00:00
|
|
|
|
using MU3.Battle;
|
2024-07-02 01:34:51 +00:00
|
|
|
|
using MU3.Game;
|
|
|
|
|
using MU3.Notes;
|
|
|
|
|
using MU3.Util;
|
|
|
|
|
|
|
|
|
|
namespace MU3.Sequence;
|
|
|
|
|
|
2024-07-04 12:39:11 +00:00
|
|
|
|
class patch_PlayMusic: PlayMusic {
|
2024-07-02 01:34:51 +00:00
|
|
|
|
private static readonly float PAUSE_CD = 5f;
|
|
|
|
|
private static readonly float UNPAUSE_CD = 0.5f;
|
|
|
|
|
private GameEngine _gameEngine;
|
|
|
|
|
private NotesManager ntMgr => _gameEngine?.notesManager;
|
|
|
|
|
private patch_GameBGM pgm => (patch_GameBGM)Singleton<GameSound>.instance.gameBGM;
|
|
|
|
|
public static bool Paused = false;
|
|
|
|
|
private float pauseTimer = 0f;
|
|
|
|
|
public extern bool orig_updateState(float deltaTime = -1f);
|
|
|
|
|
public extern void orig_destroy();
|
|
|
|
|
private extern void orig_Enter_SetupScene();
|
|
|
|
|
private void Enter_SetupScene() {
|
|
|
|
|
orig_Enter_SetupScene();
|
|
|
|
|
Paused = false;
|
|
|
|
|
}
|
|
|
|
|
public override bool updateState(float deltaTime = -1f) {
|
|
|
|
|
pauseTimer += deltaTime;
|
2024-07-22 16:45:36 +00:00
|
|
|
|
if(Singleton<UIInput>.instance.getTriggerOn(UIInput.Key.Service) && !Singleton<UIInput>.instance.getStateOn(UIInput.Key.Test)) {
|
2024-07-02 01:34:51 +00:00
|
|
|
|
if((!Paused && pauseTimer >= PAUSE_CD) || (Paused && pauseTimer >= UNPAUSE_CD)) {
|
|
|
|
|
Paused = !Paused;
|
|
|
|
|
pgm.pause(Paused);
|
|
|
|
|
ntMgr.setPause(Paused);
|
|
|
|
|
pauseTimer = 0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return orig_updateState(deltaTime);
|
|
|
|
|
}
|
|
|
|
|
}
|