forked from Cities2Modding/FirstPersonCamera
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSetting.cs
More file actions
259 lines (216 loc) · 9.19 KB
/
Copy pathSetting.cs
File metadata and controls
259 lines (216 loc) · 9.19 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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
using Colossal.IO.AssetDatabase;
using Game.Modding;
using Game.Settings;
using Game.UI;
using Game.Input;
using System.Reflection;
using FirstPersonCameraContinued.Systems;
using FirstPersonCameraContinued.Enums;
using Unity.Entities;
namespace FirstPersonCameraContinued
{
[FileLocation(nameof(FirstPersonCameraContinued))]
[SettingsUIShowGroupName(CameraSettingsGroup, KeybindingSettingsGroup, OtherSettingsGroup, UISettingsGroup, InfoBoxSettingsGroup, PIPGeneralSettingsGroup, PIPFeatureSettingsGroup, PIPKeybindingSettingsGroup, StopStripSettingsGroup)]
[SettingsUITabOrder(GeneralSettingsTab, UISettingsTab, PIPSettingsTab)]
public class Setting : ModSetting
{
public const string GeneralSettingsTab = "GeneralSettingsTab";
public const string CameraSettingsGroup = "CameraSettingsGroup";
public const string KeybindingSettingsGroup = "KeybindingSettingsGroup";
public const string OtherSettingsGroup = "OtherSettingsGroup";
public const string UISettingsTab = "UISettingsTab";
public const string UISettingsGroup = "UISettingsGroup";
public const string InfoBoxSettingsGroup = "InfoBoxSettingsGroup";
public const string PIPSettingsTab = "PIPSettingsTab";
public const string PIPGeneralSettingsGroup = "PIPGeneralSettingsGroup";
public const string PIPFeatureSettingsGroup = "PIPFeatureSettingsGroup";
public const string PIPKeybindingSettingsGroup = "PIPKeybindingSettingsGroup";
public const string StopStripSettingsGroup = "StopStripSettingsGroup";
private bool _showInfoBox;
private bool _showSpeed;
private bool _showVehicleType;
private bool _showExtraInfo;
private InfoBoxSize _infoBoxSize;
private ModUnits _setUnits;
private ShowStopStrip _showStopStrip;
private StopStripDisplayMode _stopStripDisplayMode;
public Setting(IMod mod) : base(mod)
{
SetDefaults();
}
[SettingsUISlider(min = 10, max = 180, step = 1, scalarMultiplier = 1, unit = Unit.kInteger)]
[SettingsUISection(GeneralSettingsTab, CameraSettingsGroup)]
public int FOV { get; set; }
[SettingsUISlider(min = .05f, max = 2f, step = .05f, scalarMultiplier = 1, unit = Unit.kFloatTwoFractions)]
[SettingsUISection(GeneralSettingsTab, CameraSettingsGroup)]
public float MovementSpeed { get; set; }
[SettingsUISlider(min = .05f, max = 2f, step = .05f, scalarMultiplier = 1, unit = Unit.kFloatTwoFractions)]
[SettingsUISection(GeneralSettingsTab, CameraSettingsGroup)]
public float RunSpeed { get; set; }
[SettingsUISlider(min = .05f, max = 5f, step = .05f, scalarMultiplier = 1, unit = Unit.kFloatSingleFraction)]
[SettingsUISection(GeneralSettingsTab, CameraSettingsGroup)]
public float CimHeight { get; set; }
[SettingsUISlider(min = 0.8f, max = 3f, step = .1f, scalarMultiplier = 1, unit = Unit.kFloatSingleFraction)]
[SettingsUISection(GeneralSettingsTab, CameraSettingsGroup)]
public float TransitionSpeedFactor { get; set; }
public const string FreeModeKeybindName = "FreeModeKeybind";
[SettingsUIKeyboardBinding(BindingKeyboard.F, Mod.kButtonActionName, alt: true)]
[SettingsUISection(GeneralSettingsTab, KeybindingSettingsGroup)]
public ProxyBinding FreeModeKeybind { get; set; }
[SettingsUIMultilineText]
[SettingsUISection(GeneralSettingsTab, KeybindingSettingsGroup)]
public string MultilineText => "List of Keyboard Shortcuts in First Person Mode\n" +
"To move around use WASD, use SHIFT to walk faster and R/F keys to increase/decrease the camera height";
[SettingsUISection(GeneralSettingsTab, OtherSettingsGroup)]
public string ModVersion => Assembly.GetExecutingAssembly().GetName().Version.ToString();
[SettingsUIButton]
[SettingsUIConfirmation]
[SettingsUISection(GeneralSettingsTab, OtherSettingsGroup)]
public bool ResetModSettings
{
set
{
SetDefaults();
ResetKeyBindings();
MakeSureSave = new System.Random().Next();
}
}
[SettingsUISection(UISettingsTab, UISettingsGroup)]
public bool ShowGameUI { get; set; }
[SettingsUISection(UISettingsTab, InfoBoxSettingsGroup)]
public bool ShowInfoBox {
get => _showInfoBox;
set
{
_showInfoBox = value;
SetUISettingsGroup();
}
}
[SettingsUISection(UISettingsTab, InfoBoxSettingsGroup)]
public Enums.InfoBoxSize InfoBoxSize
{
get => _infoBoxSize;
set
{
_infoBoxSize = value;
SetUISettingsGroup();
}
}
[SettingsUISection(PIPSettingsTab, PIPGeneralSettingsGroup)]
public FirstPersonCameraPIPSystem.PiPCorner PIPSnapToCorner { get; set; }
[SettingsUISlider(min = 0.7f, max = 2f, step = .1f, scalarMultiplier = 1, unit = Unit.kFloatSingleFraction)]
[SettingsUISection(PIPSettingsTab, PIPGeneralSettingsGroup)]
public float PIPAspectRatio { get; set; }
[SettingsUISlider(min = 0.1f, max = 1f, step = .1f, scalarMultiplier = 1, unit = Unit.kFloatSingleFraction)]
[SettingsUISection(PIPSettingsTab, PIPGeneralSettingsGroup)]
public float PIPSize { get; set; }
[SettingsUISection(PIPSettingsTab, PIPGeneralSettingsGroup)]
public bool ShowPIPOnEnter { get; set; }
[SettingsUISection(PIPSettingsTab, PIPFeatureSettingsGroup)]
public bool ShowPIPMarker { get; set; }
[SettingsUISection(PIPSettingsTab, PIPFeatureSettingsGroup)]
public bool ShowPIPUndergroundView { get; set; }
[SettingsUISection(PIPSettingsTab, PIPFeatureSettingsGroup)]
public bool DisableVSync { get; set; }
[SettingsUIMultilineText]
[SettingsUISection(PIPSettingsTab, PIPKeybindingSettingsGroup)]
public string PIPMultilineText => "Placeholder";
[SettingsUISection(UISettingsTab, InfoBoxSettingsGroup)]
public Enums.ModUnits SetUnits
{
get => _setUnits;
set
{
_setUnits = value;
SetUISettingsGroup();
}
}
[SettingsUISection(UISettingsTab, InfoBoxSettingsGroup)]
public bool ShowSpeed
{
get => _showSpeed;
set
{
_showSpeed = value;
SetUISettingsGroup();
}
}
[SettingsUISection(UISettingsTab, InfoBoxSettingsGroup)]
public bool ShowVehicleType
{
get => _showVehicleType;
set
{
_showVehicleType = value;
SetUISettingsGroup();
}
}
[SettingsUISection(UISettingsTab, InfoBoxSettingsGroup)]
public bool ShowExtraInfo
{
get => _showExtraInfo;
set
{
_showExtraInfo = value;
SetUISettingsGroup();
}
}
[SettingsUISection(UISettingsTab, StopStripSettingsGroup)]
public Enums.ShowStopStrip ShowStopStrip
{
get => _showStopStrip;
set
{
_showStopStrip = value;
SetUISettingsGroup();
}
}
[SettingsUISection(UISettingsTab, StopStripSettingsGroup)]
public Enums.StopStripDisplayMode StopStripDisplayMode
{
get => _stopStripDisplayMode;
set
{
_stopStripDisplayMode = value;
SetUISettingsGroup();
}
}
private void SetUISettingsGroup()
{
World.DefaultGameObjectInjectionWorld?.GetOrCreateSystemManaged<FirstPersonCameraActivatedUISystem>().SetUISettingsGroupOptions();
}
[SettingsUIHidden]
public string LastSeenChangelogVersion { get; set; }
//sometimes saving doesn't happen when changing values to their default? - hack to guarantee
[SettingsUIHidden]
public int MakeSureSave { get; set; }
public override void SetDefaults()
{
FOV = 70;
MovementSpeed = 0.1f;
RunSpeed = 0.35f;
CimHeight = 1.7f;
TransitionSpeedFactor = 1.5f;
DisableVSync = true;
ShowGameUI = false;
ShowInfoBox = true;
ShowSpeed = true;
ShowVehicleType = false;
ShowExtraInfo = true;
InfoBoxSize = Enums.InfoBoxSize.Default;
PIPSnapToCorner = FirstPersonCameraPIPSystem.PiPCorner.TopRight;
PIPAspectRatio = 0.9f;
PIPSize = 0.4f;
ShowPIPOnEnter = false;
ShowPIPMarker = true;
ShowPIPUndergroundView = true;
SetUnits = Enums.ModUnits.GameSetting;
ShowStopStrip = Enums.ShowStopStrip.AllTransit;
StopStripDisplayMode = Enums.StopStripDisplayMode.AutoHide;
LastSeenChangelogVersion = "";
}
public void Unload()
{
}
}
}