From 80efe4d918dce3750094a931c8c8290fdb0d0bb6 Mon Sep 17 00:00:00 2001 From: Jujuforce Date: Fri, 23 Aug 2024 22:30:21 +0200 Subject: [PATCH 1/3] Initial commit InfiniteStory --- InfiniteStory/InfiniteStory.csproj | 7 + InfiniteStory/MU3.Sequence/patch_Play.cs | 13 ++ ...patch_Scene_32_PrePlayMusic_MusicSelect.cs | 215 ++++++++++++++++++ 3 files changed, 235 insertions(+) create mode 100644 InfiniteStory/InfiniteStory.csproj create mode 100644 InfiniteStory/MU3.Sequence/patch_Play.cs create mode 100644 InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs diff --git a/InfiniteStory/InfiniteStory.csproj b/InfiniteStory/InfiniteStory.csproj new file mode 100644 index 0000000..e29b96e --- /dev/null +++ b/InfiniteStory/InfiniteStory.csproj @@ -0,0 +1,7 @@ + + + Assembly-CSharp.InfiniteStory.mm + Allows to watch infinite story per session + + + \ No newline at end of file diff --git a/InfiniteStory/MU3.Sequence/patch_Play.cs b/InfiniteStory/MU3.Sequence/patch_Play.cs new file mode 100644 index 0000000..c70beea --- /dev/null +++ b/InfiniteStory/MU3.Sequence/patch_Play.cs @@ -0,0 +1,13 @@ +using MU3.User; +using MU3.Util; + +namespace MU3.Sequence; + +class patch_Play: Play { + private extern void orig_Enter_PlayScenario(); + private void Enter_PlayScenario() + { + orig_Enter_PlayScenario(); + Singleton.instance.userLocal.isStoryWatched = false; + } +} \ No newline at end of file diff --git a/InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs b/InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs new file mode 100644 index 0000000..e021dc6 --- /dev/null +++ b/InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs @@ -0,0 +1,215 @@ +using MU3.Data; +using MU3.DataStudio; +using MU3.DB; +using MU3.Game; +using MU3.Sequence; +using MU3.Util; +using MU3.ViewData; +using UnityEngine; + +namespace MU3; + +class patch_Scene_32_PrePlayMusic_MusicSelect: Scene_32_PrePlayMusic_MusicSelect { + private bool _playVoice; + private UIDialogBase _dialogBase; + private ChapterSelectionViewData _chapterSelectionViewData; + private Scene_32_PrePlayMusic _sceneCommonObject; + private bool _isCanceled; + private MusicSelectViewDataList _selectList; + private FumenDifficulty _selectorDifficulty; + private SystemUI.Request _deactivateTimer = SystemUI.Request.Default; + private float timeCountLogOutButtonPressed; + private float _timer; + + [SerializeField] + private UIMusicSelector _selector; + private extern void orig_executeDifficulty(); + private void executeDifficulty() + { + orig_executeDifficulty(); + } + private extern bool orig_updateMatchingTag(); + private bool updateMatchingTag() + { + return orig_updateMatchingTag(); + } + private extern void orig_updateSecretMusic(); + private void updateSecretMusic() + { + orig_updateSecretMusic(); + } + private extern void orig_disableInput(); + private void disableInput() + { + orig_disableInput(); + } + private extern void orig_onFinishPurchaseItem(ChapterItemViewData itemViewData, int status); + private void onFinishPurchaseItem(ChapterItemViewData itemViewData, int status) + { + orig_onFinishPurchaseItem(itemViewData, status); + } + private extern void orig_onFinishPlayScenario(int status, bool flag); + private void onFinishPlayScenario(int status, bool flag) + { + orig_onFinishPlayScenario(status, flag); + } + private extern void orig_onFinishUnlockMusic(MusicViewData musicViewData, int status); + private void onFinishUnlockMusic(MusicViewData musicViewData, int status) + { + orig_onFinishUnlockMusic(musicViewData, status); + } + private extern void orig_updateSystemUIPanel(); + private void updateSystemUIPanel() + { + orig_updateSystemUIPanel(); + } + + private void Execute_Select() { + + if (_dialogBase != null) + { + if (_selector.isTimeOut) + { + _dialogBase.forceCancel(); + } + return; + } + executeDifficulty(); + if (_chapterSelectionViewData.category != ChapterMajorCategoryID.MedalShop) + { + _sceneCommonObject.localMatchingCtrl.addNewRecruitNotice(); + } + updateMatchingTag(); + updateSecretMusic(); + memoryQRReader.update(); + UIInput.UILayeredInput input = _selector.getInput(); + bool flag = false; + if (_selector.isDecided) + { + flag = true; + _isCanceled = false; + } + else if (_selector.isCanceled) + { + flag = true; + _isCanceled = true; + } + else if (_selector.isPressed || _selector.isPressedDisabledElement) + { + MusicSelectViewData musicViewData = _selectList.getMusicViewData(_selector.selectIndex); + if (musicViewData != null) + { + if (musicViewData.kind == MusicSelectViewData.Kind.Music) + { + if (musicViewData.musicViewData.isForMatchingMusic) + { + if (_sceneCommonObject.localMatchingCtrl.startJoin(musicViewData.initOrder, _selectorDifficulty)) + { + if (SingletonMonoBehaviour.instance.systemTimer != null) + { + SingletonMonoBehaviour.instance.systemTimer.deactivate(ref _deactivateTimer); + } + setNextState(EState.MatchingEntryWait); + disableInput(); + } + } + else if (musicViewData.musicViewData.isSphereLock) + { + if (!musicViewData.musicViewData.isShortOfSphere) + { + Singleton.instance.avatarVoice.play(107); + _dialogBase = UIUnlockMusicDialog.create(musicViewData.musicViewData, _selectorDifficulty, _chapterSelectionViewData, onFinishUnlockMusic); + disableInput(); + } + else + { + Singleton.instance.avatarVoice.play(109); + } + } + } + else if (musicViewData.kind == MusicSelectViewData.Kind.Item) + { + ChapterItemViewData itemViewData = musicViewData.itemViewData; + switch (itemViewData.ngReason) + { + case ChapterItemViewData.PurchaseNgReason.ShortOfJewel: + if (itemViewData.jewelWallet != null && itemViewData.jewelWallet.CurrencyType == CurrencyType.Medal) + { + Singleton.instance.avatarVoice.play(1405); + } + else + { + Singleton.instance.avatarVoice.play(109); + } + break; + case ChapterItemViewData.PurchaseNgReason.None: + { + ItemType itemType = itemViewData.itemType; + if (itemType == ItemType.Card) + { + Singleton.instance.avatarVoice.play(108); + } + else + { + Singleton.instance.avatarVoice.play(965); + } + _dialogBase = UIPurchaseItemDialog.create(itemViewData, _chapterSelectionViewData, onFinishPurchaseItem); + disableInput(); + break; + } + } + } + else if (musicViewData.kind == MusicSelectViewData.Kind.Scenario) + { + ScenarioViewData scenarioViewData = musicViewData.scenarioViewData; + ScenarioViewData.PlayNGReason ngReason = scenarioViewData.ngReason; + if (ngReason == ScenarioViewData.PlayNGReason.None) + { + Singleton.instance.avatarVoice.play(1396); + onFinishPlayScenario(0, flag: false); + } + } + } + } + else if (input != null && _selector.isInputActive && !_selector.isDecidedOrWait && !_selector.isCanceledOrWait) + { + if (input.getStateOn(UIInput.Key.MenuLeft)) + { + timeCountLogOutButtonPressed += UnityEngine.Time.deltaTime; + if ((double)timeCountLogOutButtonPressed > 1.5) + { + timeCountLogOutButtonPressed = 0f; + disableInput(); + setNextState(EState.Logout); + } + } + else if (input.getTriggerOn(UIInput.Key.SkipRight, enableRepeat: true)) + { + _selector.moveGenre(1); + } + else if (input.getTriggerOn(UIInput.Key.SkipLeft, enableRepeat: true)) + { + _selector.moveGenre(-1); + } + else if (input.getTriggerOn(UIInput.Key.MenuRight)) + { + MusicSelectViewData selectedMusicSelectViewData = _selector.selectedMusicSelectViewData; + if (selectedMusicSelectViewData != null && selectedMusicSelectViewData.majorCategory == MusicMajorCategoryID.MyList && !selectedMusicSelectViewData.isRandom) + { + disableInput(); + setNextState(EState.Sort); + } + } + if (!input.getStateOn(UIInput.Key.MenuLeft) && timeCountLogOutButtonPressed != 0f) + { + timeCountLogOutButtonPressed = 0f; + } + } + if (flag) + { + _timer = 0f; + setNextState(EState.WaitFinish); + } + updateSystemUIPanel(); + } +} \ No newline at end of file -- 2.39.2 From 50e4b53ed99e50d2158c393acf5d106f27b2037b Mon Sep 17 00:00:00 2001 From: akanyan Date: Sat, 24 Aug 2024 11:41:13 +0000 Subject: [PATCH 2/3] refactor: clean up Execute_Select --- InfiniteStory/InfiniteStory.csproj | 2 +- InfiniteStory/MU3.Sequence/patch_Play.cs | 3 +- ...patch_Scene_32_PrePlayMusic_MusicSelect.cs | 218 ++---------------- Mu3Mods.sln | 11 +- 4 files changed, 28 insertions(+), 206 deletions(-) diff --git a/InfiniteStory/InfiniteStory.csproj b/InfiniteStory/InfiniteStory.csproj index e29b96e..f5bb953 100644 --- a/InfiniteStory/InfiniteStory.csproj +++ b/InfiniteStory/InfiniteStory.csproj @@ -1,7 +1,7 @@  Assembly-CSharp.InfiniteStory.mm - Allows to watch infinite story per session + Allows watching the story endlessly \ No newline at end of file diff --git a/InfiniteStory/MU3.Sequence/patch_Play.cs b/InfiniteStory/MU3.Sequence/patch_Play.cs index c70beea..6d7798a 100644 --- a/InfiniteStory/MU3.Sequence/patch_Play.cs +++ b/InfiniteStory/MU3.Sequence/patch_Play.cs @@ -5,8 +5,7 @@ namespace MU3.Sequence; class patch_Play: Play { private extern void orig_Enter_PlayScenario(); - private void Enter_PlayScenario() - { + private void Enter_PlayScenario() { orig_Enter_PlayScenario(); Singleton.instance.userLocal.isStoryWatched = false; } diff --git a/InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs b/InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs index e021dc6..cd627b7 100644 --- a/InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs +++ b/InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs @@ -1,215 +1,33 @@ -using MU3.Data; -using MU3.DataStudio; -using MU3.DB; -using MU3.Game; -using MU3.Sequence; -using MU3.Util; +using MonoMod; using MU3.ViewData; -using UnityEngine; namespace MU3; class patch_Scene_32_PrePlayMusic_MusicSelect: Scene_32_PrePlayMusic_MusicSelect { - private bool _playVoice; - private UIDialogBase _dialogBase; - private ChapterSelectionViewData _chapterSelectionViewData; - private Scene_32_PrePlayMusic _sceneCommonObject; - private bool _isCanceled; private MusicSelectViewDataList _selectList; - private FumenDifficulty _selectorDifficulty; - private SystemUI.Request _deactivateTimer = SystemUI.Request.Default; - private float timeCountLogOutButtonPressed; - private float _timer; - - [SerializeField] private UIMusicSelector _selector; - private extern void orig_executeDifficulty(); - private void executeDifficulty() - { - orig_executeDifficulty(); - } - private extern bool orig_updateMatchingTag(); - private bool updateMatchingTag() - { - return orig_updateMatchingTag(); - } - private extern void orig_updateSecretMusic(); - private void updateSecretMusic() - { - orig_updateSecretMusic(); - } - private extern void orig_disableInput(); - private void disableInput() - { - orig_disableInput(); - } - private extern void orig_onFinishPurchaseItem(ChapterItemViewData itemViewData, int status); - private void onFinishPurchaseItem(ChapterItemViewData itemViewData, int status) - { - orig_onFinishPurchaseItem(itemViewData, status); - } - private extern void orig_onFinishPlayScenario(int status, bool flag); - private void onFinishPlayScenario(int status, bool flag) - { - orig_onFinishPlayScenario(status, flag); - } - private extern void orig_onFinishUnlockMusic(MusicViewData musicViewData, int status); - private void onFinishUnlockMusic(MusicViewData musicViewData, int status) - { - orig_onFinishUnlockMusic(musicViewData, status); - } - private extern void orig_updateSystemUIPanel(); - private void updateSystemUIPanel() - { - orig_updateSystemUIPanel(); - } + private UIDialogBase _dialogBase; + [MonoModIgnore] + private extern void enableInput(); + [MonoModIgnore] + private extern void onFinishPlayScenario(int status, bool flag); + [MonoModIgnore] + private extern void updateSystemUIPanel(); + + private extern void orig_Execute_Select(); private void Execute_Select() { - - if (_dialogBase != null) - { - if (_selector.isTimeOut) - { - _dialogBase.forceCancel(); - } - return; - } - executeDifficulty(); - if (_chapterSelectionViewData.category != ChapterMajorCategoryID.MedalShop) - { - _sceneCommonObject.localMatchingCtrl.addNewRecruitNotice(); - } - updateMatchingTag(); - updateSecretMusic(); - memoryQRReader.update(); - UIInput.UILayeredInput input = _selector.getInput(); - bool flag = false; - if (_selector.isDecided) - { - flag = true; - _isCanceled = false; - } - else if (_selector.isCanceled) - { - flag = true; - _isCanceled = true; - } - else if (_selector.isPressed || _selector.isPressedDisabledElement) - { + // Walk around the warning dialog + if(_dialogBase == null && !_selector.isDecided && !_selector.isCanceled && (_selector.isPressed || _selector.isPressedDisabledElement)) { MusicSelectViewData musicViewData = _selectList.getMusicViewData(_selector.selectIndex); - if (musicViewData != null) - { - if (musicViewData.kind == MusicSelectViewData.Kind.Music) - { - if (musicViewData.musicViewData.isForMatchingMusic) - { - if (_sceneCommonObject.localMatchingCtrl.startJoin(musicViewData.initOrder, _selectorDifficulty)) - { - if (SingletonMonoBehaviour.instance.systemTimer != null) - { - SingletonMonoBehaviour.instance.systemTimer.deactivate(ref _deactivateTimer); - } - setNextState(EState.MatchingEntryWait); - disableInput(); - } - } - else if (musicViewData.musicViewData.isSphereLock) - { - if (!musicViewData.musicViewData.isShortOfSphere) - { - Singleton.instance.avatarVoice.play(107); - _dialogBase = UIUnlockMusicDialog.create(musicViewData.musicViewData, _selectorDifficulty, _chapterSelectionViewData, onFinishUnlockMusic); - disableInput(); - } - else - { - Singleton.instance.avatarVoice.play(109); - } - } - } - else if (musicViewData.kind == MusicSelectViewData.Kind.Item) - { - ChapterItemViewData itemViewData = musicViewData.itemViewData; - switch (itemViewData.ngReason) - { - case ChapterItemViewData.PurchaseNgReason.ShortOfJewel: - if (itemViewData.jewelWallet != null && itemViewData.jewelWallet.CurrencyType == CurrencyType.Medal) - { - Singleton.instance.avatarVoice.play(1405); - } - else - { - Singleton.instance.avatarVoice.play(109); - } - break; - case ChapterItemViewData.PurchaseNgReason.None: - { - ItemType itemType = itemViewData.itemType; - if (itemType == ItemType.Card) - { - Singleton.instance.avatarVoice.play(108); - } - else - { - Singleton.instance.avatarVoice.play(965); - } - _dialogBase = UIPurchaseItemDialog.create(itemViewData, _chapterSelectionViewData, onFinishPurchaseItem); - disableInput(); - break; - } - } - } - else if (musicViewData.kind == MusicSelectViewData.Kind.Scenario) - { - ScenarioViewData scenarioViewData = musicViewData.scenarioViewData; - ScenarioViewData.PlayNGReason ngReason = scenarioViewData.ngReason; - if (ngReason == ScenarioViewData.PlayNGReason.None) - { - Singleton.instance.avatarVoice.play(1396); - onFinishPlayScenario(0, flag: false); - } + if(musicViewData != null && musicViewData.kind == MusicSelectViewData.Kind.Scenario) { + if(musicViewData.scenarioViewData.ngReason == ScenarioViewData.PlayNGReason.None) { + onFinishPlayScenario(0, false); } } + updateSystemUIPanel(); + } else { + orig_Execute_Select(); } - else if (input != null && _selector.isInputActive && !_selector.isDecidedOrWait && !_selector.isCanceledOrWait) - { - if (input.getStateOn(UIInput.Key.MenuLeft)) - { - timeCountLogOutButtonPressed += UnityEngine.Time.deltaTime; - if ((double)timeCountLogOutButtonPressed > 1.5) - { - timeCountLogOutButtonPressed = 0f; - disableInput(); - setNextState(EState.Logout); - } - } - else if (input.getTriggerOn(UIInput.Key.SkipRight, enableRepeat: true)) - { - _selector.moveGenre(1); - } - else if (input.getTriggerOn(UIInput.Key.SkipLeft, enableRepeat: true)) - { - _selector.moveGenre(-1); - } - else if (input.getTriggerOn(UIInput.Key.MenuRight)) - { - MusicSelectViewData selectedMusicSelectViewData = _selector.selectedMusicSelectViewData; - if (selectedMusicSelectViewData != null && selectedMusicSelectViewData.majorCategory == MusicMajorCategoryID.MyList && !selectedMusicSelectViewData.isRandom) - { - disableInput(); - setNextState(EState.Sort); - } - } - if (!input.getStateOn(UIInput.Key.MenuLeft) && timeCountLogOutButtonPressed != 0f) - { - timeCountLogOutButtonPressed = 0f; - } - } - if (flag) - { - _timer = 0f; - setNextState(EState.WaitFinish); - } - updateSystemUIPanel(); } } \ No newline at end of file diff --git a/Mu3Mods.sln b/Mu3Mods.sln index 7b7b8e2..b58cd1f 100644 --- a/Mu3Mods.sln +++ b/Mu3Mods.sln @@ -1,5 +1,4 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.9.34728.123 MinimumVisualStudioVersion = 10.0.40219.1 @@ -43,6 +42,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AttractVideoPlayer", "Attra EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SelectBGM", "SelectBGM\SelectBGM.csproj", "{07C01DA1-7ABF-4759-A1C2-9DCD04298E85}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfiniteStory", "InfiniteStory\InfiniteStory.csproj", "{939914E5-8D9A-4696-9957-AA6C6480FE94}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -129,6 +130,10 @@ Global {07C01DA1-7ABF-4759-A1C2-9DCD04298E85}.Debug|x64.Build.0 = Debug|x64 {07C01DA1-7ABF-4759-A1C2-9DCD04298E85}.Release|x64.ActiveCfg = Release|x64 {07C01DA1-7ABF-4759-A1C2-9DCD04298E85}.Release|x64.Build.0 = Release|x64 + {939914E5-8D9A-4696-9957-AA6C6480FE94}.Debug|x64.ActiveCfg = Debug|x64 + {939914E5-8D9A-4696-9957-AA6C6480FE94}.Debug|x64.Build.0 = Debug|x64 + {939914E5-8D9A-4696-9957-AA6C6480FE94}.Release|x64.ActiveCfg = Release|x64 + {939914E5-8D9A-4696-9957-AA6C6480FE94}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -136,4 +141,4 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {D9317002-F66D-4CDE-8FF5-FF2A0D8DC021} EndGlobalSection -EndGlobal +EndGlobal \ No newline at end of file -- 2.39.2 From d577e8df3af4e6f8ff394847ffdbfa1e6bd73488 Mon Sep 17 00:00:00 2001 From: akanyan Date: Sat, 24 Aug 2024 16:26:31 +0000 Subject: [PATCH 3/3] fix: unused ref, version bump --- InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs | 2 -- Mu3Mods.csproj | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs b/InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs index cd627b7..17fef40 100644 --- a/InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs +++ b/InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs @@ -8,8 +8,6 @@ class patch_Scene_32_PrePlayMusic_MusicSelect: Scene_32_PrePlayMusic_MusicSelect private UIMusicSelector _selector; private UIDialogBase _dialogBase; - [MonoModIgnore] - private extern void enableInput(); [MonoModIgnore] private extern void onFinishPlayScenario(int status, bool flag); [MonoModIgnore] diff --git a/Mu3Mods.csproj b/Mu3Mods.csproj index 5123fa0..0e6bb87 100644 --- a/Mu3Mods.csproj +++ b/Mu3Mods.csproj @@ -2,7 +2,7 @@ net35 7EVENDAYS⇔HOLIDAYS - 2.2.0 + 2.3.0 true latest x64 -- 2.39.2