DayZ 1.24
Loading...
Searching...
No Matches
UIPopupScriptInitScript.c
Go to the documentation of this file.
1class UIPopupScriptInitScript extends UIPopupScript
2{
4
8
9 private int m_SceneObjectIndex;
11
12 private PluginSceneManager m_ModuleSceneManager;
13
14 //================================================
15 // UIPopupScriptInitScript
16 //================================================
18 {
19 m_ModuleSceneManager = PluginSceneManager.Cast(GetPlugin(PluginSceneManager));
20
21 m_MedxInitScript = MultilineEditBoxWidget.Cast(wgt.FindAnyWidget("pnl_ppp_is_init_script_value"));
22
23 m_BtnRun = ButtonWidget.Cast(wgt.FindAnyWidget("btn_ppp_is_run"));
24 m_BtnSave = ButtonWidget.Cast(wgt.FindAnyWidget("btn_ppp_is_save"));
25 m_BtnCancel = ButtonWidget.Cast(wgt.FindAnyWidget("btn_ppp_is_cancel"));
26 }
27
28 //================================================
29 // OnOpen
30 //================================================
31 override void OnOpen(Param param)
32 {
33 m_MedxInitScript.SetText("");
34
35 if (param != NULL)
36 {
38 int index = param_scene_object.param1;
40
41 if (index > -1 && scene_object != NULL)
42 {
43 m_SceneObjectIndex = index;
44 m_SceneObject = scene_object;
45 m_MedxInitScript.SetText(m_SceneObject.GetInitScript());
46 }
47 }
48 }
49
50 //================================================
51 // OnClick
52 //================================================
53 override bool OnClick(Widget w, int x, int y, int button)
54 {
55 super.OnClick(w, x, y, button);
56
57 if (w == m_BtnRun)
58 {
59 if (m_SceneObject != NULL)
60 {
61 string text_run;
62 m_MedxInitScript.GetText(text_run);
63 m_ModuleSceneManager.ExecuteEnforceScript(m_SceneObjectIndex, m_SceneObject, text_run);
64 }
65 }
66 else if (w == m_BtnSave)
67 {
68 if (m_SceneObject != NULL)
69 {
70 string text_script;
71 m_MedxInitScript.GetText(text_script);
72 m_SceneObject.SetInitScript(text_script);
73 }
74
75 PopupBack();
76
77 return true;
78 }
79 else if (w == m_BtnCancel)
80 {
81 PopupBack();
82
83 return true;
84 }
85
86 return false;
87 }
88}
Icon x
Icon y
PluginBase GetPlugin(typename plugin_type)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
void SetInitScript(string init_script)
Definition SceneObject.c:89
string GetInitScript()
Definition SceneObject.c:81
PluginSceneManager m_ModuleSceneManager
override bool OnClick(Widget w, int x, int y, int button)
UIPopupScript PopupBack()
ButtonWidget m_BtnCancel
override void OnOpen(Param param)
void UIPopupScriptInitScript(Widget wgt)
MultilineEditBoxWidget m_MedxInitScript