mu3-mods/AttractVideoPlayer/MU3/patch_AdvManager.cs
akanyan 4ad595f6c3 feat: various enhancements
* AttractVideoPlayer,LoadBoost: allow setting a cache directory
* AttractVideoPlayer: color leds
* BetterGiveUp: prevent multiple restarts in a row
* use GetTriggerOn in general where applicable
2024-07-23 01:45:36 +09:00

53 lines
1.7 KiB
C#

using MU3.Operation;
using MU3.Util;
using UnityEngine;
namespace MU3;
class patch_AdvManager: AdvManager {
private GameObject objMovie;
private CriManaMovieMaterial movieController;
private extern bool orig_exec();
public new bool exec() {
if(movieController?.player?.status == CriMana.Player.Status.Playing) {
if(Singleton<UIInput>.instance.getTriggerOn(UIInput.Key.Service)) {
movieController.player.Pause(!movieController.player.IsPaused());
} else if(Singleton<UIInput>.instance.getTriggerOn(UIInput.Key.L2)) {
addMovieOffset(-1);
} else if(Singleton<UIInput>.instance.getTriggerOn(UIInput.Key.L3)) {
addMovieOffset(1);
}
}
return orig_exec();
}
public void addMovieOffset(int offset) {
var om = (patch_OperationManager)Singleton<OperationManager>.instance;
om.MovieIndex += offset;
movieController.Stop();
Utility.destroyGameObject(ref movieController);
Utility.destroyGameObject(ref objMovie);
initMovie();
}
public extern bool orig_initMovie();
public new bool initMovie() {
UIInput instance = Singleton<UIInput>.instance;
instance.setLedColor(UIInput.Key.L2, new Color(0f, 0.7f, 0f));
instance.setLedColor(UIInput.Key.L3, new Color(0f, 0.7f, 0f));
return orig_initMovie();
}
public extern void orig_exitMovie();
public new void exitMovie() {
orig_exitMovie();
UIInput instance = Singleton<UIInput>.instance;
instance.setLedColor(UIInput.Key.L2, Color.black);
instance.setLedColor(UIInput.Key.L3, Color.black);
}
}