Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
scriptconsoleaddposition.c
Go to the documentation of this file.
1 class 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 }
GetGame
proto native CGame GetGame()
UIScriptedMenu
Definition: dayzgame.c:63
IDC_CANCEL
const int IDC_CANCEL
Definition: constants.c:128
PluginConfigDebugProfile
Definition: pluginconfigdebugprofilefixed.c:1
EditBoxWidget
Definition: enwidgets.c:353
Close
void Close()
y
Icon y
MENU_SCRIPTCONSOLE
const int MENU_SCRIPTCONSOLE
Definition: constants.c:175
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition: pluginmanager.c:316
vector
Definition: enconvert.c:105
Init
class InventoryGridController extends ScriptedWidgetEventHandler Init
Definition: uihintpanel.c:46
TextWidget
Definition: enwidgets.c:219
ScriptConsoleGeneralTab
Definition: scriptconsolegeneraltab.c:1
name
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
x
Icon x
SetPosition
proto native void SetPosition(vector position)
Set the world position of the Effect.
Definition: effect.c:436
m_ConfigDebugProfile
PluginConfigDebugProfile m_ConfigDebugProfile
Definition: pluginitemdiagnostic.c:58
IDC_OK
const int IDC_OK
Definition: constants.c:127
Widget
Definition: enwidgets.c:189
OnClick
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Definition: dayzgame.c:146