DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
HudDebug.c
Go to the documentation of this file.
1// *************************************************************************************
2// ! PluginDayzPlayerDebugUI
3// *************************************************************************************
4class HudDebugEventHandler extends ScriptedWidgetEventHandler
5{
7
8 void HudDebugEventHandler( HudDebug hud_debug )
9 {
10 m_HudDebug = hud_debug;
11 }
12
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
80class 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 //============================================
112 {
113 delete m_WgtRoot;
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" ) );
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}
ref Timer m_TimerUpdate
Definition ClockBase.c:15
override bool IsInitialized()
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Definition DayZGame.c:146
void RefreshCrosshairVisibility()
Definition HudDebug.c:238
static const int HUD_WIN_CHAR_MODIFIERS
Definition HudDebug.c:84
void SetPanelVisible(int panel_type, bool visible)
Definition HudDebug.c:191
static const int HUD_WIN_CHAR_AGENTS
Definition HudDebug.c:85
void PanelHide(int panel_type)
Definition HudDebug.c:222
void RefreshByLocalProfile()
Definition HudDebug.c:279
ref HudDebugWinCharAgents m_WinCharAgents
Definition HudDebug.c:99
static const int HUD_WIN_CHAR_LEVELS
Definition HudDebug.c:87
Widget m_Crosshair
Definition HudDebug.c:93
ref HudDebugEventHandler m_HudDebugHandler
Definition HudDebug.c:96
ref HudDebugWinCharStats m_WinCharStats
Definition HudDebug.c:98
static const int HUD_WIN_CHAR_DEBUG
Definition HudDebug.c:86
static const int HUD_WIN_CHAR_STATS
Definition HudDebug.c:83
static const int HUD_WIN_CHAR_STOMACH
Definition HudDebug.c:88
void ~HudDebug()
Definition HudDebug.c:111
static const int HUD_WIN_TEMPERATURE
Definition HudDebug.c:90
static const int HUD_WIN_VERSION
Definition HudDebug.c:89
void PanelShow(int panel_type)
Definition HudDebug.c:206
ref HudDebugWinCharModifiers m_WinCharModifiers
Definition HudDebug.c:97
class HudDebugEventHandler extends ScriptedWidgetEventHandler HUD_WIN_UNDEFINED
void HideCrosshairVisibility()
Definition HudDebug.c:261
void HudDebug()
Definition HudDebug.c:104
Widget m_WgtRoot
Definition HudDebug.c:92
void HudDebugWinCharAgents(Widget widget_root)
void HudDebugWinCharModifiers(Widget widget_root)
Icon x
Icon y
static ref set< Land_Underground_Panel > m_Panels
override bool OnChange(Widget w, int x, int y, bool finished)
PluginBase GetPlugin(typename plugin_type)
static void Init()
map: item x vector(index, width, height)
Definition EnWidgets.c:538
override bool OnChange(Widget w, int x, int y, bool finished)
Definition HudDebug.c:72
override bool OnSelect(Widget w, int x, int y)
Definition HudDebug.c:55
void HudDebugEventHandler(HudDebug hud_debug)
Definition HudDebug.c:8
override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
Definition HudDebug.c:60
override bool OnModalResult(Widget w, int x, int y, int code, int result)
Definition HudDebug.c:66
override bool OnFocusLost(Widget w, int x, int y)
Definition HudDebug.c:30
override bool OnMouseButtonDown(Widget w, int x, int y, int button)
Definition HudDebug.c:48
override bool OnFocus(Widget w, int x, int y)
Definition HudDebug.c:24
override bool OnClick(Widget w, int x, int y, int button)
Definition HudDebug.c:18
override void Stop()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native volatile void Update()