Skip to content

Commit 3e9ba88

Browse files
authored
Merge pull request #1306 from CitiesSkylinesMods/general-tab-redux
General tab - redux
2 parents acab6a9 + 5da813d commit 3e9ba88

File tree

1 file changed

+40
-36
lines changed

1 file changed

+40
-36
lines changed

TLM/TLM/State/OptionsTabs/OptionsGeneralTab.cs

+40-36
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,18 @@ public static class OptionsGeneralTab {
4949

5050
private static UICheckBox _useUUI;
5151

52-
5352
private static string T(string key) => Translation.Options.Get(key);
5453

5554
internal static void MakeSettings_General(ExtUITabstrip tabStrip) {
56-
UIHelper panelHelper = tabStrip.AddTabPage(T("Tab:General"));
55+
UIHelper tab = tabStrip.AddTabPage(T("Tab:General"));
56+
UIHelperBase group;
57+
58+
tab.AddSpace(5);
59+
tab.AddButton("What's New?", WhatsNew.OpenModal);
60+
tab.AddSpace(5);
61+
62+
group = tab.AddGroup(T("General.Group:Localisation"));
5763

58-
UIHelperBase generalGroup = panelHelper.AddGroup(T("Tab:General"));
5964
string[] languageLabels = new string[Translation.AvailableLanguageCodes.Count + 1];
6065
languageLabels[0] = T("General.Dropdown.Option:Game language");
6166

@@ -77,31 +82,31 @@ internal static void MakeSettings_General(ExtUITabstrip tabStrip) {
7782
}
7883
}
7984

80-
_languageDropdown = generalGroup.AddDropdown(
85+
_languageDropdown = group.AddDropdown(
8186
text: T("General.Dropdown:Select language") + ":",
8287
options: languageLabels,
8388
defaultSelection: languageIndex,
8489
eventCallback: OnLanguageChanged) as UIDropDown;
8590

86-
generalGroup.AddSpace(5);
87-
generalGroup.AddButton("What's New?", WhatsNew.OpenModal);
88-
generalGroup.AddSpace(10);
91+
SetupSpeedLimitsPanel(group);
92+
93+
group = tab.AddGroup(T("General.Group:Interface"));
8994

90-
_lockButtonToggle = generalGroup.AddCheckbox(
95+
_lockButtonToggle = group.AddCheckbox(
9196
text: T("General.Checkbox:Lock main menu button position"),
9297
defaultValue: GlobalConfig.Instance.Main.MainMenuButtonPosLocked,
9398
eventCallback: OnLockButtonChanged) as UICheckBox;
94-
_lockMenuToggle = generalGroup.AddCheckbox(
99+
_lockMenuToggle = group.AddCheckbox(
95100
text: T("General.Checkbox:Lock main menu window position"),
96101
defaultValue: GlobalConfig.Instance.Main.MainMenuPosLocked,
97102
eventCallback: OnLockMenuChanged) as UICheckBox;
98103

99-
_useUUI = generalGroup.AddCheckbox(
104+
_useUUI = group.AddCheckbox(
100105
text: T("General.Checkbox:Use UnifiedUI"),
101106
defaultValue: GlobalConfig.Instance.Main.UseUUI,
102107
eventCallback: OnUseUUIChanged) as UICheckBox;
103108

104-
_guiScaleSlider = generalGroup.AddSlider(
109+
_guiScaleSlider = group.AddSlider(
105110
text: T("General.Slider:GUI scale") + ":",
106111
min: 50,
107112
max: 200,
@@ -110,7 +115,7 @@ internal static void MakeSettings_General(ExtUITabstrip tabStrip) {
110115
eventCallback: OnGuiScaleChanged) as UISlider;
111116
_guiScaleSlider.parent.Find<UILabel>("Label").width = 500;
112117

113-
_guiOpacitySlider = generalGroup.AddSlider(
118+
_guiOpacitySlider = group.AddSlider(
114119
text: T("General.Slider:Window transparency") + ":",
115120
min: 0,
116121
max: 100,
@@ -119,57 +124,56 @@ internal static void MakeSettings_General(ExtUITabstrip tabStrip) {
119124
eventCallback: OnGuiOpacityChanged) as UISlider;
120125
_guiOpacitySlider.parent.Find<UILabel>("Label").width = 500;
121126

122-
_overlayTransparencySlider = generalGroup.AddSlider(
127+
_overlayTransparencySlider = group.AddSlider(
123128
text: T("General.Slider:Overlay transparency") + ":",
124129
min: 0,
125130
max: 100,
126131
step: 5,
127132
defaultValue: GlobalConfig.Instance.Main.OverlayTransparency,
128133
eventCallback: OnOverlayTransparencyChanged) as UISlider;
129134
_overlayTransparencySlider.parent.Find<UILabel>("Label").width = 500;
130-
_enableTutorialToggle = generalGroup.AddCheckbox(
135+
_enableTutorialToggle = group.AddCheckbox(
131136
T("General.Checkbox:Enable tutorials"),
132137
GlobalConfig.Instance.Main.EnableTutorial,
133138
OnEnableTutorialsChanged) as UICheckBox;
134-
_showCompatibilityCheckErrorToggle
135-
= generalGroup.AddCheckbox(
136-
T("General.Checkbox:Notify me about TM:PE startup conflicts"),
137-
GlobalConfig.Instance.Main.ShowCompatibilityCheckErrorMessage,
138-
OnShowCompatibilityCheckErrorChanged) as UICheckBox;
139-
_scanForKnownIncompatibleModsToggle
140-
= generalGroup.AddCheckbox(
141-
Translation.ModConflicts.Get("Checkbox:Scan for known incompatible mods on startup"),
142-
GlobalConfig.Instance.Main.ScanForKnownIncompatibleModsAtStartup,
143-
OnScanForKnownIncompatibleModsChanged) as UICheckBox;
144-
_ignoreDisabledModsToggle = generalGroup.AddCheckbox(
145-
text: Translation.ModConflicts.Get("Checkbox:Ignore disabled mods"),
146-
defaultValue: GlobalConfig.Instance.Main.IgnoreDisabledMods,
147-
eventCallback: OnIgnoreDisabledModsChanged) as UICheckBox;
148-
Options.Indent(_ignoreDisabledModsToggle);
149139

140+
group = tab.AddGroup(T("General.Group:Simulation"));
150141

151-
// General: Speed Limits
152-
SetupSpeedLimitsPanel(generalGroup);
153-
154-
// General: Simulation
155-
UIHelperBase simGroup = panelHelper.AddGroup(T("General.Group:Simulation"));
156142
string[] simPrecisionOptions = new[] {
157143
T("General.Dropdown.Option:Very low"),
158144
T("General.Dropdown.Option:Low"),
159145
T("General.Dropdown.Option:Medium"),
160146
T("General.Dropdown.Option:High"),
161147
T("General.Dropdown.Option:Very high"),
162148
};
163-
_simulationAccuracyDropdown = simGroup.AddDropdown(
149+
_simulationAccuracyDropdown = group.AddDropdown(
164150
text: T("General.Dropdown:Simulation accuracy") + ":",
165151
options: simPrecisionOptions,
166152
defaultSelection: (int)Options.simulationAccuracy,
167153
eventCallback: OnSimulationAccuracyChanged) as UIDropDown;
168154

169-
_instantEffectsToggle = simGroup.AddCheckbox(
155+
_instantEffectsToggle = group.AddCheckbox(
170156
text: T("General.Checkbox:Apply AI changes right away"),
171157
defaultValue: Options.instantEffects,
172158
eventCallback: OnInstantEffectsChanged) as UICheckBox;
159+
160+
group = tab.AddGroup(T("General.Group:Compatibility"));
161+
162+
_scanForKnownIncompatibleModsToggle
163+
= group.AddCheckbox(
164+
Translation.ModConflicts.Get("Checkbox:Scan for known incompatible mods on startup"),
165+
GlobalConfig.Instance.Main.ScanForKnownIncompatibleModsAtStartup,
166+
OnScanForKnownIncompatibleModsChanged) as UICheckBox;
167+
_ignoreDisabledModsToggle = group.AddCheckbox(
168+
text: Translation.ModConflicts.Get("Checkbox:Ignore disabled mods"),
169+
defaultValue: GlobalConfig.Instance.Main.IgnoreDisabledMods,
170+
eventCallback: OnIgnoreDisabledModsChanged) as UICheckBox;
171+
Options.Indent(_ignoreDisabledModsToggle);
172+
_showCompatibilityCheckErrorToggle
173+
= group.AddCheckbox(
174+
T("General.Checkbox:Notify me about TM:PE startup conflicts"),
175+
GlobalConfig.Instance.Main.ShowCompatibilityCheckErrorMessage,
176+
OnShowCompatibilityCheckErrorChanged) as UICheckBox;
173177
}
174178

175179
private static void SetupSpeedLimitsPanel(UIHelperBase generalGroup) {

0 commit comments

Comments
 (0)