DayZ 1.24
Loading...
Searching...
No Matches
ScriptConsoleAddPosition.c
Go to the documentation of this file.
1class ScriptConsoleAddLocation extends UIScriptedMenu
2{
4 {
5
6 }
7
9 {
10 }
11
13 {
14 m_EditboxPos.SetText(pos.ToString());
15 }
16
17 override Widget Init()
18 {
20 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/script_console/script_console_add_location_dialogue.layout");
21 m_EditboxName = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("LocationName"));
22 m_EditboxPos = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("Position"));
23 m_Label = TextWidget.Cast(layoutRoot.FindAnyWidget("WindowLabel"));
24 m_ClearButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ButtonClear"));
25 m_Label.SetText("ADD NEW LOCATION");
26
27 return layoutRoot;
28 }
29
30 override bool OnClick(Widget w, int x, int y, int button)
31 {
32 super.OnClick(w, x, y, button);
33
34 if (w.GetUserID() == IDC_OK)
35 {
36 string name = m_EditboxName.GetText();
37 ScriptConsole console = ScriptConsole.Cast(GetGame().GetUIManager().FindMenu(MENU_SCRIPTCONSOLE));
39 if (tab)
40 {
41 if (!tab.IsLocationNameAvailable(name) || name == "" || m_EditboxPos.GetText() == "")
42 return false;
43 m_ConfigDebugProfile.CustomLocationsAdd(name, m_EditboxPos.GetText().BeautifiedToVector());
44 Close();
45 tab.RefreshLocations();
46 return true;
47 }
48 }
49 else if (w.GetUserID() == IDC_CANCEL)
50 {
51 Close();
52 return true;
53 }
54 else if (w == m_ClearButton)
55 {
56 m_EditboxPos.SetText("");
57 return true;
58 }
59
60 return false;
61 }
68}
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Icon x
Icon y
void Close()
PluginConfigDebugProfile m_ConfigDebugProfile
PluginBase GetPlugin(typename plugin_type)
PluginConfigDebugProfile m_ConfigDebugProfile
void SetPosition(vector pos)
override Widget Init()
override bool OnClick(Widget w, int x, int y, int button)
proto string ToString(bool beautify=true)
Vector to string.
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