Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
uipopupscriptpositionmanager.c
Go to the documentation of this file.
1class UIPopupScriptPositionManager extends UIPopupScript
2{
3 private TextListboxWidget m_LstPositionList;
4 private EditBoxWidget m_TxtSelectedX;
5 private EditBoxWidget m_TxtSelectedY;
6 private EditBoxWidget m_TxtCurrentX;
7 private EditBoxWidget m_TxtCurrentY;
8 private PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed;
9 private ButtonWidget m_TeleportButton;
10 private ButtonWidget m_CancelButton;
11
12 //================================================
13 // UIPopupScriptPositionManager
14 //================================================
15 void UIPopupScriptPositionManager( Widget wgt )
16 {
17 m_ConfigDebugProfileFixed = PluginConfigDebugProfileFixed.Cast( GetPlugin( PluginConfigDebugProfileFixed ) );
18 m_LstPositionList = TextListboxWidget.Cast( wgt.FindAnyWidget("tls_ppp_pm_positions_list") );
19 m_TxtSelectedX = EditBoxWidget.Cast( wgt.FindAnyWidget("pnl_ppp_pm_selected_x_value") );
20 m_TxtSelectedY = EditBoxWidget.Cast( wgt.FindAnyWidget("pnl_ppp_pm_selected_y_value") );
21 m_TxtCurrentX = EditBoxWidget.Cast( wgt.FindAnyWidget("pnl_ppp_pm_current_x_value") );
22 m_TxtCurrentY = EditBoxWidget.Cast( wgt.FindAnyWidget("pnl_ppp_pm_current_y_value") );
23 m_TeleportButton = ButtonWidget.Cast( wgt.FindAnyWidget("btn_ppp_pm_teleport") );
24 m_CancelButton = ButtonWidget.Cast( wgt.FindAnyWidget("btn_ppp_pm_cancel") );
25 /*
26 TStringArray positions_array = new TStringArray;
27 m_ConfigDebugProfileFixed.GetAllPositionsNames( positions_array );
28
29 for ( int i = 0; i < positions_array.Count(); i++ )
30 {
31 m_LstPositionList.AddItem( positions_array.Get(i), new LocationParams ( positions_array.Get(i), false, vector.Zero), 0);
32 }*/
33 }
34
35 //================================================
36 // OnOpen
37 //================================================
38 override void OnOpen( Param param )
39 {
40 if( PluginSceneManager.GetInstance() )
41 {
42 if( PluginSceneManager.GetInstance().GetSelectedSceneObject() )
43 {
44 vector player_pos = PluginSceneManager.GetInstance().GetSelectedSceneObject().GetPosition();
45
46 m_TxtCurrentX.SetText( player_pos[0].ToString() );
47 m_TxtCurrentY.SetText( player_pos[2].ToString() );
48 }
49 }
50 }
51
52 //================================================
53 // OnClick
54 //================================================
55 override bool OnClick( Widget w, int x, int y, int button )
56 {
57 if ( w == m_TeleportButton )
58 {
59 float pos_x = m_TxtSelectedX.GetText().ToFloat();
60 float pos_z = m_TxtSelectedY.GetText().ToFloat();
61
62 PluginSceneManager.GetInstance().SelectedObjectSetPosX( pos_x );
63 PluginSceneManager.GetInstance().SelectedObjectSetPosZ( pos_z );
64 PopupBack();
65 return true;
66 }
67 else if ( w == m_CancelButton )
68 {
69 PopupBack();
70 return true;
71 }
72 return false;
73 }
74
75 void OnItemSelected( Widget w, int x, int y, int row, int column, int oldRow, int oldColumn )
76 {
77 /*
78 vector position = m_ConfigDebugProfileFixed.GetPositionByNameEx( GetCurrentLocationName() );
79 m_TxtSelectedX.SetText( position[0].ToString() );
80 m_TxtSelectedY.SetText( position[2].ToString() );
81 */
82 }
83
84 string GetCurrentLocationName()
85 {
86 if ( m_LstPositionList.GetSelectedRow() != -1 )
87 {
88 string position_name;
89 m_LstPositionList.GetItemText( m_LstPositionList.GetSelectedRow(), 0, position_name );
90 return position_name;
91 }
92 return "";
93 }
94}
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
UIPopupScript PopupBack()
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Definition dayzgame.c:151
proto string ToString()
Icon x
Icon y
PluginBase GetPlugin(typename plugin_type)