DayZ 1.24
Loading...
Searching...
No Matches
ScriptConsoleRenamePresetDialog.c
Go to the documentation of this file.
1class ScriptConsoleRenamePresetDialog extends UIScriptedMenu
2{
7
11
12 override Widget Init()
13 {
14 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/script_console/script_console_dialog_preset.layout");
15 m_Editbox = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("PrimaryEditBox"));
16 m_Label = TextWidget.Cast(layoutRoot.FindAnyWidget("WindowLabel"));
17 m_Message = TextWidget.Cast(layoutRoot.FindAnyWidget("MessageText"));
18
19 MissionBase mission = MissionBase.Cast(GetGame().GetMission());
20
21 UIScriptedMenu ui_menu = GetGame().GetUIManager().FindMenu(MENU_SCRIPTCONSOLE);
22 if (ui_menu != NULL)
23 {
24 ScriptConsole scripted_console = ScriptConsole.Cast(ui_menu);
26 if (tab)
27 {
28 m_Editbox.SetText(tab.GetCurrentPresetName());
29 m_Label.SetText("RENAME PRESET");
30 m_Message.SetText(tab.GetCurrentPresetName());
31 }
32 }
33
34 return layoutRoot;
35 }
36
37 override bool OnClick(Widget w, int x, int y, int button)
38 {
39 super.OnClick(w, x, y, button);
40
41 if (w.GetUserID() == IDC_OK)
42 {
43 UIScriptedMenu ui_menu = GetGame().GetUIManager().FindMenu(MENU_SCRIPTCONSOLE);
44 if (ui_menu != NULL)
45 {
46 ScriptConsole scripted_console = ScriptConsole.Cast(ui_menu);
48 if (tab)
49 {
50 tab.RenamePreset(m_Editbox.GetText());
51 Close();
52 return true;
53 }
54 }
55 }
56 else if (w.GetUserID() == IDC_CANCEL)
57 {
58 Close();
59 return true;
60 }
61
62 return false;
63 }
64
68}
Mission mission
Icon x
Icon y
void Close()
override bool OnClick(Widget w, int x, int y, int button)
proto native CGame GetGame()
const int MENU_SCRIPTCONSOLE
Definition constants.c:175
const int IDC_CANCEL
Definition constants.c:128
const int IDC_OK
Definition constants.c:127