-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSetting.cs
More file actions
222 lines (175 loc) · 9.01 KB
/
Setting.cs
File metadata and controls
222 lines (175 loc) · 9.01 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
using Colossal;
using Colossal.IO.AssetDatabase;
using ctrlC.Constants;
using Game;
using Game.Input;
using Game.Modding;
using Game.Settings;
using System.Collections.Generic;
using UnityEngine;
namespace ctrlC
{
[FileLocation(nameof(ctrlC))]
[SettingsUIGroupOrder(kSupportGroup, kCategoryGroup, kSliderGroup, kDropdownGroup, kKeybindingGroup)]
[SettingsUIShowGroupName(kSupportGroup, kCategoryGroup, kSliderGroup, kDropdownGroup, kKeybindingGroup)]
public class Setting : ModSetting
{
public const string kSection = "Main";
public const string kDevGroup = "Development tools";
public const string kDevSection = "Dev Tools";
public const string kSupportGroup = "Button";
public const string kCategoryGroup = "Toggle";
public const string kSliderGroup = "Slider";
public const string kDropdownGroup = "Dropdown";
public const string kKeybindingGroup = "KeyBinding";
public Setting(IMod mod) : base(mod)
{
}
[SettingsUIButton]
[SettingsUIButtonGroup("LinkGroup")]
[SettingsUISection(kSection, kSupportGroup)]
public bool NavPatreon
{
set
{
Application.OpenURL(PathConstants.PatreonLink);
}
}
[SettingsUIButton]
[SettingsUIButtonGroup("LinkGroup")]
[SettingsUISection(kSection, kSupportGroup)]
public bool NavX
{
set
{
Application.OpenURL(PathConstants.XLink);
}
}
[SettingsUIButton]
[SettingsUISection(kSection, kCategoryGroup)]
public bool OpenPrefabFolder
{
set
{
Application.OpenURL(PathConstants.PrefabStoragePath);
}
}
[SettingsUITextInput]
[SettingsUISection(kSection, kCategoryGroup)]
public string Category1Name { get; set; } = "Featured";
[SettingsUITextInput]
[SettingsUISection(kSection, kCategoryGroup)]
public string Category2Name { get; set; } = "Category 2";
[SettingsUITextInput]
[SettingsUISection(kSection, kCategoryGroup)]
public string Category3Name { get; set; } = "Category 3";
[SettingsUITextInput]
[SettingsUISection(kSection, kCategoryGroup)]
public string Category4Name { get; set; } = "Category 4";
[SettingsUISection(kSection, kCategoryGroup)]
public bool AutoOpenPrefabMenu
{
get => _autoOpenPrefabMenu;
set
{
if (_autoOpenPrefabMenu != value)
{
_autoOpenPrefabMenu = value;
Mod.AutoOpenPrefabMenu = value;
}
}
}
private bool _autoOpenPrefabMenu = true;
[SettingsUIButton]
[SettingsUISection(kSection, kCategoryGroup)]
public bool SaveCatNames
{
set
{
Mod.ReadCategoryNames(Category1Name, Category2Name, Category3Name, Category4Name);
}
}
[SettingsUIKeyboardBinding(BindingKeyboard.C, Mod.kOpenModActionName, shift: true)]
[SettingsUISection(kSection, kKeybindingGroup)]
public ProxyBinding OpenModBinding { get; set; }
[SettingsUIKeyboardBinding(BindingKeyboard.C, Mod.kCopyActionName, ctrl: true)]
[SettingsUISection(kSection, kKeybindingGroup)]
public ProxyBinding CopyBinding { get; set; }
[SettingsUIKeyboardBinding(BindingKeyboard.X, Mod.kMirrorActionName, ctrl: true)]
[SettingsUISection(kSection, kKeybindingGroup)]
public ProxyBinding MirrorBinding { get; set; }
[SettingsUIKeyboardBinding(BindingKeyboard.Space, Mod.kPhotoActionName, ctrl: true)]
[SettingsUISection(kSection, kKeybindingGroup)]
public ProxyBinding PhotoBinding { get; set; }
[SettingsUISection(kSection, kKeybindingGroup)]
public bool ResetBindings
{
set
{
Mod.log.Info("Reset key bindingss");
ResetKeyBindings();
}
}
public override void SetDefaults()
{
throw new System.NotImplementedException();
}
}
public class LocaleEN : IDictionarySource
{
private readonly Setting m_Setting;
public LocaleEN(Setting setting)
{
m_Setting = setting;
}
public IEnumerable<KeyValuePair<string, string>> ReadEntries(IList<IDictionaryEntryError> errors, Dictionary<string, int> indexCounts)
{
return new Dictionary<string, string>
{
{ m_Setting.GetOptionTabLocaleID(Setting.kDevSection), "Dev" },
{ m_Setting.GetSettingsLocaleID(), "ctrlC" },
{ m_Setting.GetOptionTabLocaleID(Setting.kSection), "Main" },
{ m_Setting.GetOptionGroupLocaleID(Setting.kSupportGroup), "Support the Developer" },
{ m_Setting.GetOptionGroupLocaleID(Setting.kCategoryGroup), "Categories" },
{ m_Setting.GetOptionGroupLocaleID(Setting.kSliderGroup), "Sliders" },
{ m_Setting.GetOptionGroupLocaleID(Setting.kDropdownGroup), "Dropdowns" },
{ m_Setting.GetOptionGroupLocaleID(Setting.kKeybindingGroup), "Key bindings" },
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.NavPatreon)), "Patreon"},
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.NavPatreon)), "Open the developers Patreon page."},
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.NavX)), "Twitter"},
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.NavX)), "Open the developers Twitter page."},
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.SaveCatNames)), "Save Names" },
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.SaveCatNames)), $"Press this magic button to refresh the category names without the need to restart" },
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.OpenPrefabFolder)), "Open Prefab Folder" },
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.OpenPrefabFolder)), $"Open the folder where prefabs is stored on your machine." },
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.Category1Name)), "Category 1 name:" },
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.Category1Name)), $"Here you can adjust names of your categories" },
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.Category2Name)), "Category 2 name:" },
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.Category2Name)), $"Here you can adjust names of your categories" },
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.Category3Name)), "Category 3 name:" },
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.Category3Name)), $"Here you can adjust names of your categories" },
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.Category4Name)), "Category 4 name:" },
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.Category4Name)), $"Here you can adjust names of your categories" },
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.AutoOpenPrefabMenu)), $"Auto open prefab menu"},
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.AutoOpenPrefabMenu)), $"Automatically open prefab menu when opening the mod."},
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.OpenModBinding)), "Mod Key" },
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.OpenModBinding)), $"Keyboard binding for opening the mod" },
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.CopyBinding)), "Copy Key" },
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.CopyBinding)), $"Keyboard binding for copying stuff" },
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.MirrorBinding)), "Mirror Key" },
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.MirrorBinding)), $"Keyboard binding for mirroring the copied stuff" },
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.PhotoBinding)), "Prefab thumbnail camera Key" },
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.PhotoBinding)), $"Keyboard binding for taking a thumbnail picture" },
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.ResetBindings)), "Reset key bindings" },
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.ResetBindings)), $"Reset all key bindings of the mod" },
{ m_Setting.GetBindingKeyLocaleID(Mod.kOpenModActionName), "Open Mod Binding" },
{ m_Setting.GetBindingKeyLocaleID(Mod.kCopyActionName), "Copy Binding" },
{ m_Setting.GetBindingKeyLocaleID(Mod.kMirrorActionName), "Mirror Binding" },
{ m_Setting.GetBindingMapLocaleID(), "Mod settings sample" },
};
}
public void Unload()
{
}
}
}