From 66fdc27787fe492cca9cfb14c259581ebc9d4f1a Mon Sep 17 00:00:00 2001 From: jujuforce Date: Sat, 24 Aug 2024 16:29:07 +0000 Subject: [PATCH] feat: implement InfiniteStory (#6) Infinite Story mod - Allows watching an infinite number of stories per session - Skips the dialog about it when selecting a story Co-authored-by: Jujuforce Co-authored-by: akanyan Reviewed-on: https://gitea.tendokyu.moe/akanyan/mu3-mods/pulls/6 Co-authored-by: jujuforce Co-committed-by: jujuforce --- InfiniteStory/InfiniteStory.csproj | 7 +++++ InfiniteStory/MU3.Sequence/patch_Play.cs | 12 +++++++ ...patch_Scene_32_PrePlayMusic_MusicSelect.cs | 31 +++++++++++++++++++ Mu3Mods.csproj | 2 +- Mu3Mods.sln | 11 +++++-- 5 files changed, 59 insertions(+), 4 deletions(-) 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..f5bb953 --- /dev/null +++ b/InfiniteStory/InfiniteStory.csproj @@ -0,0 +1,7 @@ + + + Assembly-CSharp.InfiniteStory.mm + 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 new file mode 100644 index 0000000..6d7798a --- /dev/null +++ b/InfiniteStory/MU3.Sequence/patch_Play.cs @@ -0,0 +1,12 @@ +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..17fef40 --- /dev/null +++ b/InfiniteStory/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs @@ -0,0 +1,31 @@ +using MonoMod; +using MU3.ViewData; + +namespace MU3; + +class patch_Scene_32_PrePlayMusic_MusicSelect: Scene_32_PrePlayMusic_MusicSelect { + private MusicSelectViewDataList _selectList; + private UIMusicSelector _selector; + private UIDialogBase _dialogBase; + + [MonoModIgnore] + private extern void onFinishPlayScenario(int status, bool flag); + [MonoModIgnore] + private extern void updateSystemUIPanel(); + + private extern void orig_Execute_Select(); + private void Execute_Select() { + // 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 && musicViewData.kind == MusicSelectViewData.Kind.Scenario) { + if(musicViewData.scenarioViewData.ngReason == ScenarioViewData.PlayNGReason.None) { + onFinishPlayScenario(0, false); + } + } + updateSystemUIPanel(); + } else { + orig_Execute_Select(); + } + } +} \ No newline at end of file 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 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