forked from akanyan/mu3-mods
jujuforce
8cbc7e8b86
Service Button : Pause the attract video L2/L3 Buttons : Previous/next to cycle through all the attract videos Saving the selected video for future game launches Co-authored-by: akanyan <alicechecker01@proton.me> Reviewed-on: akanyan/mu3-mods#2 Co-authored-by: jujuforce <jujuforce@noreply.gitea.tendokyu.moe> Co-committed-by: jujuforce <jujuforce@noreply.gitea.tendokyu.moe>
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.ObjectModel;
|
|
using System.IO;
|
|
|
|
namespace MU3.Operation;
|
|
|
|
class patch_OperationManager: OperationManager {
|
|
private static readonly string _fname = "data_advert_cache.txt";
|
|
private ReadOnlyCollection<MovieData> _movieDataList;
|
|
private int _movieIndex;
|
|
|
|
~patch_OperationManager() {
|
|
try {
|
|
File.WriteAllText(_fname, _movieIndex.ToString());
|
|
} catch(Exception) {}
|
|
}
|
|
public int MovieIndex {
|
|
set {
|
|
_movieIndex = (value + _movieDataList.Count) % _movieDataList.Count;
|
|
}
|
|
get {
|
|
return _movieIndex;
|
|
}
|
|
}
|
|
public new MovieData movieData {
|
|
get {
|
|
if(_movieDataList.Count > 0) {
|
|
return _movieDataList[_movieIndex];
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public extern void orig_initialize();
|
|
|
|
public new void initialize() {
|
|
orig_initialize();
|
|
try {
|
|
_movieIndex = Math.Max(0, int.Parse(File.ReadAllText(_fname)));
|
|
} catch(Exception) {
|
|
_movieIndex = 0;
|
|
}
|
|
|
|
}
|
|
} |