Files
probably-decentralized/src/Decentralized/ModEntry.cs
T

36 lines
1.2 KiB
C#
Raw Normal View History

namespace Decentralized
{
/// <summary>
/// mod 入口(游戏自带 mod 系统)。Init / OnEnable 在主菜单阶段调用:这里只订阅钩子、登记物品和人脉升级,
/// 不碰存档和店里的东西(那些在读档 / 新游戏的钩子里做)。
/// </summary>
public class ModEntry : IMod
{
public void Init(ModManifest manifest) { }
public void OnEnable()
{
Items.Subscribe();
Items.OpenTerminal = TerminalWindow.Open;
Unlock.Register();
Night.Subscribe();
2026-11-03 09:27:28 +08:00
DealerStock.Subscribe();
UsedDealerClient.Subscribe();
ModHook.OnGameLoadedLate += Session.Load;
ModHook.OnNewGameStarted += OnNewGame;
Log.Info($"{ModInfo.Name} {ModInfo.Version} 已启用");
}
public void OnDisable()
{
Items.Unsubscribe();
Night.Unsubscribe();
2026-11-03 09:27:28 +08:00
DealerStock.Unsubscribe();
UsedDealerClient.Unsubscribe();
ModHook.OnGameLoadedLate -= Session.Load;
ModHook.OnNewGameStarted -= OnNewGame;
}
private static void OnNewGame(string scenarioId) => Session.Load();
}
}