generated from Captain-Of-Coit/cities-skylines-2-mod-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WG_CS2_RealisticPopulation.cs
189 lines (160 loc) · 5.23 KB
/
WG_CS2_RealisticPopulation.cs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
using Colossal.IO.AssetDatabase;
using Game;
using Game.Audio;
using Game.Modding;
using Game.Prefabs;
using Game.Settings;
using Game.Simulation;
using System.Collections.Generic;
using System.Xml.Serialization;
using Unity.Entities;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Scripting;
namespace WG_CS2_RealisticPopulation
{
public class WG_CS2_RealisticPopulation : IMod
{
//internal ModSettings currentSettings { get; private set; }
public void OnCreateWorld(UpdateSystem updateSystem)
{
// Register mod settings to game options UI.
//currentSettings = new(this);
//currentSettings.RegisterInOptionsUI();
// Load saved settings.
//AssetDatabase.global.LoadSettings("WorkerCapacityBooster", currentSettings, new ModSettings(this));
}
public void OnDispose()
{
}
public void OnLoad()
{
throw new System.NotImplementedException();
}
}
/*
[FileLocation(Mod.ModName)]
public class WorkerModSettings : ModSetting
{
private bool _unlockAll = true;
private bool _extraAtStart = false;
private bool _milestones = false;
public ModSettings(IMod mod)
: base(mod)
{
}
[SettingsUISection("UnlockMode")]
public bool UnlockAll
{
get => _unlockAll;
set
{
_unlockAll = value;
// Assign contra value to ensure that JSON contains at least one non-default value.
Contra = value;
// Clear conflicting settings.
if (value)
{
_extraAtStart = false;
_milestones = false;
}
// Ensure state.
EnsureState();
}
}
[SettingsUISection("UnlockMode")]
public bool ExtraTilesAtStart
{
get => _extraAtStart;
set
{
_extraAtStart = value;
// Clear conflicting settings.
if (value)
{
_unlockAll = false;
_milestones = false;
}
// Ensure state.
EnsureState();
}
}
/// <summary>
/// Gets or sets a value indicating whether the entire map should be unlocked on load.
/// </summary>
[SettingsUISection("UnlockMode")]
public bool AssignToMilestones
{
get => _milestones;
set
{
_milestones = value;
// Clear conflicting settings.
if (value)
{
_unlockAll = false;
_extraAtStart = false;
}
// Ensure state.
EnsureState();
}
}
/// <summary>
/// Gets or sets a value indicating whether there should be no unlocked starting tiles when starting a new map.
/// </summary>
[SettingsUIHideByCondition(typeof(ModSettings), nameof(StartingTilesHidden))]
[SettingsUISection("StartingOptions")]
public bool NoStartingTiles { get; set; } = false;
/// <summary>
/// Gets or sets a value indicating whether, well, nothing really.
/// This is just the inverse of <see cref="UnlockAll"/>, to ensure the the JSON contains at least one non-default value.
/// This is to workaround a bug where the settings file isn't overwritten when there are no non-default settings.
/// </summary>
[SettingsUIHidden]
public bool Contra { get; set; } = false;
/// <summary>
/// Sets a value indicating whether the mod's settings should be reset.
/// </summary>
[XmlIgnore]
[SettingsUIButton]
[SettingsUISection("ResetModSettings")]
[SettingsUIConfirmation]
public bool ResetModSettings
{
set
{
// Apply defaults.
SetDefaults();
// Ensure contra is set correctly.
Contra = UnlockAll;
// Save.
ApplyAndSave();
}
}
/// <summary>
/// Restores mod settings to default.
/// </summary>
public override void SetDefaults()
{
_unlockAll = true;
_extraAtStart = false;
_milestones = false;
NoStartingTiles = false;
}
/// <summary>
/// Returns a value indicating whether the no starting tiles option should be hidden.
/// </summary>
/// <returns><c>true</c> (hide starting tiles option) if 'Unlock all tiles' is selected, <c>false</c> (don't hide) otherwise.</returns>
public bool StartingTilesHidden() => UnlockAll;
/// <summary>
/// Enables Unlock All as the default option and that no options are duplicated.
/// </summary>
private void EnsureState()
{
if (!_unlockAll && !_extraAtStart && !_milestones)
{
UnlockAll = true;
}
}
}*/
}