forked from akanyan/mu3-mods
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using MU3.Data;
|
|
using MU3.Game;
|
|
using MU3.Util;
|
|
using System;
|
|
|
|
namespace MU3.Sequence;
|
|
|
|
class patch_Play: Play {
|
|
private LocalSessionInfo _localSessionInfo;
|
|
private extern void orig_Enter_Login();
|
|
private void Enter_Login() {
|
|
orig_Enter_Login();
|
|
using IniFile iniFile = new("mu3.ini");
|
|
var index = iniFile.getIntValue("Extra", "BGM", 6);
|
|
if(index == 0) {
|
|
var rnd = new Random();
|
|
index = rnd.Next(1, 7);
|
|
}
|
|
if(index < 0 || index > 6) {
|
|
index = 6;
|
|
}
|
|
Singleton<Mod.State>.instance.RecentBGM = index;
|
|
Singleton<GameSound>.instance.gameBGM.playBGM(233, index);
|
|
}
|
|
|
|
private extern void orig_Enter_ChapterSelect();
|
|
private void Enter_ChapterSelect() {
|
|
var state = Singleton<Mod.State>.instance;
|
|
state.WithholdPlay = true;
|
|
orig_Enter_ChapterSelect();
|
|
state.WithholdPlay = false;
|
|
|
|
int selectorID = SingletonStateMachine<DataManager, DataManager.EState>.instance.getMemoryChapterData(
|
|
_localSessionInfo.chapterSelection.memoryChapterId
|
|
)?.getMemoryChapterSelectorID() ?? state.RecentBGM;
|
|
Singleton<GameSound>.instance.gameBGM.playBGM(233, selectorID);
|
|
}
|
|
}
|