DayZ 1.24
Loading...
Searching...
No Matches
HudDebug.c
Go to the documentation of this file.
1// *************************************************************************************
2// ! PluginDayzPlayerDebugUI
3// *************************************************************************************
4class HudDebugEventHandler extends ScriptedWidgetEventHandler
5{
7
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;
114 m_TimerUpdate.Stop();
115 }
116
117 //============================================
118 // Init
119 //============================================
121 {
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"));
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"));
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"));
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 m_Panels.Get(i).Update();
183 }
184 }
185
186 //============================================
187 // SetPanetVisible
188 //============================================
190 {
191 if (visible)
193 else
195 }
196
197 //============================================
198 // PanelShow
199 //============================================
201 {
202 for (int i = 0; i < m_Panels.Count(); ++i)
203 {
205
206 if (panel.GetType() == panel_type)
207 panel.Show();
208 }
209 }
210
211 //============================================
212 // PanelHide
213 //============================================
215 {
216 for (int i = 0; i < m_Panels.Count(); ++i)
217 {
219
220 if (panel.GetType() == panel_type)
221 panel.Hide();
222 }
223 }
224
225 //============================================
226 // RefreshCrosshairVisibility
227 //============================================
229 {
231
233 {
234 PluginDeveloper modul_dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
235
236 if (modul_dev.IsEnabledFreeCamera())
237 m_Crosshair.Show(module_cfg_profile.GetFreeCameraCrosshairVisible());
238 else
239 m_Crosshair.Show(false);
240 }
241 }
242
243
244 //============================================
245 // HideCrosshairVisibility
246 //============================================
248 {
250
252 {
253 PluginDeveloper modul_dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
254
255 if (modul_dev.IsEnabledFreeCamera())
256 m_Crosshair.Show(false);
257 }
258 }
259
260 //============================================
261 // RefreshByLocalProfile
262 //============================================
264 {
266
268 {
269 SetPanelVisible(HudDebug.HUD_WIN_CHAR_STATS, module_cfg_profile.GetCharacterStatsVisible());
270 SetPanelVisible(HudDebug.HUD_WIN_CHAR_LEVELS, module_cfg_profile.GetCharacterLevelsVisible());
271 SetPanelVisible(HudDebug.HUD_WIN_CHAR_MODIFIERS, module_cfg_profile.GetCharacterModifiersVisible());
272 SetPanelVisible(HudDebug.HUD_WIN_CHAR_AGENTS, module_cfg_profile.GetCharacterAgentsVisible());
273 SetPanelVisible(HudDebug.HUD_WIN_CHAR_DEBUG, module_cfg_profile.GetCharacterDebugVisible());
274 SetPanelVisible(HudDebug.HUD_WIN_CHAR_STOMACH, module_cfg_profile.GetCharacterStomachVisible());
275 SetPanelVisible(HudDebug.HUD_WIN_VERSION, module_cfg_profile.GetVersionVisible());
276 SetPanelVisible(HudDebug.HUD_WIN_TEMPERATURE, module_cfg_profile.GetTempVisible());
277 }
278 }
279
280 //============================================
281 // IsInitialized
282 //============================================
284 {
285 if (m_WgtRoot == NULL)
286 return false;
287
288 return false;
289 }
290
291 //============================================
292 // OnClick
293 //============================================
294 bool OnClick(Widget w, int x, int y, int button)
295 {
296 //send OnClick to HudDebugWinCharModifiers
298 {
299 if (m_WinCharModifiers.OnClick(w, x, y, button))
300 return true;
301 }
302
303 if (m_WinCharAgents)
304 {
305 if (m_WinCharAgents.OnClick(w, x, y, button))
306 return true;
307 }
308
309 if (m_WinCharStats)
310 {
311 if (m_WinCharStats.OnClick(w, x, y, button))
312 return true;
313 }
314
315 return false;
316 }
317
318 bool OnChange(Widget w, int x, int y, bool finished)
319 {
320
321 if (m_WinCharStats)
322 {
323 if (m_WinCharStats.OnChange(w, x, y, finished))
324 return true;
325 }
326 return false;
327 }
328
329}
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:144
void RefreshCrosshairVisibility()
Definition HudDebug.c:228
static const int HUD_WIN_CHAR_MODIFIERS
Definition HudDebug.c:84
void SetPanelVisible(int panel_type, bool visible)
Definition HudDebug.c:189
static const int HUD_WIN_CHAR_AGENTS
Definition HudDebug.c:85
void PanelHide(int panel_type)
Definition HudDebug.c:214
void RefreshByLocalProfile()
Definition HudDebug.c:263
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:200
ref HudDebugWinCharModifiers m_WinCharModifiers
Definition HudDebug.c:97
class HudDebugEventHandler extends ScriptedWidgetEventHandler HUD_WIN_UNDEFINED
void HideCrosshairVisibility()
Definition HudDebug.c:247
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:651
override bool OnFocusLost(Widget w, int x, int y)
Definition HudDebug.c:30
override bool OnChange(Widget w, int x, int y, bool finished)
Definition HudDebug.c:72
void HudDebugEventHandler(HudDebug hud_debug)
Definition HudDebug.c:8
override bool OnClick(Widget w, int x, int y, int button)
Definition HudDebug.c:18
override bool OnSelect(Widget w, int x, int y)
Definition HudDebug.c:55
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 OnFocus(Widget w, int x, int y)
Definition HudDebug.c:24
override bool OnMouseButtonDown(Widget w, int x, int y, int button)
Definition HudDebug.c:48
proto native volatile void Update()