Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл PluginDayZInfectedDebug.c

См. исходные тексты.

Структуры данных

class  ScriptedWidgetEventHandler
 map: item x vector(index, width, height) Подробнее...
 
class  PluginBase
 

Функции

class PluginDayZInfectedDebugUIHandler extends ScriptedWidgetEventHandler PluginDayZInfectedDebugAttackDesc (string pName, int pValue)
 
override bool OnClick (Widget w, int x, int y, int button)
 
override bool OnChange (Widget w, int x, int y, bool finished)
 

Переменные

PluginDayZInfectedDebug m_pPluginInfectedDebug
 
string name
 
int animValue
 

Функции

◆ OnChange()

bool OnChange ( Widget w,
int x,
int y,
bool finished )
40{
41 int m_CurrentMode = 0;
42 bool m_HasFocus = false;
43 bool m_IsActive = false;
44
47 ButtonWidget m_SpawnEntityButton;
48 ButtonWidget m_CardMovementButton;
49 ButtonWidget m_CardFightButton;
50 Widget m_CardMovementFrame;
51 Widget m_CardFightFrame;
52 TextWidget m_StatusText;
53
55 XComboBoxWidget m_StanceCB;
56 XComboBoxWidget m_MindStateCB;
57 EditBoxWidget m_MovementSpeedEB;
58
59 ButtonWidget m_StartTurnButton;
60 XComboBoxWidget m_TurnTypeCB;
61 EditBoxWidget m_TurnDirectionEB;
62
63 XComboBoxWidget m_VaultingCB;
64 ButtonWidget m_StartVaultButton;
65 ButtonWidget m_KnucleOutButton;
66
67 XComboBoxWidget m_CrawlingTypeCB;
68 ButtonWidget m_StartCrawlingButton;
69
71 EditBoxWidget m_HitDirEB;
72 XComboBoxWidget m_HitTypeCB;
73 XComboBoxWidget m_HitBodyPartCB;
74 ButtonWidget m_StartHitButton;
75
76 XComboBoxWidget m_DeathTypeCB;
77 ButtonWidget m_StartDeathButton;
78
79 XComboBoxWidget m_AttackTypeCB;
80 XComboBoxWidget m_AttackDirCB;
81 ButtonWidget m_StartAttackButton;
82
84 DayZInfected m_ControlledInfected;
85
87 bool m_CH_DoTurn = false;
88 bool m_CH_DoVault = false;
89 bool m_CH_DoKnucleOut = false;
90 bool m_CH_GoToCrawl = false;
91 bool m_CH_DoHit = false;
92 bool m_CH_StartDeath = false;
93 bool m_CH_DoAttack = false;
94
97
98 private ref array<Shape> m_DebugShapes = new array<Shape>();
99
102
103 void PluginDayZInfectedDebug()
104 {
105 #ifndef NO_GUI
107 #endif
108 }
109
110 void ~PluginDayZInfectedDebug()
111 {
112 #ifndef NO_GUI
114 #endif
115 }
116
119 {
121 if (m_CurrentMode > 2)
122 {
123 m_CurrentMode = 0;
124 }
125
127 }
128
131 {
132 switch (pMode)
133 {
134 case 0: Hide(); ReleaseFocus(); CleanupDebugShapes(m_DebugShapes); break;
135 case 1: Show(); ReleaseFocus(); break;
136 case 2: Show(); CaptureFocus(); break;
137 }
138 }
139
141 void CaptureFocus()
142 {
143 if (!m_HasFocus)
144 {
145 GetGame().GetInput().ChangeGameFocus(1);
146 GetGame().GetUIManager().ShowUICursor(true);
147 m_HasFocus = true;
148 }
149 }
150
152 void ReleaseFocus()
153 {
154 if (m_HasFocus)
155 {
156 GetGame().GetInput().ChangeGameFocus(-1);
157 GetGame().GetUIManager().ShowUICursor(false);
158 m_HasFocus = false;
159 }
160 }
161
163 void Show()
164 {
165 ShowWidgets(true);
166 m_IsActive = true;
167
168 GetUApi().ActivateExclude("menu");
169 GetUApi().UpdateControls();
170
171 if (!m_TickTimer)
172 {
173 m_TickTimer = new Timer();
174 m_TickTimer.Run(0.1, this, "Tick", NULL, true);
175 }
176 }
177
179 void Hide()
180 {
181 ShowWidgets(false);
182 m_IsActive = false;
183
184 GetUApi().UpdateControls();
185
187 }
188
190 void ShowWidgets(bool show)
191 {
192 if(m_MainWnd)
193 {
194 m_MainWnd.Show(show);
195 }
196 }
197
198 override void OnUpdate(float delta_time)
199 {
200 super.OnUpdate(delta_time);
201
202 CleanupDebugShapes(m_DebugShapes);
203
204 if (m_IsActive)
205 {
206 if (!m_ControlledInfected)
207 return;
208
209 m_DebugShapes.Insert(Debug.DrawSphere(m_ControlledInfected.GetPosition() + "0 2 0", 0.25, FadeColors.RED));
210 }
211 }
212
215 {
216 if (!m_pUIHandler)
217 {
219 m_pUIHandler.m_pPluginInfectedDebug = this;
220 }
221
222 if (!m_MainWnd)
223 {
224 m_MainWnd = GetGame().GetWorkspace().CreateWidgets("gui/layouts/debug/day_z_infecteddebug.layout");
225 m_MainWnd.SetHandler(m_pUIHandler);
226 m_MainWnd.Show(false);
227 }
228
230 m_SpawnEntityButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("SpawnEntityButton") );
231 m_CardMovementButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("CardMovementButton") );
232 m_CardFightButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("CardFightButton") );
233 m_CardMovementFrame = m_MainWnd.FindAnyWidget("CardMovementFrame");
234 m_CardFightFrame = m_MainWnd.FindAnyWidget("CardFightFrame");
235 m_StatusText = TextWidget.Cast( m_MainWnd.FindAnyWidget("StatusText") );
236
238 m_StanceCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("StanceCB") );
239 m_MindStateCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("MindStateCB") );
240 m_MovementSpeedEB = EditBoxWidget.Cast( m_MainWnd.FindAnyWidget("MovementSpeedEB") );
241
242 m_StartTurnButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("StartTurnButton") );
243 m_TurnTypeCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("TurnTypeCB") );
244 m_TurnDirectionEB = EditBoxWidget.Cast( m_MainWnd.FindAnyWidget("TurnDirectionEB") );
245
246 m_VaultingCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("TurnTypeCB") );
247 m_StartVaultButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("StartVaultButton") );
248 m_KnucleOutButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("KnucleOutButton") );
249
250 m_CrawlingTypeCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("TurnTypeCB") );
251 m_StartCrawlingButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("StartCrawlingButton") );
252
254 m_HitDirEB = EditBoxWidget.Cast( m_MainWnd.FindAnyWidget("HitDirEB") );
255 m_HitTypeCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("HitTypeCB") );
256 m_HitBodyPartCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("HitBodyPartCB") );
257 m_StartHitButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("StartHitButton") );
258
259 m_DeathTypeCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("DeathTypeCB") );
260 m_StartDeathButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("StartDeathButton") );
261
262 m_AttackTypeCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("AttackTypeCB") );
263 m_AttackDirCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("AttackDirCB") );
264 m_StartAttackButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("StartAttackButton") );
265
267 InitAttacks();
268
269 ShowCard(0);
270 }
271
274 {
275 delete m_MainWnd;
276 }
277
279 void ShowCard(int pCard)
280 {
281 m_CardMovementFrame.Show(pCard == 0);
282 m_CardFightFrame.Show(pCard == 1);
283 }
284
286 bool OnClick(Widget w, int x, int y, int button)
287 {
288 if (w == m_SpawnEntityButton)
289 {
290 ResetValues();
291 SpawnNewInfectedEntity();
292 return true;
293 }
294
295 if (w == m_CardMovementButton)
296 {
297 ShowCard(0);
298 return true;
299 }
300 else if (w == m_CardFightButton)
301 {
302 ShowCard(1);
303 return true;
304 }
305 else if (w == m_StartTurnButton)
306 {
307 m_CH_DoTurn = true;
308 return true;
309 }
310 else if (w == m_StartVaultButton)
311 {
312 m_CH_DoVault = true;
313 return true;
314 }
315 else if (w == m_KnucleOutButton)
316 {
317 m_CH_DoKnucleOut = true;
318 return true;
319 }
320 else if (w == m_StartCrawlingButton)
321 {
322 m_CH_GoToCrawl = true;
323 return true;
324 }
325 else if (w == m_StartHitButton)
326 {
327 m_CH_DoHit = true;
328 return true;
329 }
330 else if (w == m_StartDeathButton)
331 {
332 m_CH_StartDeath = true;
333 return true;
334 }
335 else if (w == m_StartAttackButton)
336 {
337 m_CH_DoAttack = true;
338 return true;
339 }
340
341 return false;
342 }
343
345 bool OnChange(Widget w, int x, int y, bool finished)
346 {
347 return false;
348 }
349
351 void ResetValues()
352 {
353 m_CH_DoTurn = false;
354 m_CH_DoVault = false;
355 m_CH_DoKnucleOut = false;
356 m_CH_GoToCrawl = false;
357 m_CH_DoHit = false;
358 m_CH_StartDeath = false;
359 m_CH_DoAttack = false;
360 m_MovementSpeedEB.SetText("0");
361 m_MainWnd.Update();
362 }
363
365 void SpawnNewInfectedEntity()
366 {
367 m_ControlledInfected = DayZInfected.Cast(GetGame().CreateObjectEx("ZmbF_JournalistNormal_Blue", GetGame().GetPlayer().GetPosition(), ECE_PLACE_ON_SURFACE|ECE_INITAI|ECE_EQUIP_ATTACHMENTS));
368 m_ControlledInfected.GetAIAgent().SetKeepInIdle(true);
369 }
370
371 protected void PossesInfected()
372 {
373 ResetValues();
374 FreeDebugCamera.GetInstance().SetActive(true);
375 m_ControlledInfected = DayZInfected.Cast(FreeDebugCamera.GetInstance().GetCrosshairObject());
376 FreeDebugCamera.GetInstance().SetActive(false);
377 }
378
381 {
382 if( infected != m_ControlledInfected )
383 return;
384
385 infected.GetInputController().OverrideMovementSpeed(true, m_MovementSpeedEB.GetText().ToFloat());
386
387 DayZInfectedCommandMove moveCommand = infected.GetCommand_Move();
388 if( moveCommand )
389 {
390 moveCommand.SetStanceVariation(m_StanceCB.GetCurrentItem());
391 moveCommand.SetIdleState(m_MindStateCB.GetCurrentItem());
392 }
393
394 if( m_CH_DoTurn )
395 {
396 moveCommand.StartTurn(m_TurnDirectionEB.GetText().ToFloat(), m_TurnTypeCB.GetCurrentItem());
397 m_CH_DoTurn = false;
398 }
399 if( m_CH_DoVault )
400 {
401 infected.StartCommand_Vault(m_VaultingCB.GetCurrentItem());
402 m_CH_DoVault = false;
403 }
404 if( m_CH_DoKnucleOut )
405 {
406 infected.StartCommand_Vault(-1);
407 m_CH_DoKnucleOut = false;
408 }
409 if( m_CH_GoToCrawl )
410 {
411 infected.StartCommand_Crawl(m_CrawlingTypeCB.GetCurrentItem());
412 m_CH_GoToCrawl = false;
413 }
414 if( m_CH_DoHit )
415 {
416 float hitDir = m_HitDirEB.GetText().ToFloat();
417 int bodyPart = m_HitBodyPartCB.GetCurrentItem();
418 bool heavyHit = m_HitTypeCB.GetCurrentItem() == 1;
419
420 infected.StartCommand_Hit(heavyHit, bodyPart, hitDir);
421
422 m_CH_DoHit = false;
423 }
424 if( m_CH_StartDeath )
425 {
426 int deathType = m_DeathTypeCB.GetCurrentItem();
427 float deathDir = m_HitDirEB.GetText().ToFloat();
428
429 infected.StartCommand_Death(deathType, deathDir);
430
431 m_CH_StartDeath = false;
432 }
433 if( m_CH_DoAttack )
434 {
435 float attackDir = m_AttackDirCB.GetCurrentItem();
436 int attackType = m_AttackDescriptors.Get(m_AttackTypeCB.GetCurrentItem()).animValue;
437
438 infected.StartCommand_Attack(null, attackType, attackDir);
439
440 m_CH_DoAttack = false;
441 }
442 }
443
445 void Tick()
446 {
447 if( !m_ControlledInfected )
448 return;
449
450 }
451
453 void InitAttacks()
454 {
455 m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Attack Left Light", 0));
456 m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Attack Right Light", 1));
457 m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Attack Left Heavy", 2));
458 m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Attack Right Heavy", 3));
459
460 m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Crawl Attack", 7));
461 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Crawl Attack Combo", 8));
462
463 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door Push Attack", 9));
464 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door Head Attack", 10));
465 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door Shoulder Attack", 11));
466 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door LR Attack", 12));
467 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door Kick Attack", 13));
468 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door Charge R", 14));
469 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door Charge L", 15));
470
471 for( int i = 0; i < m_AttackDescriptors.Count(); ++i )
472 {
473 m_AttackTypeCB.AddItem(m_AttackDescriptors.Get(i).name);
474 }
475 }
476
477 private void CleanupDebugShapes(array<Shape> shapesArr)
478 {
479 for ( int it = 0; it < shapesArr.Count(); ++it )
480 {
482 }
483
484 shapesArr.Clear();
485 }
486}
487
const int ECE_EQUIP_ATTACHMENTS
Definition CentralEconomy.c:20
const int ECE_PLACE_ON_SURFACE
Definition CentralEconomy.c:37
const int ECE_INITAI
Definition CentralEconomy.c:17
void Hide()
Definition DayZGame.c:165
void Show()
Definition DayZGame.c:157
Icon x
Icon y
bool m_IsActive
Definition ModifierBase.c:20
PlayerBase GetPlayer()
Definition ModifierBase.c:47
ref Timer m_TickTimer
Definition PluginDayZCreatureAIDebug.c:86
class PluginDayZInfectedDebugUIHandler extends ScriptedWidgetEventHandler PluginDayZInfectedDebugAttackDesc(string pName, int pValue)
Definition PluginDayZInfectedDebug.c:26
override bool OnChange(Widget w, int x, int y, bool finished)
Definition PluginDayZInfectedDebug.c:33
override bool OnClick(Widget w, int x, int y, int button)
Definition PluginDayZInfectedDebug.c:27
void ShowWidgets(bool show)
Definition PluginDayzPlayerDebug.c:332
void ShowCard(int pCard)
Definition PluginDayzPlayerDebug.c:530
void ToggleDebugWindowSetMode(int pMode)
Definition PluginDayzPlayerDebug.c:438
Widget m_MainWnd
Definition PluginDayzPlayerDebug.c:206
int m_CurrentMode
Definition PluginDayzPlayerDebug.c:384
ref PluginDayzPlayerDebugUIHandler m_pUIHandler
Definition PluginDayzPlayerDebug.c:256
void ToggleDebugWindowEvent()
Definition PluginDayzPlayerDebug.c:387
bool m_HasFocus
Definition PluginDayzPlayerDebug.c:203
void ReleaseFocus()
Definition PluginDayzPlayerDebug.c:374
void CommandHandler()
Definition PluginDayzPlayerDebug.c:1051
void DestroyModuleWidgets()
Definition PluginDayzPlayerDebug.c:524
void CreateModuleWidgets()
Definition PluginDayzPlayerDebug.c:448
void CaptureFocus()
Definition PluginDayzPlayerDebug.c:363
void Tick()
Definition SoundEvents.c:107
proto native UAInputAPI GetUApi()
class JsonUndergroundAreaTriggerData GetPosition
Definition UndergroundAreaLoader.c:9
Definition DayZInfectedImplement.c:1
Definition ZombieBase.c:2
Definition Debug.c:14
static void RemoveShape(out Shape shape)
Definition Debug.c:110
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
Definition Debug.c:485
Definition EnWidgets.c:354
Definition EntityAI.c:95
Definition EnWidgets.c:220
Definition DayZPlayerImplement.c:63
Definition EnWidgets.c:190
proto native CGame GetGame()
proto native void OnUpdate()
Definition tools.c:349

◆ OnClick()

override bool OnClick ( Widget w,
int x,
int y,
int button )
27 {
28 name = pName;
30 }
31
string name
Definition PluginDayZInfectedDebug.c:32
int animValue
Definition PluginDayZInfectedDebug.c:33

Перекрестные ссылки animValue и name.

◆ PluginDayZInfectedDebugAttackDesc()

class PluginDayZInfectedDebugUIHandler extends ScriptedWidgetEventHandler PluginDayZInfectedDebugAttackDesc ( string pName,
int pValue )
27 {
28 name = pName;
30 }

Используется в PluginBase::InitAttacks().

Переменные

◆ animValue

int animValue

Используется в OnClick().

◆ m_pPluginInfectedDebug

PluginDayZInfectedDebug m_pPluginInfectedDebug

◆ name

string name