Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
huddebug.c
Go to the documentation of this file.
1 // *************************************************************************************
2 // ! PluginDayzPlayerDebugUI
3 // *************************************************************************************
4 class HudDebugEventHandler extends ScriptedWidgetEventHandler
5 {
6  HudDebug m_HudDebug;
7 
8  void HudDebugEventHandler( HudDebug hud_debug )
9  {
10  m_HudDebug = hud_debug;
11  }
12 
13  HudDebug GetHudDebug()
14  {
15  return m_HudDebug;
16  }
17 
18  override bool OnClick( Widget w, int x, int y, int button )
19  {
20  super.OnClick( w, x, y, button );
21  return GetHudDebug().OnClick( w, x, y, button );
22  }
23 
24  override bool OnFocus(Widget w, int x, int y)
25  {
26  //Print("OnFocus");
27  return true;
28  }
29 
30  override bool OnFocusLost(Widget w, int x, int y)
31  {
32  //Print("OnFocusLost");
33  return true;
34  }
35  /*
36  override bool OnMouseEnter(Widget w, int x, int y)
37  {
38  Print("OnMouseEnter");
39  return true;
40  }
41 
42  override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
43  {
44  Print("OnMouseLeaves");
45  return true;
46  }*/
47 
48  override bool OnMouseButtonDown(Widget w, int x, int y, int button)
49  {
50  //Print("OnMouseButtonDown");
51  return true;
52  }
53 
54 
55  override bool OnSelect(Widget w, int x, int y)
56  {
57  //Print("OnSelect");
58  return true;
59  }
60  override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
61  {
62  //Print("OnItemSelected");
63  return true;
64  }
65 
66  override bool OnModalResult(Widget w, int x, int y, int code, int result)
67  {
68  //Print("OnModalResult");
69  return true;
70  }
71 
72  override bool OnChange(Widget w, int x, int y, bool finished)
73  {
74  //Print("OnChange " + finished);
75  super.OnChange( w, x, y, finished );
76  return GetHudDebug().OnChange( w, x, y, finished );
77  }
78 }
79 
80 class HudDebug extends Hud
81 {
82  static const int HUD_WIN_UNDEFINED = 0;
83  static const int HUD_WIN_CHAR_STATS = 1;
84  static const int HUD_WIN_CHAR_MODIFIERS = 2;
85  static const int HUD_WIN_CHAR_AGENTS = 3;
86  static const int HUD_WIN_CHAR_DEBUG = 4;
87  static const int HUD_WIN_CHAR_LEVELS = 5;
88  static const int HUD_WIN_CHAR_STOMACH = 6;
89  static const int HUD_WIN_VERSION = 7;
90  static const int HUD_WIN_TEMPERATURE = 8;
91 
96  ref HudDebugEventHandler m_HudDebugHandler;
98  ref HudDebugWinCharStats m_WinCharStats;
100 
101  //============================================
102  // HudDebug
103  //============================================
104  void HudDebug()
105  {
106  }
107 
108  //============================================
109  // ~HudDebug
110  //============================================
111  void ~HudDebug()
112  {
113  delete m_WgtRoot;
114  m_TimerUpdate.Stop();
115  }
116 
117  //============================================
118  // Init
119  //============================================
120  override void Init( Widget hud_panel_widget )
121  {
122  m_WgtRoot = hud_panel_widget;
123  m_WgtRoot.Show( true );
124 
125  // Crosshair widget root
126  m_Crosshair = m_WgtRoot.FindAnyWidget( "wdw_Crosshair" );
127 
129 
130  // Register Window Character Stats
131  m_WinCharStats = new HudDebugWinCharStats( m_WgtRoot.FindAnyWidget( "wdw_CharacterStats" ) );
132  m_Panels.Insert( m_WinCharStats );
133 
134  // Register Window Character Stats
135  HudDebugWinCharLevels win_char_levels = new HudDebugWinCharLevels( m_WgtRoot.FindAnyWidget( "wdw_CharacterLevels" ) );
136  m_Panels.Insert( win_char_levels );
137 
138  // Register Window Chracter Modifiers
139  m_WinCharModifiers = new HudDebugWinCharModifiers( m_WgtRoot.FindAnyWidget( "wdw_CharacterModifiers" ) );
140  m_Panels.Insert( m_WinCharModifiers );
141 
142  // Register Window Chracter Agents
143  m_WinCharAgents = new HudDebugWinCharAgents( m_WgtRoot.FindAnyWidget( "wdw_CharacterAgents" ) );
144  m_Panels.Insert( m_WinCharAgents );
145 
146  // Register Window Chracter Debug
147  HudDebugWinCharDebug win_char_debug = new HudDebugWinCharDebug( m_WgtRoot.FindAnyWidget( "wdw_CharacterDebug" ) );
148  m_Panels.Insert( win_char_debug );
149 
150  // Register Window Chracter Debug
151  HudDebugWinCharStomach win_char_stomach = new HudDebugWinCharStomach( m_WgtRoot.FindAnyWidget( "wdw_CharacterStomach" ) );
152  m_Panels.Insert( win_char_stomach );
153 
154  // Register Window Version
155  HudDebugWinVersion win_version = new HudDebugWinVersion( m_WgtRoot.FindAnyWidget( "wdw_Version" ) );
156  m_Panels.Insert( win_version );
157 
158  // Register Window Temperature
159  HudDebugWinTemperature win_temp = new HudDebugWinTemperature( m_WgtRoot.FindAnyWidget( "wdw_Temp" ) );
160  m_Panels.Insert( win_temp );
161 
162 
165 
166  m_TimerUpdate = new Timer();
167  m_TimerUpdate.Run( 1.0, this, "Update", NULL, true );
168 
169  //set ui event handler
170  m_HudDebugHandler = new HudDebugEventHandler( this );
171  m_WgtRoot.SetHandler( m_HudDebugHandler );
172  }
173 
174  //============================================
175  // Update
176  //============================================
177  override void Update( float timeslice )
178  {
179  for ( int i = 0; i < m_Panels.Count(); ++i )
180  {
181  if ( m_Panels.Get( i ).IsVisible() )
182  {
183  m_Panels.Get( i ).Update();
184  }
185  }
186  }
187 
188  //============================================
189  // SetPanetVisible
190  //============================================
191  void SetPanelVisible(int panel_type, bool visible)
192  {
193  if ( visible )
194  {
195  PanelShow( panel_type );
196  }
197  else
198  {
199  PanelHide( panel_type );
200  }
201  }
202 
203  //============================================
204  // PanelShow
205  //============================================
206  void PanelShow(int panel_type)
207  {
208  for ( int i = 0; i < m_Panels.Count(); ++i )
209  {
210  HudDebugWinBase panel = m_Panels.Get( i );
211 
212  if ( panel.GetType() == panel_type )
213  {
214  panel.Show();
215  }
216  }
217  }
218 
219  //============================================
220  // PanelHide
221  //============================================
222  void PanelHide(int panel_type)
223  {
224  for ( int i = 0; i < m_Panels.Count(); ++i )
225  {
226  HudDebugWinBase panel = m_Panels.Get( i );
227 
228  if ( panel.GetType() == panel_type )
229  {
230  panel.Hide();
231  }
232  }
233  }
234 
235  //============================================
236  // RefreshCrosshairVisibility
237  //============================================
239  {
241 
242  if ( module_cfg_profile )
243  {
244  PluginDeveloper modul_dev = PluginDeveloper.Cast( GetPlugin( PluginDeveloper ) );
245 
246  if ( modul_dev.IsEnabledFreeCamera() )
247  {
248  m_Crosshair.Show( module_cfg_profile.GetFreeCameraCrosshairVisible() );
249  }
250  else
251  {
252  m_Crosshair.Show( false );
253  }
254  }
255  }
256 
257 
258  //============================================
259  // HideCrosshairVisibility
260  //============================================
262  {
264 
265  if ( module_cfg_profile )
266  {
267  PluginDeveloper modul_dev = PluginDeveloper.Cast( GetPlugin( PluginDeveloper ) );
268 
269  if ( modul_dev.IsEnabledFreeCamera() )
270  {
271  m_Crosshair.Show( false );
272  }
273  }
274  }
275 
276  //============================================
277  // RefreshByLocalProfile
278  //============================================
280  {
282 
283  if ( module_cfg_profile )
284  {
285  SetPanelVisible( HudDebug.HUD_WIN_CHAR_STATS, module_cfg_profile.GetCharacterStatsVisible() );
286  SetPanelVisible( HudDebug.HUD_WIN_CHAR_LEVELS, module_cfg_profile.GetCharacterLevelsVisible() );
287  SetPanelVisible( HudDebug.HUD_WIN_CHAR_MODIFIERS, module_cfg_profile.GetCharacterModifiersVisible() );
288  SetPanelVisible( HudDebug.HUD_WIN_CHAR_AGENTS, module_cfg_profile.GetCharacterAgentsVisible() );
289  SetPanelVisible( HudDebug.HUD_WIN_CHAR_DEBUG, module_cfg_profile.GetCharacterDebugVisible() );
290  SetPanelVisible( HudDebug.HUD_WIN_CHAR_STOMACH, module_cfg_profile.GetCharacterStomachVisible() );
291  SetPanelVisible( HudDebug.HUD_WIN_VERSION, module_cfg_profile.GetVersionVisible() );
292  SetPanelVisible( HudDebug.HUD_WIN_TEMPERATURE, module_cfg_profile.GetTempVisible() );
293  }
294  }
295 
296  //============================================
297  // IsInitialized
298  //============================================
300  {
301  if ( m_WgtRoot == NULL )
302  {
303  return false;
304  }
305 
306  return false;
307  }
308 
309  //============================================
310  // OnClick
311  //============================================
312  bool OnClick( Widget w, int x, int y, int button )
313  {
314  //send OnClick to HudDebugWinCharModifiers
315  if ( m_WinCharModifiers )
316  {
317  if (m_WinCharModifiers.OnClick( w, x, y, button ))
318  return true;
319  }
320 
321  if ( m_WinCharAgents )
322  {
323  if (m_WinCharAgents.OnClick( w, x, y, button ))
324  return true;
325  }
326 
327  if ( m_WinCharStats )
328  {
329  if (m_WinCharStats.OnClick( w, x, y, button ))
330  return true;
331  }
332 
333  return false;
334  }
335 
336  bool OnChange(Widget w, int x, int y, bool finished)
337  {
338 
339  if ( m_WinCharStats )
340  {
341  if (m_WinCharStats.OnChange( w, x, y, finished ))
342  return true;
343  }
344  return false;
345  }
346 
347 }
m_WgtRoot
Widget m_WgtRoot
Definition: huddebug.c:92
m_Crosshair
Widget m_Crosshair
Definition: huddebug.c:93
OnClick
bool OnClick(Widget w, int x, int y, int button)
Definition: huddebug.c:312
RefreshByLocalProfile
void RefreshByLocalProfile()
Definition: huddebug.c:279
RefreshCrosshairVisibility
void RefreshCrosshairVisibility()
Definition: huddebug.c:238
PluginConfigDebugProfile
Definition: pluginconfigdebugprofilefixed.c:1
~HudDebug
void ~HudDebug()
Definition: huddebug.c:111
y
Icon y
IsInitialized
bool IsInitialized()
Definition: huddebug.c:299
m_WinCharModifiers
ref HudDebugWinCharModifiers m_WinCharModifiers
Definition: huddebug.c:97
HudDebugWinBase
Definition: huddebugwinbase.c:1
Update
override void Update(float timeslice)
Definition: huddebug.c:177
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition: pluginmanager.c:316
HideCrosshairVisibility
void HideCrosshairVisibility()
Definition: huddebug.c:261
m_WinCharAgents
ref HudDebugWinCharAgents m_WinCharAgents
Definition: huddebug.c:99
PanelHide
void PanelHide(int panel_type)
Definition: huddebug.c:222
OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition: serverbrowsertab.c:235
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition: isboxcollidinggeometryproxyclasses.c:27
HUD_WIN_UNDEFINED
class HudDebugEventHandler extends ScriptedWidgetEventHandler HUD_WIN_UNDEFINED
x
Icon x
OnMouseButtonDown
bool OnMouseButtonDown(Widget w, int x, int y, int button)
Definition: pluginitemdiagnostic.c:117
m_Panels
ref array< ref HudDebugWinBase > m_Panels
Definition: huddebug.c:94
m_WinCharStats
ref HudDebugWinCharStats m_WinCharStats
Definition: huddebug.c:98
HudDebug
void HudDebug()
Definition: huddebug.c:104
m_HudDebugHandler
ref HudDebugEventHandler m_HudDebugHandler
Definition: huddebug.c:96
Timer
Definition: dayzplayerimplement.c:62
OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition: serverbrowsertab.c:217
OnChange
bool OnChange(Widget w, int x, int y, bool finished)
Definition: huddebug.c:336
Widget
Definition: enwidgets.c:189
SetPanelVisible
void SetPanelVisible(int panel_type, bool visible)
Definition: huddebug.c:191
m_TimerUpdate
ref Timer m_TimerUpdate
Definition: huddebug.c:95
PanelShow
void PanelShow(int panel_type)
Definition: huddebug.c:206
ScriptedWidgetEventHandler
map: item x vector(index, width, height)
Definition: enwidgets.c:650
Init
override void Init(Widget hud_panel_widget)
Definition: huddebug.c:120
HudDebugWinCharAgents
void HudDebugWinCharAgents(Widget widget_root)
Definition: huddebugwincharagents.c:32
Hud
Definition: gameplay.c:623
HudDebugWinCharModifiers
void HudDebugWinCharModifiers(Widget widget_root)
Definition: huddebugwincharmodifiers.c:38