9 override void OnTabCreate(Widget menuRoot, ResourceName buttonsLayout,
int index)
11 BaseContainer editorCameraSettings =
GetGame().GetGameUserSettings().GetModule(
"SCR_ManualCameraSettings");
12 BaseContainer editorSettings =
GetGame().GetGameUserSettings().GetModule(
"SCR_EditorSettings");
14 super.OnTabCreate(menuRoot, buttonsLayout,
index);
16 if (!editorCameraSettings)
26 editorSettings.Get(
"m_bLayerEditing", state);
28 checkBox.SetCurrentItem(state,
false,
false);
29 checkBox.m_OnChanged.Insert(SetEnableLayerEditing);
33 Print(
"Editor setting 'LayerEditing' not found", LogLevel.WARNING);
41 editorSettings.Get(
"m_PreviewVerticalSnap", value);
43 checkBox.SetCurrentItem(value,
false,
false);
44 checkBox.m_OnChanged.Insert(SetVerticalSnap);
48 Print(
"Editor setting 'VerticalSnap' not found", LogLevel.WARNING);
56 editorSettings.Get(
"m_PreviewVerticleMode", value);
58 checkBox.SetCurrentItem(value >> 1,
false,
false);
59 checkBox.m_OnChanged.Insert(SetVerticalMode);
63 Print(
"Editor setting 'VerticalOrientation' not found", LogLevel.WARNING);
67 if (m_wHorizontalCameraSpeedCheckbox)
70 editorCameraSettings.Get(
"m_bCameraMoveATL", value);
72 m_wHorizontalCameraSpeedCheckbox.SetCurrentItem(value,
false,
false);
73 m_wHorizontalCameraSpeedCheckbox.m_OnChanged.Insert(SetHorizontalCameraSpeed);
77 Print(
"Editor setting 'HorizontalCameraSpeed' not found", LogLevel.WARNING);
81 if (m_wATLSpeedCheckbox)
84 editorCameraSettings.Get(
"m_bCameraSpeedATL", value);
86 m_wATLSpeedCheckbox.SetCurrentItem(value,
false,
false);
87 m_wATLSpeedCheckbox.SetEnabled(m_wHorizontalCameraSpeedCheckbox.GetCurrentIndex() > 0);
89 m_wATLSpeedCheckbox.m_OnChanged.Insert(SetATLSpeed);
92 TextWidget text = TextWidget.Cast(m_wATLSpeedCheckbox.GetLabelWidget());
95 text.SetTextOffset(20, 0);
99 Print(
"Editor setting 'ATLSpeed' not found", LogLevel.WARNING);
104 if (m_wSpeedCoefSlider)
106 m_wSpeedCoefSlider.SetSliderSettings(0.1, 10, 0.05,
"#AR-ValueUnit_Short_Multiplier");
108 editorCameraSettings.Get(
"m_fCameraSpeedCoef", value);
110 m_wSpeedCoefSlider.SetValue(value);
111 m_wSpeedCoefSlider.ShowCustomValue(GetSliderText(value, 2));
112 m_wSpeedCoefSlider.m_OnChanged.Insert(SetSpeedCoef);
116 Print(
"Editor setting 'SpeedCoef' not found", LogLevel.WARNING);
120 if (wb_CameraAboveTerrain)
123 editorCameraSettings.Get(
"m_bCameraAboveTerrain", value);
125 wb_CameraAboveTerrain.SetCurrentItem(value,
false,
false);
126 wb_CameraAboveTerrain.m_OnChanged.Insert(SetCameraAboveTerrain);
130 Print(
"Editor setting 'WB_CameraAboveTerrain' not found", LogLevel.WARNING);
134 if (wb_CameraRotateWithModifier)
137 editorCameraSettings.Get(
"m_bCameraRotateWithModifier", value);
139 wb_CameraRotateWithModifier.SetCurrentItem(value,
false,
false);
140 wb_CameraRotateWithModifier.m_OnChanged.Insert(SetCameraRotateWithModifier);
144 Print(
"Editor setting 'm_bCameraRotateWithModifier' not found", LogLevel.WARNING);
150 Widget wb_Seperator =
m_wRoot.FindAnyWidget(
"WB_Separator");
151 if (wb_Seperator) wb_Seperator.SetVisible(
false);
152 if (wb_CameraAboveTerrain) wb_CameraAboveTerrain.GetRootWidget().SetVisible(
false);
153 if (wb_CameraRotateWithModifier) wb_CameraRotateWithModifier.GetRootWidget().SetVisible(
false);
161 BaseContainer editorSettings =
GetGame().GetGameUserSettings().GetModule(
"SCR_EditorSettings");
165 editorSettings.Set(
"m_bLayerEditing", state);
167 GetGame().UserSettingsChanged();
172 BaseContainer editorSettings =
GetGame().GetGameUserSettings().GetModule(
"SCR_EditorSettings");
176 editorSettings.Set(
"m_PreviewVerticalSnap", state);
177 GetGame().UserSettingsChanged();
182 BaseContainer editorSettings =
GetGame().GetGameUserSettings().GetModule(
"SCR_EditorSettings");
188 editorSettings.Set(
"m_PreviewVerticleMode", state);
189 GetGame().UserSettingsChanged();
192 if (!previewComponent)
195 previewComponent.SetVerticalMode(state);
201 m_wATLSpeedCheckbox.SetEnabled(state);
203 BaseContainer settings =
GetGame().GetGameUserSettings().GetModule(
"SCR_ManualCameraSettings");
204 if (!settings)
return;
205 settings.Set(
"m_bCameraMoveATL", state);
207 GetGame().UserSettingsChanged();
213 BaseContainer settings =
GetGame().GetGameUserSettings().GetModule(
"SCR_ManualCameraSettings");
214 if (!settings)
return;
215 settings.Set(
"m_bCameraSpeedATL", state);
217 GetGame().UserSettingsChanged();
223 m_wSpeedCoefSlider.ShowCustomValue(GetSliderText(value, 2));
225 BaseContainer settings =
GetGame().GetGameUserSettings().GetModule(
"SCR_ManualCameraSettings");
226 if (!settings)
return;
227 settings.Set(
"m_fCameraSpeedCoef", value);
229 GetGame().UserSettingsChanged();
235 BaseContainer settings =
GetGame().GetGameUserSettings().GetModule(
"SCR_ManualCameraSettings");
236 if (!settings)
return;
237 settings.Set(
"m_bCameraAboveTerrain", state);
239 GetGame().UserSettingsChanged();
245 BaseContainer settings =
GetGame().GetGameUserSettings().GetModule(
"SCR_ManualCameraSettings");
246 if (!settings)
return;
247 settings.Set(
"m_bCameraRotateWithModifier", state);
249 GetGame().UserSettingsChanged();
252 string GetSliderText(
float value,
int decimals)
254 float coef = Math.Pow(10, decimals);
255 value = Math.Round(value * coef);
256 string valueText = value.ToString();
259 for (
int i = 0, count = decimals - valueText.Length() + 1; i < count; i++)
261 valueText =
"0" + valueText;
263 int length = valueText.Length();
264 valueText = valueText.Substring(0, length - decimals) +
"." + valueText.Substring(length - decimals, decimals);