37 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/options/xbox/options_menu.layout", null);
40 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/options/ps/options_menu.layout", null);
42 #ifdef PLATFORM_WINDOWS
43 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/options/pc/options_menu.layout", null);
48 layoutRoot.FindAnyWidget(
"Tabber").GetScript(m_Tabber);
50 m_Details = layoutRoot.FindAnyWidget(
"settings_details");
51 m_Version = TextWidget.Cast(layoutRoot.FindAnyWidget(
"version"));
53 m_GameTab =
new OptionsMenuGame(layoutRoot.FindAnyWidget(
"Tab_0"),
m_Details, m_Options,
this);
54 m_SoundsTab =
new OptionsMenuSounds(layoutRoot.FindAnyWidget(
"Tab_1"),
m_Details, m_Options,
this);
57 m_ControlsTab =
new OptionsMenuControls(layoutRoot.FindAnyWidget(
"Tab_2"),
m_Details, m_Options,
this);
59 m_VideoTab =
new OptionsMenuVideo(layoutRoot.FindAnyWidget(
"Tab_2"),
m_Details, m_Options,
this);
60 m_ControlsTab =
new OptionsMenuControls(layoutRoot.FindAnyWidget(
"Tab_3"),
m_Details, m_Options,
this);
63 m_Apply = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"apply"));
64 m_Back = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"back"));
65 m_Reset = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"reset"));
66 m_Defaults = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"defaults"));
69 m_CanApplyOrReset =
false;
74 #ifdef PLATFORM_CONSOLE
75 version =
"#main_menu_version" +
" " + version +
" (" +
g_Game.GetDatabaseID() +
")";
77 version =
"#main_menu_version" +
" " + version;
79 m_Version.SetText(version);
81 #ifdef PLATFORM_WINDOWS
87 m_Tabber.m_OnTabSwitch.Insert(OnTabSwitch);
88 m_Tabber.m_OnAttemptTabSwitch.Insert(OnAttemptTabSwitch);
204 if (m_ControlsTab.IsChanged())
205 m_ControlsTab.Apply();
207 if (m_SoundsTab.IsChanged())
210 if (m_GameTab.IsChanged())
213 if (m_Options.IsChanged() || m_GameTab.IsChanged())
222 if (
GetGame().GetInput().IsEnabledMouseAndKeyboard())
230 m_CanApplyOrReset =
false;
231 #ifdef PLATFORM_CONSOLE
238 hud.ShowQuickBar(
GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer());
242 if (m_Options.NeedRestart())
243 g_Game.GetUIManager().ShowDialog(
"#main_menu_configure",
"#menu_restart_needed", 117, DBT_YESNO, DBB_YES, DMT_QUESTION,
this);
248 if (!
g_Game.GetUIManager().IsDialogVisible() && !
g_Game.GetUIManager().IsModalVisible())
252 g_Game.GetUIManager().ShowDialog(
"#main_menu_configure",
"#main_menu_configure_desc", 1337, DBT_YESNO, DBB_YES, DMT_QUESTION,
this);
253 #ifdef PLATFORM_CONSOLE
261 GetGame().GetUIManager().Back();
271 if (!
g_Game.GetUIManager().IsDialogVisible() && !
g_Game.GetUIManager().IsModalVisible())
273 int id = target + DIALOG_TAB_OFFSET;
274 g_Game.GetUIManager().ShowDialog(
"#main_menu_configure",
"#main_menu_configure_desc",
id, DBT_YESNO, DBB_YES, DMT_QUESTION,
this);
275 #ifdef PLATFORM_CONSOLE
285 m_Tabber.SetCanSwitch(!changed);
419 if (!
g_Game.GetUIManager().IsDialogVisible() && !
g_Game.GetUIManager().IsModalVisible())
421 g_Game.GetUIManager().ShowDialog(
"#menu_default_cap",
"TODO - reset options to default", MODAL_ID_DEFAULT, DBT_YESNO, DBB_YES, DMT_QUESTION,
this);
427 switch (m_ActiveTabIdx)
430 m_GameTab.SetToDefaults();
434 m_SoundsTab.SetToDefaults();
439 m_ControlsTab.SetToDefaults();
441 m_VideoTab.SetToDefaults();
446 #ifndef PLATFORM_XBOX
447 m_ControlsTab.SetToDefaults();
452 if (
GetGame().GetInput().IsEnabledMouseAndKeyboard())
460 m_CanApplyOrReset =
true;
461 #ifdef PLATFORM_CONSOLE
486 m_GameTab.ToggleDependentOptions(mode,state);
487 m_SoundsTab.ToggleDependentOptions(mode,state);
488 m_ControlsTab.ToggleDependentOptions(mode,state);
489 #ifndef PLATFORM_XBOX
490 m_VideoTab.ToggleDependentOptions(mode,state);
645 super.Update(timeslice);
650 #ifdef PLATFORM_CONSOLE
656 if (
g_Game.GetUIManager().IsDialogVisible())
661 if (
GetUApi().GetInputByID(UAUITabLeft).LocalPress())
663 m_Tabber.PreviousTab();
665 else if (
GetUApi().GetInputByID(UAUITabRight).LocalPress())
669 else if (
GetUApi().GetInputByID(UAUICtrlX).LocalPress())
671 if (m_CanApplyOrReset)
676 else if (
GetUApi().GetInputByID(UAUICredits).LocalPress())
678 if (m_CanApplyOrReset)
684 else if (
GetUApi().GetInputByID(UAUICtrlY).LocalPress())
688 else if (
GetUApi().GetInputByID(UAUIBack).LocalPress())
702 if (w.IsInherited(ButtonWidget))
704 ButtonWidget button = ButtonWidget.Cast(w);
705 button.SetTextColor(
ARGB(255, 200, 0, 0));
708 w.SetColor(
ARGB(255, 0, 0, 0));
710 TextWidget text1 = TextWidget.Cast(w.FindAnyWidget(w.GetName() +
"_text"));
711 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() +
"_label"));
712 TextWidget text3 = TextWidget.Cast(w.FindAnyWidget(w.GetName() +
"_text_1"));
713 ImageWidget image = ImageWidget.Cast(w.FindAnyWidget(w.GetName() +
"_image"));
714 Widget option = Widget.Cast(w.FindAnyWidget(w.GetName() +
"_option_wrapper"));
715 Widget option_label = w.FindAnyWidget(
"option_label");
719 text1.SetColor(
ARGB(255, 255, 0, 0));
724 text2.SetColor(
ARGB(255, 255, 0, 0));
729 text3.SetColor(
ARGB(255, 255, 0, 0));
735 image.SetColor(
ARGB(255, 200, 0, 0));
740 option.SetColor(
ARGB(255, 255, 0, 0));
745 option_label.SetColor(
ARGB(255, 255, 0, 0));
756 if (w.IsInherited(ButtonWidget))
758 ButtonWidget button = ButtonWidget.Cast(w);
759 button.SetTextColor(
ARGB(255, 255, 255, 255));
762 TextWidget text1 = TextWidget.Cast(w.FindAnyWidget(w.GetName() +
"_text"));
763 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() +
"_text_1"));
764 TextWidget text3 = TextWidget.Cast(w.FindAnyWidget(w.GetName() +
"_label"));
765 ImageWidget image = ImageWidget.Cast(w.FindAnyWidget(w.GetName() +
"_image"));
766 Widget option = w.FindAnyWidget(w.GetName() +
"_option_wrapper");
767 Widget option_label = w.FindAnyWidget(
"option_label");
771 text1.SetColor(
ARGB(255, 255, 255, 255));
776 text2.SetColor(
ARGB(255, 255, 255, 255));
781 text3.SetColor(
ARGB(255, 255, 255, 255));
787 image.SetColor(
ARGB(255, 255, 255, 255));
792 option.SetColor(
ARGB(150, 255, 255, 255));
797 option_label.SetColor(
ARGB(255, 255, 255, 255));
819 #ifdef PLATFORM_CONSOLE
822 if (
g_Game.GetUIManager().IsDialogVisible() ||
g_Game.GetUIManager().IsDialogQueued())
833 if (m_CanApplyOrReset)
838 if (m_CanApplyOrReset)
844 toolbar_text.SetText(text);