Repository navigation
Expand file tree
/
Copy pathMod.cs
More file actions
48 lines (39 loc) · 1.65 KB
/
Copy pathMod.cs
File metadata and controls
48 lines (39 loc) · 1.65 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
using Colossal.IO.AssetDatabase;
using Colossal.Logging;
using CustomizeIt.Systems;
using Game;
using Game.Modding;
using Game.SceneFlow;
namespace CustomizeIt
{
public class Mod : IMod
{
public const string ModId = nameof(CustomizeIt);
public static ILog log = LogManager.GetLogger($"{nameof(CustomizeIt)}.{nameof(Mod)}").SetShowsErrorsInUI(false);
public static Setting Setting { get; private set; }
public void OnLoad(UpdateSystem updateSystem)
{
log.Info(nameof(OnLoad));
if (GameManager.instance.modManager.TryGetExecutableAsset(this, out var asset))
log.Info($"Current mod asset at {asset.path}");
Setting = new Setting(this);
Setting.RegisterInOptionsUI();
GameManager.instance.localizationManager.AddSource("en-US", new LocaleEN(Setting));
GameManager.instance.localizationManager.AddSource("fr-FR", new LocaleFR(Setting));
AssetDatabase.global.LoadSettings(ModId, Setting, new Setting(this));
updateSystem.UpdateAt<BuildingAttractivenessUISystem>(SystemUpdatePhase.UIUpdate);
updateSystem.UpdateAfter<AttractivenessOverrideSystem>(SystemUpdatePhase.PrefabUpdate);
updateSystem.UpdateAt<TouristBoostSystem>(SystemUpdatePhase.GameSimulation);
updateSystem.UpdateAt<TouristTransitArrivalSystem>(SystemUpdatePhase.GameSimulation);
}
public void OnDispose()
{
log.Info(nameof(OnDispose));
if (Setting != null)
{
Setting.UnregisterInOptionsUI();
Setting = null;
}
}
}
}