DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
PluginDayZInfectedDebug.c
См. документацию.
1// *************************************************************************************
2// ! PluginDayZInfectedDebugUIHandler
3// *************************************************************************************
4class PluginDayZInfectedDebugUIHandler extends ScriptedWidgetEventHandler
5{
6 override bool OnClick(Widget w, int x, int y, int button)
7 {
8 super.OnClick(w, x, y, button);
9 return m_pPluginInfectedDebug.OnClick(w, x, y, button);
10 }
11
12 override bool OnChange(Widget w, int x, int y, bool finished)
13 {
14 super.OnChange(w, x, y, finished);
15 return m_pPluginInfectedDebug.OnChange(w, x, y, finished);
16 }
17
18 PluginDayZInfectedDebug m_pPluginInfectedDebug;
19}
20
21// *************************************************************************************
22// ! PluginDayZInfectedDebugAttackDesc
23// *************************************************************************************
25{
26 void PluginDayZInfectedDebugAttackDesc(string pName, int pValue)
27 {
28 name = pName;
29 animValue = pValue;
30 }
31
32 string name;
34}
35
36// *************************************************************************************
37// ! PluginDayZInfectedDebug
38// *************************************************************************************
39class PluginDayZInfectedDebug extends PluginBase
40{
42 bool m_HasFocus = false;
43 bool m_IsActive = false;
44
47 ButtonWidget m_SpawnEntityButton;
49 ButtonWidget m_CardFightButton;
53
55 XComboBoxWidget m_StanceCB;
56 XComboBoxWidget m_MindStateCB;
58
59 ButtonWidget m_StartTurnButton;
60 XComboBoxWidget m_TurnTypeCB;
62
63 XComboBoxWidget m_VaultingCB;
64 ButtonWidget m_StartVaultButton;
65 ButtonWidget m_KnucleOutButton;
66
67 XComboBoxWidget m_CrawlingTypeCB;
69
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
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
95 ref PluginDayZInfectedDebugUIHandler m_pUIHandler;
97
99
102
104 {
105 #ifndef NO_GUI
107 #endif
108 }
109
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 {
135 case 1: Show(); ReleaseFocus(); break;
136 case 2: Show(); CaptureFocus(); break;
137 }
138 }
139
142 {
143 if (!m_HasFocus)
144 {
147 m_HasFocus = true;
148 }
149 }
150
153 {
154 if (m_HasFocus)
155 {
158 m_HasFocus = false;
159 }
160 }
161
163 void Show()
164 {
165 ShowWidgets(true);
166 m_IsActive = true;
167
168 GetUApi().ActivateExclude("menu");
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
185
186 m_TickTimer = NULL;
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
203
204 if (m_IsActive)
205 {
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 {
218 m_pUIHandler = new PluginDayZInfectedDebugUIHandler();
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();
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
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
366 {
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 {
448 return;
449
450 }
451
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 {
481 Debug.RemoveShape( shapesArr[it] );
482 }
483
484 shapesArr.Clear();
485 }
486}
487
const int ECE_EQUIP_ATTACHMENTS
Определения CentralEconomy.c:20
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
const int ECE_INITAI
Определения CentralEconomy.c:17
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Icon x
Icon y
PlayerBase GetPlayer()
Определения ModifierBase.c:51
int animValue
Определения PluginDayZInfectedDebug.c:33
class PluginDayZInfectedDebugUIHandler extends ScriptedWidgetEventHandler PluginDayZInfectedDebugAttackDesc(string pName, int pValue)
Определения PluginDayZInfectedDebug.c:26
proto native UAInputAPI GetUApi()
proto native UIManager GetUIManager()
proto native WorkspaceWidget GetWorkspace()
proto native Input GetInput()
Определения ZombieBase.c:2
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
Определения Debug.c:319
static void RemoveShape(out Shape shape)
Определения Debug.c:96
Определения Debug.c:2
Определения EnWidgets.c:354
proto native void ChangeGameFocus(int add, int input_device=-1)
Change game focus number.
void CaptureFocus()
Определения PluginDayZInfectedDebug.c:141
void CommandHandler(DayZInfected infected)
Определения PluginDayZInfectedDebug.c:380
int m_CurrentMode
Определения PluginDayZInfectedDebug.c:41
ButtonWidget m_StartHitButton
Определения PluginDayZInfectedDebug.c:74
EditBoxWidget m_TurnDirectionEB
Определения PluginDayZInfectedDebug.c:61
TextWidget m_StatusText
Определения PluginDayZInfectedDebug.c:52
bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Определения PluginDayZInfectedDebug.c:286
XComboBoxWidget m_HitTypeCB
Определения PluginDayZInfectedDebug.c:72
XComboBoxWidget m_DeathTypeCB
Определения PluginDayZInfectedDebug.c:76
ButtonWidget m_CardMovementButton
Определения PluginDayZInfectedDebug.c:48
ButtonWidget m_CardFightButton
Определения PluginDayZInfectedDebug.c:49
ref PluginDayZInfectedDebugUIHandler m_pUIHandler
Определения PluginDayZInfectedDebug.c:95
bool m_CH_StartDeath
Определения PluginDayZInfectedDebug.c:92
void ToggleDebugWindowEvent()
Определения PluginDayZInfectedDebug.c:118
Widget m_CardFightFrame
Определения PluginDayZInfectedDebug.c:51
void ShowWidgets(bool show)
Определения PluginDayZInfectedDebug.c:190
ButtonWidget m_SpawnEntityButton
Определения PluginDayZInfectedDebug.c:47
ref array< ref PluginDayZInfectedDebugAttackDesc > m_AttackDescriptors
Определения PluginDayZInfectedDebug.c:96
void ~PluginDayZInfectedDebug()
Определения PluginDayZInfectedDebug.c:110
bool OnChange(Widget w, int x, int y, bool finished)
Определения PluginDayZInfectedDebug.c:345
XComboBoxWidget m_VaultingCB
Определения PluginDayZInfectedDebug.c:63
ButtonWidget m_KnucleOutButton
Определения PluginDayZInfectedDebug.c:65
XComboBoxWidget m_HitBodyPartCB
Определения PluginDayZInfectedDebug.c:73
XComboBoxWidget m_AttackDirCB
Определения PluginDayZInfectedDebug.c:80
bool m_CH_DoAttack
Определения PluginDayZInfectedDebug.c:93
void PluginDayZInfectedDebug()
Определения PluginDayZInfectedDebug.c:103
Widget m_MainWnd
main controls
Определения PluginDayZInfectedDebug.c:46
void CreateModuleWidgets()
Определения PluginDayZInfectedDebug.c:214
void ResetValues()
Определения PluginDayZInfectedDebug.c:351
bool m_IsActive
Определения PluginDayZInfectedDebug.c:43
XComboBoxWidget m_TurnTypeCB
Определения PluginDayZInfectedDebug.c:60
void InitAttacks()
Определения PluginDayZInfectedDebug.c:453
ButtonWidget m_StartTurnButton
Определения PluginDayZInfectedDebug.c:59
ButtonWidget m_StartCrawlingButton
Определения PluginDayZInfectedDebug.c:68
void ToggleDebugWindowSetMode(int pMode)
Определения PluginDayZInfectedDebug.c:130
void PossesInfected()
Определения PluginDayZInfectedDebug.c:371
EditBoxWidget m_HitDirEB
fight card
Определения PluginDayZInfectedDebug.c:71
ButtonWidget m_StartDeathButton
Определения PluginDayZInfectedDebug.c:77
bool m_CH_DoHit
Определения PluginDayZInfectedDebug.c:91
XComboBoxWidget m_StanceCB
movement card
Определения PluginDayZInfectedDebug.c:55
void SpawnNewInfectedEntity()
Определения PluginDayZInfectedDebug.c:365
void Hide()
Определения PluginDayZInfectedDebug.c:179
ButtonWidget m_StartVaultButton
Определения PluginDayZInfectedDebug.c:64
XComboBoxWidget m_AttackTypeCB
Определения PluginDayZInfectedDebug.c:79
ButtonWidget m_StartAttackButton
Определения PluginDayZInfectedDebug.c:81
EditBoxWidget m_MovementSpeedEB
Определения PluginDayZInfectedDebug.c:57
DayZInfected m_ControlledInfected
controlled instance
Определения PluginDayZInfectedDebug.c:84
void ShowCard(int pCard)
Определения PluginDayZInfectedDebug.c:279
bool m_CH_DoVault
Определения PluginDayZInfectedDebug.c:88
bool m_CH_DoKnucleOut
Определения PluginDayZInfectedDebug.c:89
ref array< Shape > m_DebugShapes
Определения PluginDayZInfectedDebug.c:98
ref Timer m_TickTimer
status refresh timer
Определения PluginDayZInfectedDebug.c:101
bool m_CH_GoToCrawl
Определения PluginDayZInfectedDebug.c:90
void DestroyModuleWidgets()
Определения PluginDayZInfectedDebug.c:273
void ReleaseFocus()
Определения PluginDayZInfectedDebug.c:152
override void OnUpdate(float delta_time)
Определения PluginDayZInfectedDebug.c:198
bool m_CH_DoTurn
command handler values
Определения PluginDayZInfectedDebug.c:87
XComboBoxWidget m_CrawlingTypeCB
Определения PluginDayZInfectedDebug.c:67
void Tick()
Определения PluginDayZInfectedDebug.c:445
void Show()
Определения PluginDayZInfectedDebug.c:163
Widget m_CardMovementFrame
Определения PluginDayZInfectedDebug.c:50
bool m_HasFocus
Определения PluginDayZInfectedDebug.c:42
XComboBoxWidget m_MindStateCB
Определения PluginDayZInfectedDebug.c:56
void CleanupDebugShapes(array< Shape > shapesArr)
Определения PluginDayZInfectedDebug.c:477
Определения PluginBase.c:2
override bool OnChange(Widget w, int x, int y, bool finished)
Определения PluginDayZInfectedDebug.c:12
override bool OnClick(Widget w, int x, int y, int button)
Определения PluginDayZInfectedDebug.c:6
PluginDayZInfectedDebug m_pPluginInfectedDebug
Определения PluginDayZInfectedDebug.c:18
map: item x vector(index, width, height)
Определения EnWidgets.c:651
Определения EnWidgets.c:220
Определения DayZPlayerImplement.c:63
proto native void UpdateControls()
proto native void ActivateExclude(string sExcludeName)
void ShowUICursor(bool visible)
Определения UIManager.c:244
Определения EnWidgets.c:190
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.