forked from akanyan/mu3-mods
fix(SkipCutscenes): a better way
This commit is contained in:
@ -1,22 +1,18 @@
|
|||||||
using MonoMod;
|
using MonoMod;
|
||||||
using MU3.Battle;
|
using MU3.Battle;
|
||||||
using MU3.Game;
|
|
||||||
using MU3.Util;
|
using MU3.Util;
|
||||||
|
using System.Collections;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace MU3.Sequence;
|
namespace MU3.Sequence;
|
||||||
|
|
||||||
class patch_PlayMusic: PlayMusic {
|
class patch_PlayMusic: PlayMusic {
|
||||||
private GameEngine _gameEngine;
|
private GameEngine _gameEngine;
|
||||||
private SessionInfo _sessionInfo;
|
|
||||||
private bool _nuclearSkip = false;
|
|
||||||
private bool _quickStart = false;
|
private bool _quickStart = false;
|
||||||
|
|
||||||
[MonoModIgnore]
|
[MonoModIgnore]
|
||||||
private extern bool isPartyPlay();
|
private extern bool isPartyPlay();
|
||||||
|
|
||||||
[MonoModIgnore]
|
|
||||||
private extern void Enter_ShowBonusStart();
|
|
||||||
|
|
||||||
private void Leave_LoadScene() {
|
private void Leave_LoadScene() {
|
||||||
using IniFile iniFile = new("mu3.ini");
|
using IniFile iniFile = new("mu3.ini");
|
||||||
_quickStart = iniFile.getValue("Sequence", "QuickStart", false);
|
_quickStart = iniFile.getValue("Sequence", "QuickStart", false);
|
||||||
@ -25,6 +21,7 @@ class patch_PlayMusic: PlayMusic {
|
|||||||
private extern void orig_Execute_StartCutscene();
|
private extern void orig_Execute_StartCutscene();
|
||||||
private void Execute_StartCutscene() {
|
private void Execute_StartCutscene() {
|
||||||
orig_Execute_StartCutscene();
|
orig_Execute_StartCutscene();
|
||||||
|
|
||||||
Singleton<Mod.State>.instance.SkipEntry = false;
|
Singleton<Mod.State>.instance.SkipEntry = false;
|
||||||
if(_quickStart || Singleton<UIInput>.instance.getTriggerOn(UIInput.Key.MenuLeft)) {
|
if(_quickStart || Singleton<UIInput>.instance.getTriggerOn(UIInput.Key.MenuLeft)) {
|
||||||
Singleton<Mod.State>.instance.SkipEntry = true;
|
Singleton<Mod.State>.instance.SkipEntry = true;
|
||||||
@ -37,28 +34,33 @@ class patch_PlayMusic: PlayMusic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public extern bool orig_updateState(float deltaTime);
|
private void Leave_DispCombo() {
|
||||||
public override bool updateState(float deltaTime = -1f) {
|
if(!_gameEngine.sessionInfo.isTutorial) {
|
||||||
var state = getCurrentState();
|
_gameEngine.StartCoroutine(nuclearSkip());
|
||||||
if(state >= EState.PlayEnd && Singleton<UIInput>.instance.getTriggerOn(UIInput.Key.MenuLeft)) {
|
|
||||||
if(!isPartyPlay() || state > EState.CalcResult) {
|
|
||||||
_nuclearSkip = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(_nuclearSkip) {
|
}
|
||||||
bool isTutorial = SingletonMonoBehaviour<GameEngine>.instance.sessionInfo.isTutorial;
|
|
||||||
if(!isTutorial) {
|
private IEnumerator nuclearSkip() {
|
||||||
|
bool enabled = false;
|
||||||
|
EState state;
|
||||||
|
while((state = getCurrentState()) < EState.End) {
|
||||||
|
if(state >= EState.PlayEnd && Singleton<UIInput>.instance.getTriggerOn(UIInput.Key.MenuLeft)) {
|
||||||
|
if(!isPartyPlay() || state > EState.CalcResult) {
|
||||||
|
enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(enabled) {
|
||||||
Singleton<Mod.State>.instance.SkipItemFrame = true;
|
Singleton<Mod.State>.instance.SkipItemFrame = true;
|
||||||
if(state < EState.CalcResult) {
|
if(state < EState.CalcResult) {
|
||||||
setNextState(EState.CalcResult);
|
setNextState(EState.CalcResult);
|
||||||
}
|
}
|
||||||
if(state > EState.CalcResult) {
|
if(state > EState.ShowBonusStart) {
|
||||||
Enter_ShowBonusStart();
|
|
||||||
SingletonMonoBehaviour<SystemUI>.instance.destroySkipButton(true);
|
SingletonMonoBehaviour<SystemUI>.instance.destroySkipButton(true);
|
||||||
setNextState(EState.End);
|
setNextState(EState.End);
|
||||||
|
yield break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
yield return new WaitForEndOfFrame();
|
||||||
}
|
}
|
||||||
return orig_updateState(deltaTime);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user