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