-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMod.cs
More file actions
49 lines (41 loc) · 1.43 KB
/
Mod.cs
File metadata and controls
49 lines (41 loc) · 1.43 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
using Colossal.IO.AssetDatabase;
using Colossal.Logging;
using Game;
using Game.Modding;
using Game.SceneFlow;
using Game.SceneFlow;
using System;
using Unity.Entities;
using WG_CS2_RealisticPopulation;
namespace RealisticPopulation
{
public class Mod : IMod
{
public static ILog log = LogManager.GetLogger($"{nameof(RealisticPopulation)}.{nameof(Mod)}").SetShowsErrorsInUI(false);
private Setting m_Setting;
public void OnLoad(UpdateSystem updateSystem)
{
if (GameManager.instance.modManager.TryGetExecutableAsset(this, out var asset))
log.Info($"Current mod asset at {asset.path}");
m_Setting = new Setting(this);
m_Setting.RegisterInOptionsUI();
GameManager.instance.localizationManager.AddSource("en-US", new LocaleEN(m_Setting));
foreach (var item in DataStore.defaultHousehold)
{
DataStore.householdCache.Add(item.Key, item.Value);
}
//Game.Prefabs.ZoneProperties.
AssetDatabase.global.LoadSettings(nameof(RealisticPopulation), m_Setting, new Setting(this));
log.Info(nameof(OnLoad) + " loaded.");
}
public void OnDispose()
{
log.Info(nameof(OnDispose));
if (m_Setting != null)
{
m_Setting.UnregisterInOptionsUI();
m_Setting = null;
}
}
}
}