diff --git a/BetterGiveUp/MU3.Sequence/patch_PlayMusic.cs b/BetterGiveUp/MU3.Sequence/patch_PlayMusic.cs index 0aabf03..f42fd7c 100644 --- a/BetterGiveUp/MU3.Sequence/patch_PlayMusic.cs +++ b/BetterGiveUp/MU3.Sequence/patch_PlayMusic.cs @@ -51,6 +51,7 @@ public class patch_PlayMusic: PlayMusic { private void EndRolling() { _isRolling = false; ntMgr.stopPlay(); + ntMgr.setPause(false); ntMgr.reset(); ntMgr.reloadScore(_gameEngine.IsStageDazzling); _gameEngine.counters.reset(); diff --git a/BetterGiveUp/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs b/BetterGiveUp/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs index 0d1ba1b..79d7e13 100644 --- a/BetterGiveUp/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs +++ b/BetterGiveUp/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs @@ -2,7 +2,6 @@ #pragma warning disable CS0649 #pragma warning disable IDE0051 #pragma warning disable IDE1006 -#pragma warning disable CS0108 #pragma warning disable CS0414 using MU3.Sequence; diff --git a/InfiniteGP/MU3.User/patch_Scene_25_Login.cs b/InfiniteGP/MU3.User/patch_Scene_25_Login.cs index 9b66b8e..43b4ec0 100644 --- a/InfiniteGP/MU3.User/patch_Scene_25_Login.cs +++ b/InfiniteGP/MU3.User/patch_Scene_25_Login.cs @@ -1,16 +1,24 @@ #pragma warning disable CS0649 +#pragma warning disable CS0626 using MU3.Util; namespace MU3; -public class patch_Scene_25_Login : Scene_25_Login { +public class patch_Scene_25_Login: Scene_25_Login { private enum State { - Login = 2 - } + Login = 2 + } private Mode mode_; + private extern void orig_invokeOnFinish(int status); private void PurchaseGP_Init() { mode_.set(State.Login); - } + } + private void invokeOnFinish(int status) { + orig_invokeOnFinish(status); + } + private void ExchangeGP_Init() { + invokeOnFinish(1); + } } \ No newline at end of file diff --git a/InfiniteGP/MU3.User/patch_UIMoneyExchange.cs b/InfiniteGP/MU3.User/patch_UIMoneyExchange.cs new file mode 100644 index 0000000..43ec509 --- /dev/null +++ b/InfiniteGP/MU3.User/patch_UIMoneyExchange.cs @@ -0,0 +1,45 @@ +#pragma warning disable CS0626 +#pragma warning disable CS0649 + +using MU3.CustomUI; +using UnityEngine; + +namespace MU3; + +public class patch_UICredit: UICredit { + private Animator gpAnimator_; + private GameObject creditRoot_; + private MU3UICounter credit_; + private GameObject freePlayRoot_; + private GameObject gpRoot_; + private MU3UICounter gp_; + private MU3UICounter gpPlus_; + private MU3UICounter gpMinus_; + private MU3UIImageChanger netIcon_; + private void onUpdateGP(int value) { /* nop */ } + + public extern void orig_initialize(); + + public new void initialize() { + orig_initialize(); + + DestroyImmediate(gpAnimator_); + + creditRoot_.transform.localScale = new Vector3(0, 0, 0); + credit_.transform.localScale = new Vector3(0, 0, 0); + freePlayRoot_.transform.localScale = new Vector3(0, 0, 0); + gpRoot_.transform.localScale = new Vector3(0, 0, 0); + gp_.transform.localScale = new Vector3(0, 0, 0); + gpPlus_.transform.localScale = new Vector3(0, 0, 0); + gpMinus_.transform.localScale = new Vector3(0, 0, 0); + + var tf = (RectTransform)netIcon_.transform; + tf.localPosition = new Vector3(35, netIcon_.transform.localPosition.y, netIcon_.transform.localPosition.z); + for(int i = 0; i < 3; ++i) { + tf.anchorMin = new Vector2(0f, 0.5f); + tf.anchorMax = new Vector2(1f, 0.5f); + tf = (RectTransform)tf.parent; + } + netIcon_.image.rectTransform.pivot = new Vector2(0f, 0.5f); + } +} \ No newline at end of file diff --git a/InfiniteGP/MU3.User/patch_UserManager.cs b/InfiniteGP/MU3.User/patch_UserManager.cs index e0f42d9..7369b27 100644 --- a/InfiniteGP/MU3.User/patch_UserManager.cs +++ b/InfiniteGP/MU3.User/patch_UserManager.cs @@ -2,29 +2,28 @@ #pragma warning disable CS0649 #pragma warning disable IDE0051 #pragma warning disable IDE1006 -#pragma warning disable CS0108 namespace MU3.User; public class patch_UserManager: UserManager { - public const int DefaultGP = 666; + public new const int DefaultGP = 666; private int _gp; private OnUpdate _onUpdateGP; private OnReset _onResetGP; - public void resetGP() { - _gp = 666; + public new void resetGP() { + _gp = 999; if(_onResetGP != null) { _onResetGP(_gp); } } - public int GP { + public new int GP { get { return _gp; } private set { - _gp = 666; + _gp = 999; if(_onUpdateGP != null) { _onUpdateGP(_gp); } diff --git a/Pause/MU3.Battle/patch_GameEngine.cs b/Pause/MU3.Battle/patch_GameEngine.cs new file mode 100644 index 0000000..c2cf2fe --- /dev/null +++ b/Pause/MU3.Battle/patch_GameEngine.cs @@ -0,0 +1,13 @@ +#pragma warning disable CS0626 + +using MU3.Sequence; + +namespace MU3.Battle; + +public class patch_GameEngine: GameEngine { + public extern void orig_reset(); + public new void reset() { + orig_reset(); + patch_PlayMusic.Paused = false; + } +} \ No newline at end of file diff --git a/Pause/MU3.Game/patch_GameBGM.cs b/Pause/MU3.Game/patch_GameBGM.cs new file mode 100644 index 0000000..0c94ca9 --- /dev/null +++ b/Pause/MU3.Game/patch_GameBGM.cs @@ -0,0 +1,15 @@ +#pragma warning disable CS0649 + +using MU3.Sound; +using MU3.Util; + +namespace MU3.Game; + +public class patch_GameBGM: GameBGM { + private patch_SoundManager psm => ((patch_SoundManager)Singleton.instance); + private HandleInfo _handle; + public void pause(bool val) { + psm.pause(_handle, val); + } +} + diff --git a/Pause/MU3.Sequence/patch_PlayMusic.cs b/Pause/MU3.Sequence/patch_PlayMusic.cs new file mode 100644 index 0000000..ed648a7 --- /dev/null +++ b/Pause/MU3.Sequence/patch_PlayMusic.cs @@ -0,0 +1,40 @@ +#pragma warning disable CS0626 +#pragma warning disable CS0649 +#pragma warning disable IDE0051 +#pragma warning disable IDE1006 + +using MU3.Battle; +using MU3.Game; +using MU3.Notes; +using MU3.Util; + +namespace MU3.Sequence; + +public class patch_PlayMusic: PlayMusic { + 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.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; + if(Singleton.instance.getStateOn(UIInput.Key.Service)) { + if((!Paused && pauseTimer >= PAUSE_CD) || (Paused && pauseTimer >= UNPAUSE_CD)) { + Paused = !Paused; + pgm.pause(Paused); + ntMgr.setPause(Paused); + pauseTimer = 0f; + } + } + return orig_updateState(deltaTime); + } +} \ No newline at end of file diff --git a/Pause/MU3.Sound/patch_SoundManager.cs b/Pause/MU3.Sound/patch_SoundManager.cs new file mode 100644 index 0000000..01f28b9 --- /dev/null +++ b/Pause/MU3.Sound/patch_SoundManager.cs @@ -0,0 +1,13 @@ +#pragma warning disable CS0626 +#pragma warning disable CS0649 + +namespace MU3.Sound; + +public class patch_SoundManager: SoundManager { + private extern HandleInfo orig_getHandle(Priority priority); + private HandleInfo getHandle(Priority priority) => orig_getHandle(priority); + private patch_SoundPlayer[] _soundPlayers; + public void pause(HandleInfo handle, bool val) { + _soundPlayers[handle.Index].pause(val); + } +} \ No newline at end of file diff --git a/Pause/MU3.Sound/patch_SoundPlayer.cs b/Pause/MU3.Sound/patch_SoundPlayer.cs new file mode 100644 index 0000000..60d8569 --- /dev/null +++ b/Pause/MU3.Sound/patch_SoundPlayer.cs @@ -0,0 +1,18 @@ +#pragma warning disable CS0626 +#pragma warning disable CS0649 + +namespace MU3.Sound; + +class patch_SoundPlayer: SoundPlayer { + private CriAtomExPlayer _player; + public extern void orig_stop(); + + public void pause(bool val) { + _player.Pause(val); + } + + public new void stop() { + _player.Pause(false); + orig_stop(); + } +} \ No newline at end of file diff --git a/Pause/patch_GameDeviceManager.cs b/Pause/patch_GameDeviceManager.cs new file mode 100644 index 0000000..bcc9559 --- /dev/null +++ b/Pause/patch_GameDeviceManager.cs @@ -0,0 +1,12 @@ +#pragma warning disable CS0626 + +using MU3.Sequence; + +public class patch_GameDeviceManager: GameDeviceManager { + private extern void orig_update(); + private void update() { + if(!patch_PlayMusic.Paused) { + orig_update(); + } + } +} \ No newline at end of file diff --git a/README.md b/README.md index a339db8..09d6b68 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,14 @@ Miscellaneous mods for µ3/SDDT; mainly for my personal use, though suggestions/ ### BetterGiveUp -Enables these buttons in music play: +Enables the following buttons in music play: * Red menu: instant return to song select * Yellow menu: instant restart To avoid misclicks, you have to hold the button down for 1 second. -Based on GiveUp, but Better. +Based on GiveUp from the older modpack, but Better. ### ExportChartData @@ -19,7 +19,7 @@ Exports some useful chart data into a dollar-separated file (charts.csv) when th ### InfiniteGP -Self-explanatory. Saves you time. +Patches out GP and credits. ### LockSelectionTime @@ -29,6 +29,10 @@ Disables *all* timers. A replacement for LockSelectionTime from the older modpac Replaces the in-game rating algorithm (OldBest30+NewBest15+Recent10) with Best45. Client-side and purely cosmetic. +### Pause + +Enables pausing music play on FN2 (service button). Has an internal 5s cooldown. + ### SkipLoginReward ⚠️ Skips login bonuses and event rewards. If you care about those things, don't use this one.