DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
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));
38 if (!console.IsLocationNameAvailable(name) || name == "" || m_EditboxPos.GetText() == "")
39 return false;
40 m_ConfigDebugProfile.CustomLocationsAdd(name, m_EditboxPos.GetText().BeautifiedToVector());
41 Close();
42
43 console.RefreshLocations();
44 return true;
45 }
46 else if (w.GetUserID() == IDC_CANCEL)
47 {
48 Close();
49 return true;
50 }
51 else if (w == m_ClearButton)
52 {
53 m_EditboxPos.SetText("");
54 return true;
55 }
56
57 return false;
58 }
60 EditBoxWidget m_EditboxName;
61 EditBoxWidget m_EditboxPos;
64 ButtonWidget m_ClearButton;
65}
Icon x
Icon y
void Close()
string name
PluginConfigDebugProfile m_ConfigDebugProfile
PluginBase GetPlugin(typename plugin_type)
proto native WorkspaceWidget GetWorkspace()
protected 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:163
vector BeautifiedToVector()
Convert beautified string into a vector.
Definition EnString.c:67
const int IDC_CANCEL
Definition constants.c:116
const int IDC_OK
Definition constants.c:115
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.