Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
uipopupscriptinitscript.c
Go to the documentation of this file.
1 class UIPopupScriptInitScript extends UIPopupScript
2 {
3  private MultilineEditBoxWidget m_MedxInitScript;
4 
5  private ButtonWidget m_BtnRun;
6  private ButtonWidget m_BtnSave;
7  private ButtonWidget m_BtnCancel;
8 
9  private int m_SceneObjectIndex;
10  private SceneObject m_SceneObject;
11 
12  private PluginSceneManager m_ModuleSceneManager;
13 
14  //================================================
15  // UIPopupScriptInitScript
16  //================================================
17  void UIPopupScriptInitScript(Widget wgt)
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  {
37  Param2<int, SceneObject> param_scene_object = Param2<int, SceneObject>.Cast( param );
38  int index = param_scene_object.param1;
39  SceneObject scene_object = param_scene_object.param2;
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 }
Param2
Definition: ppeconstants.c:66
Param
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition: param.c:11
y
Icon y
SceneObject
Definition: sceneobject.c:1
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition: pluginmanager.c:316
UIPopupScript
Definition: uipopupscriptconfigs.c:1
x
Icon x
Widget
Definition: enwidgets.c:189
OnClick
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Definition: dayzgame.c:146