Repository navigation
Expand file tree
/
Copy pathMod.cs
More file actions
55 lines (44 loc) · 1.48 KB
/
Copy pathMod.cs
File metadata and controls
55 lines (44 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using Colossal.IO.AssetDatabase;
using Colossal.Logging;
using DisableMouseHint.ModSettings;
using Game;
using Game.Modding;
using Game.SceneFlow;
using HarmonyLib;
namespace DisableMouseHint
{
public class Mod : IMod
{
public static ILog log = LogManager.GetLogger($"{nameof(DisableMouseHint)}").SetShowsErrorsInUI(false);
public const string kHarmonyId = "Azsaidi." + nameof(DisableMouseHint);
internal static Setting m_Setting;
public static bool PatchEnabled => Setting.Instance?.ModEnabled ?? true;
private Harmony _harmony;
public void OnLoad(UpdateSystem updateSystem)
{
log.Info(nameof(OnLoad));
m_Setting = new Setting(this);
m_Setting.RegisterInOptionsUI();
GameManager.instance.localizationManager.AddSource("en-US", new LocaleEN(m_Setting));
AssetDatabase.global.LoadSettings(nameof(DisableMouseHint), m_Setting);
m_Setting.Apply();
_harmony = new Harmony(kHarmonyId);
_harmony.PatchAll();
}
public void OnDispose()
{
log.Info(nameof(OnDispose));
if (_harmony != null)
{
_harmony.UnpatchAll(kHarmonyId);
_harmony = null;
}
if (m_Setting != null)
{
m_Setting.UnregisterInOptionsUI();
m_Setting = null;
Setting.Instance = null;
}
}
}
}