Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
scriptconsoleaddposition.c
Go to the documentation of this file.
1class ScriptConsoleAddLocation extends UIScriptedMenu
2{
3 void ScriptConsoleAddLocation()
4 {
5
6 }
7
8 void ~ScriptConsoleAddLocation()
9 {
10 }
11
12 void SetPosition(vector pos)
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 }
63 EditBoxWidget m_EditboxName;
64 EditBoxWidget m_EditboxPos;
65 TextWidget m_Label;
66 TextWidget m_Message;
67 ButtonWidget m_ClearButton;
68}
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
bool IsLocationNameAvailable(string name)
PluginConfigDebugProfile m_ConfigDebugProfile
override Widget Init()
Definition bookmenu.c:11
override bool OnClick(Widget w, int x, int y, int button)
Definition bookmenu.c:34
proto native CGame GetGame()
proto native void SetPosition(vector position)
Set the world position of the Effect.
Definition effect.c:463
const int MENU_SCRIPTCONSOLE
Definition constants.c:185
const int IDC_CANCEL
Definition constants.c:136
const int IDC_OK
Definition constants.c:135
Icon x
Icon y
void Close()
PluginConfigDebugProfile m_ConfigDebugProfile
PluginBase GetPlugin(typename plugin_type)