11 protected ButtonWidget
m_Back;
16 protected int m_CurrentSettingKeyIndex = -1;
17 protected int m_CurrentSettingAlternateKeyIndex = -1;
22 const int MODAL_ID_BACK = 1337;
23 const int MODAL_ID_DEFAULT = 100;
24 const int MODAL_ID_DEFAULT_ALL = 101;
25 const int MODAL_ID_PRESET_CHANGE = 200;
26 const int MODAL_RESULT_DEFAULT_CURRENT = 0;
27 const int MODAL_RESULT_DEFAULT_ALL = 1;
34 m_Version =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"version"));
35 m_Apply = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"apply"));
36 m_Back = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"back"));
37 m_Undo = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"undo"));
38 m_Defaults = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"reset"));
39 m_HardReset = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"reset_all"));
41 layoutRoot.FindAnyWidget(
"Tabber").GetScript(m_Tabber);
45 #ifdef PLATFORM_CONSOLE
46 version =
"#main_menu_version" +
" " + version +
" (" +
g_Game.GetDatabaseID() +
")";
48 version =
"#main_menu_version" +
" " + version;
50 m_Version.SetText(version);
53 string back =
"circle";
57 ImageWidget toolbar_b = ImageWidget.Cast(layoutRoot.FindAnyWidget(
"BackIcon"));
58 toolbar_b.LoadImageFile(0,
"set:playstation_buttons image:" + back);
65 InitPresets(-1, layoutRoot.FindAnyWidget(
"group_header"), input);
66 m_Tabber.m_OnTabSwitch.Insert(UpdateTabContent);
67 m_Tabber.SelectTabControl(0);
68 m_Tabber.SelectTabPanel(0);
69 g_Game.SetKeyboardHandle(
this);
70 m_Tabber.RefreshTab(
true);
85 for (
int i = 0; i < sort_count; i++)
90 group_name =
Widget.TranslateString(
"#" + group_name);
91 m_Tabber.AddTab(group_name);
97 m_Tabber.AddTab(
Widget.TranslateString(
"#layout_pc_keybinding_unsorted"));
99 m_Tabber.DisableTabs(
true);
104 m_GroupsContainer =
new KeybindingsContainer(-1,
GetGame().
GetInput(),layoutRoot.FindAnyWidget(
"TabContentsHolder"),
this);
109 m_GroupsContainer.SwitchSubgroup(tab_index);
130 m_CurrentSettingAlternateKeyIndex = -1;
131 m_CurrentSettingKeyIndex = key_index;
136 m_GroupsContainer.CancelEnteringKeybind();
137 m_CurrentSettingKeyIndex = -1;
142 m_CurrentSettingKeyIndex = -1;
143 m_CurrentSettingAlternateKeyIndex = key_index;
148 m_GroupsContainer.CancelEnteringAlternateKeybind();
149 m_CurrentSettingAlternateKeyIndex = -1;
154 m_CurrentSettingKeyIndex = -1;
163 m_CurrentSettingAlternateKeyIndex = -1;
172 if (
GetUApi().GetInputByID(UAUIBack).LocalPress())
177 if (m_GroupsContainer)
179 m_GroupsContainer.Update(timeslice);
197 else if (w == m_Undo)
202 else if (w == m_Defaults)
207 else if (w == m_HardReset)
225 m_GroupsContainer.Apply();
233 if (m_CurrentSettingKeyIndex != -1)
239 if (m_CurrentSettingAlternateKeyIndex != -1)
245 bool changed = m_GroupsContainer.IsChanged();
249 g_Game.GetUIManager().ShowDialog(
"#main_menu_configure",
"#main_menu_configure_desc", MODAL_ID_BACK, DBT_YESNO, DBB_YES, DMT_QUESTION,
this);
265 m_GroupsContainer.Reset();
270 g_Game.GetUIManager().ShowDialog(
"#menu_default_cap",
"#menu_default_desc", MODAL_ID_DEFAULT, DBT_YESNO, DBB_YES, DMT_QUESTION,
this);
275 g_Game.GetUIManager().ShowDialog(
"#menu_default_cap",
"#menu_default_all_desc", MODAL_ID_DEFAULT_ALL, DBT_YESNO, DBB_YES, DMT_QUESTION,
this);
296 m_GroupsContainer.Reset(
true);
301 if (code == MODAL_ID_BACK)
303 if (result == DBB_YES)
310 else if (code == MODAL_ID_DEFAULT)
312 if (result == DBB_YES)
318 else if (code == MODAL_ID_DEFAULT_ALL)
320 if (result == DBB_YES)
325 else if (code == MODAL_ID_PRESET_CHANGE)
327 if (result == DBB_YES)
330 m_PresetSelector.PerformSetOption(m_TargetPresetIndex);
342 #ifdef PLATFORM_CONSOLE
343 version =
"#main_menu_version" +
" " + version +
" (" +
g_Game.GetDatabaseID() +
")";
345 version =
"#main_menu_version" +
" " + version;
347 m_Version.SetText(version);
379 return super.OnMouseWheel(w,
x,
y, wheel);
413 return (w == m_Apply || w ==
m_Back || w == m_Undo || w == m_Defaults || w == m_HardReset);
423 ButtonWidget button = ButtonWidget.Cast(w);
424 if (button && button != m_Apply)
426 button.SetTextColor(
ARGB(255, 200, 0, 0));
432 #ifdef PLATFORM_WINDOWS
436 ButtonWidget button = ButtonWidget.Cast(w);
452 #ifdef PLATFORM_WINDOWS
456 ButtonWidget button = ButtonWidget.Cast(w);
470 Widget kb_root = parent.FindAnyWidget(
"keyboard_dropown");
482 opt1.Insert(profile_text);
486 m_OriginalPresetIndex = current_idx;
487 m_PresetSelector =
new OptionSelectorMultistate(layoutRoot.FindAnyWidget(
"profile_setting_option"), current_idx, null,
false, opt1);
488 m_PresetSelector.m_AttemptOptionChange.Insert(OnAttemptSelectPreset);
489 m_PresetSelector.m_OptionChanged.Insert(OnSelectKBPreset);
494 bool changed = m_GroupsContainer.IsChanged() && m_OriginalPresetIndex != index;
495 m_TargetPresetIndex = index;
499 g_Game.GetUIManager().ShowDialog(
"#main_menu_configure",
"#main_menu_configure_desc", MODAL_ID_PRESET_CHANGE, DBT_YESNO, DBB_YES, DMT_QUESTION,
this);
502 m_PresetSelector.SetCanSwitch(!changed);
507 m_OriginalPresetIndex = index;
508 m_GroupsContainer.OnSelectKBPreset(index);
protected ButtonWidget m_Back
proto void GetVersion(out string version)
proto native Mission GetMission()
proto native Input GetInput()
override ScriptCallQueue GetCallQueue(int call_category)
proto native UIManager GetUIManager()
proto native WorkspaceWidget GetWorkspace()
static int COLOR_DISABLED_TEXT
static int COLOR_NORMAL_TEXT
ScriptInvoker GetOnInputPresetChanged()
proto void Call(func fn, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto void Invoke(void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
invoke call on all inserted methods with given arguments
bool Back()
Close top window on windows stack, returns true when any window is closed.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
int ARGB(int a, int r, int g, int b)