Dayz Explorer 1.29.162510
Loading...
Searching...
No Matches
missiongameplay.c
Go to the documentation of this file.
1class MissionGameplay extends MissionBase
2{
3 int m_LifeState;
4 bool m_Initialized;
5
7
9 ImageWidget m_MicrophoneIcon;
10
14 ref IngameHud m_Hud;
16 ref LogoutMenu m_Logout;
19
21
22 protected ref GameplayEffectWidgets m_EffectWidgets;
23
25 ref WidgetFadeTimer m_ChatChannelFadeTimer;
26 ref WidgetFadeTimer m_MicFadeTimer;
27
30 NoteMenu m_Note;
31
32 protected ref Timer m_ToggleHudTimer;
33 protected const int HOLD_LIMIT_TIME = 300; //ms
34 protected int m_ActionDownTime;
35 protected int m_ActionUpTime;
36 protected bool m_InitOnce;
37 protected bool m_ControlDisabled; //DEPRECATED; disabled mode stored below
38 protected int m_ControlDisabledMode;
39 protected ref array<string> m_ActiveInputExcludeGroups; //exclude groups defined in 'specific.xml' file
40 protected ref array<int> m_ActiveInputRestrictions; //additional scripted restrictions
41 protected bool m_ProcessInputExcludes;
42 protected bool m_QuickbarHold;
43 protected bool m_PlayerRespawning;
44 protected int m_RespawnModeClient; //for client-side usage
45 protected bool m_PauseQueued;
46
47 // von control info
48 protected bool m_VoNActive;
49 protected Widget m_VoiceLevels;
52
53 protected bool m_InputBufferFull;
55
56 private float m_ExitButtonDisabledRemainingTime;
57
58 void MissionGameplay()
59 {
61 m_Initialized = false;
62 m_EffectWidgets = new GameplayEffectWidgets;
63 m_HudRootWidget = null;
64 m_Chat = new Chat;
66 m_LifeState = -1;
67 m_Hud = new IngameHud;
68 m_VoNActive = false;
69 m_PauseQueued = false;
70 m_ChatChannelFadeTimer = new WidgetFadeTimer;
71 m_MicFadeTimer = new WidgetFadeTimer;
74
75 m_ActiveRefresherLocations = new array<vector>;
76 SyncEvents.RegisterEvents();
77 }
78
79 void ~MissionGameplay()
80 {
81 DestroyInventory();
82 #ifndef NO_GUI
83 if (g_Game.GetUIManager() && g_Game.GetUIManager().ScreenFadeVisible())
84 {
85 g_Game.GetUIManager().ScreenFadeOut(0);
86 }
87 Continue();
88 #endif
89 }
90
91 InventoryMenu GetInventory()
92 {
93 return m_InventoryMenu;
94 }
95
96 override void OnInit()
97 {
98 super.OnInit();
99
100 if ( m_Initialized )
101 {
102 return;
103 }
104
105 #ifndef BULDOZER
106 #ifdef DIAG_DEVELOPER
107 if (!g_Game.IsMultiplayer())//to make it work in single during development
108 {
109 CfgGameplayHandler.LoadData();
110 UndergroundAreaLoader.SpawnAllTriggerCarriers();
111 }
112 #endif
113 #endif
114
115 PPEffects.Init(); //DEPRECATED, left in for legacy purposes only
116 MapMarkerTypes.Init();
117
118 m_UIManager = g_Game.GetUIManager();
119
120 m_Initialized = true;
121
122 // init hud ui
123 if ( !m_HudRootWidget )
124 {
125 m_HudRootWidget = g_Game.GetWorkspace().CreateWidgets("gui/layouts/day_z_hud.layout");
126
127 m_HudRootWidget.Show(false);
128
129 m_Chat.Init(m_HudRootWidget.FindAnyWidget("ChatFrameWidget"));
130
131 m_ActionMenu.Init( m_HudRootWidget.FindAnyWidget("ActionsPanel"), TextWidget.Cast( m_HudRootWidget.FindAnyWidget("DefaultActionWidget") ) );
132
133 m_Hud.Init( m_HudRootWidget.FindAnyWidget("HudPanel") );
134
135 // von enabled icon
136 m_MicrophoneIcon = ImageWidget.Cast( m_HudRootWidget.FindAnyWidget("mic") );
137 m_MicrophoneIcon.Show(false);
138
139 // von voice level
140 m_VoiceLevels = m_HudRootWidget.FindAnyWidget("VoiceLevelsPanel");
141 m_VoiceLevelsWidgets = new map<int, ImageWidget>; // [key] voice level
142 m_VoiceLevelTimers = new map<int,ref WidgetFadeTimer>; // [key] voice level
143
144 if ( m_VoiceLevels )
145 {
146 m_VoiceLevelsWidgets.Set(VoiceLevelWhisper, ImageWidget.Cast( m_VoiceLevels.FindAnyWidget("Whisper") ));
147 m_VoiceLevelsWidgets.Set(VoiceLevelTalk, ImageWidget.Cast( m_VoiceLevels.FindAnyWidget("Talk") ));
148 m_VoiceLevelsWidgets.Set(VoiceLevelShout, ImageWidget.Cast( m_VoiceLevels.FindAnyWidget("Shout") ));
149
150 m_VoiceLevelTimers.Set(VoiceLevelWhisper, new WidgetFadeTimer);
151 m_VoiceLevelTimers.Set(VoiceLevelTalk, new WidgetFadeTimer);
152 m_VoiceLevelTimers.Set(VoiceLevelShout, new WidgetFadeTimer);
153 }
154
155 HideVoiceLevelWidgets();
156
157 // chat channel
158 m_ChatChannelArea = m_HudRootWidget.FindAnyWidget("ChatChannelPanel");
159 m_ChatChannelText = TextWidget.Cast( m_HudRootWidget.FindAnyWidget("ChatChannelText") );
160 }
161
162 // init hud ui
163 #ifdef DEVELOPER
164 m_HudDebug = new HudDebug;
165
166 if ( !m_HudDebug.IsInitialized() )
167 {
168 m_HudDebug.Init( g_Game.GetWorkspace().CreateWidgets("gui/layouts/debug/day_z_hud_debug.layout") );
169 PluginConfigDebugProfile.GetInstance().SetLogsEnabled(LogManager.IsLogsEnable());
170 }
171 #endif
172
173 // experimental hud watermark
174 #ifndef DIAG_DEVELOPER
175 #ifdef BUILD_EXPERIMENTAL
176 m_Watermark = new Watermark();
177 #endif
178 #endif
179 }
180
181 UIManager GetUIManager()
182 {
183 return m_UIManager;
184 }
185
186 override void OnMissionStart()
187 {
188 g_Game.SetConnecting(false);
189
190#ifndef FEATURE_CURSOR
192 GetUIManager().ShowUICursor(false);
193#endif
194
195 g_Game.SetMissionState(DayZGame.MISSION_STATE_GAME);
196
197 #ifndef BULDOZER
198 #ifdef DIAG_DEVELOPER
199 if (!g_Game.IsMultiplayer())
200 {
201 // We will load the Effect areas on Default mission start
202 EffectAreaLoader.CreateZones();
203 }
204 #endif
205 #endif
206 }
207
208 void InitInventory()
209 {
210 if ( !m_InventoryMenu )
211 {
212 m_InventoryMenu = InventoryMenu.Cast( GetUIManager().CreateScriptedMenu(MENU_INVENTORY, null) );
213 }
214 }
215
216 void TickScheduler(float timeslice)
217 {
218 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
219
220 if( player )
221 player.OnScheduledTick(timeslice);
222
223 if (g_Game.m_AutotestEnabled)
224 {
225 if (!AutotestRunner.IsDone())
226 {
227 if (!AutotestRunner.IsRunning())
228 AutotestRunner.Start();
229
230 AutotestRunner.Update(timeslice);
231 }
232 else
233 {
234 g_Game.RequestExit(0);
235 }
236 }
237 }
238
239 void SendMuteListToServer( map<string, bool> mute_list )
240 {
241 if( mute_list && mute_list.Count() > 0 )
242 {
243 ScriptRPC rpc = new ScriptRPC();
244 rpc.Write(mute_list);
245 rpc.Send(null, ERPCs.RPC_USER_SYNC_PERMISSIONS, true, null);
246 }
247 }
248
249 override void UpdateInputDevicesAvailability()
250 {
251 super.UpdateInputDevicesAvailability();
252
253 g_Game.GetInput().UpdateConnectedInputDeviceList();
254 g_Game.UpdateInputDeviceDisconnectWarning();
255 }
256
257 override void OnMissionFinish()
258 {
259 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
260
261 //Print("OnMissionFinish");
262 GetUIManager().HideDialog();
263 DestroyAllMenus();
264
265 m_Chat.Destroy();
266 delete m_HudRootWidget;
267
268 if (m_DebugMonitor)
269 m_DebugMonitor.Hide();
270#ifndef FEATURE_CURSOR
271 g_Game.GetUIManager().ShowUICursor(false);
272#endif
273 PPEManagerStatic.GetPPEManager().StopAllEffects(PPERequesterCategory.ALL);
274 EnableAllInputs();
275 g_Game.SetMissionState( DayZGame.MISSION_STATE_FINNISH );
276 }
277
278 override void OnUpdate(float timeslice)
279 {
280#ifdef DIAG_DEVELOPER
281 UpdateInputDeviceDiag();
282#endif
283
284#ifdef FEATURE_CURSOR
285 if (GetTimeStamp() == 0)
286 {
287 if (!g_Game.IsAppActive() || IsCLIParam("launchPaused"))
288 {
289 m_PauseQueued = true;
290 }
291 else
292 {
294 GetUIManager().ShowUICursor(false);
295 }
296 }
297#endif
298
299 if (m_PauseQueued && !IsPaused())
300 {
301 Pause();
302 }
303
304 Man player = g_Game.GetPlayer();
305 PlayerBase playerPB = PlayerBase.Cast(player);
306 TickScheduler(timeslice);
307 UpdateDummyScheduler();//for external entities
308 UIScriptedMenu menu = m_UIManager.GetMenu();
309 InventoryMenu inventory = InventoryMenu.Cast( m_UIManager.FindMenu(MENU_INVENTORY) );
310 NoteMenu note_menu = NoteMenu.Cast( m_UIManager.FindMenu(MENU_NOTE) );
311 GesturesMenu gestures_menu = GesturesMenu.Cast(m_UIManager.FindMenu(MENU_GESTURES));
312 RadialQuickbarMenu quickbar_menu = RadialQuickbarMenu.Cast(m_UIManager.FindMenu(MENU_RADIAL_QUICKBAR));
313 InspectMenuNew inspect = InspectMenuNew.Cast( m_UIManager.FindMenu(MENU_INSPECT) );
314 Input input = g_Game.GetInput();
315 ActionBase runningAction;
316 bool manualInputUnlockProcessed = false;
317
318 Hologram localPlacingHologram;
319 if (playerPB)
320 {
321 #ifdef DIAG_DEVELOPER
322 if (DiagMenu.GetBool(DiagMenuIDs.MISC_HOLOGRAM))
323 {
324 DbgUI.Begin("Hologram Debug", 5, 5);
325 }
326 #endif
327
328 localPlacingHologram = playerPB.GetHologramLocal();
329 if (localPlacingHologram)
330 {
331 localPlacingHologram.UpdateHologram(timeslice);
332 }
333 #ifdef DIAG_DEVELOPER
334 else if (DiagMenu.GetBool(DiagMenuIDs.MISC_HOLOGRAM))
335 {
336 DbgUI.Text("No active Hologram");
337 }
338
339 if (DiagMenu.GetBool(DiagMenuIDs.MISC_HOLOGRAM))
340 {
341 DbgUI.End();
342 }
343 #endif
344
345 runningAction = playerPB.GetActionManager().GetRunningAction();
346 }
347
348#ifdef PLATFORM_CONSOLE
349 //'Special behaviour' for colliding VON distance input actions [CONSOLE ONLY]
350 if (GetUApi().GetInputByID(UAVoiceModifierHelper).LocalValue() && !menu)
351 {
352 GetUApi().GetInputByID(UAUIQuickbarRadialOpen).Lock();
353 GetUApi().GetInputByID(UAZoomInToggle).Lock();
354 GetUApi().GetInputByID(UAPersonView).Lock();
355 GetUApi().GetInputByID(UALeanLeft).Lock();
356 GetUApi().GetInputByID(UALeanRight).Lock();
357 }
358 else if (GetUApi().GetInputByID(UAVoiceModifierHelper).LocalRelease()) //unlocks on release, if already excluded, all the other inputs should be locked/unlocked in the exclude (if defined properly!)
359 {
360 GetUApi().GetInputByID(UAUIQuickbarRadialOpen).Unlock();
361 GetUApi().GetInputByID(UAZoomInToggle).Unlock();
362 GetUApi().GetInputByID(UAPersonView).Unlock();
363 if (playerPB && !playerPB.IsSprinting())
364 {
365 GetUApi().GetInputByID(UALeanLeft).Unlock();
366 GetUApi().GetInputByID(UALeanRight).Unlock();
367 }
368
369 manualInputUnlockProcessed = true;
370 }
371
372 //Radial quickbar
373 if (GetUApi().GetInputByID(UAUIQuickbarRadialOpen).LocalPress() && playerPB)
374 {
375 //open quickbar menu
376 if ( playerPB.IsAlive() && !playerPB.IsRaised() && !playerPB.IsUnconscious() && !playerPB.GetCommand_Vehicle() ) //player hands not raised, player is not in prone and player is not interacting with vehicle
377 {
378 if ( !GetUIManager().IsMenuOpen( MENU_RADIAL_QUICKBAR ) )
379 {
380 RadialQuickbarMenu.OpenMenu();
381 }
382 }
383 }
384
385 bool b1 = RadialQuickbarMenu.GetItemToAssign() != null;
386 //close quickbar menu from world
387 if (GetUIManager().IsMenuOpen( MENU_RADIAL_QUICKBAR ) && (!RadialQuickbarMenu.GetMenuInstance().GetParentMenu() || RadialQuickbarMenu.GetMenuInstance().GetParentMenu() != inventory) && (GetUApi().GetInputByID(UAUIQuickbarRadialOpen).LocalRelease() || !GetUApi().GetInputByID(UAUIQuickbarRadialOpen).LocalValue()))
388 {
389 RadialQuickbarMenu.CloseMenu();
390 }
391
392 //Radial Quickbar from inventory
393 if ((RadialQuickbarMenu.instance && RadialQuickbarMenu.GetMenuInstance().GetParentMenu() && RadialQuickbarMenu.GetMenuInstance().GetParentMenu() == inventory) && GetUApi().GetInputByID(UAUIQuickbarRadialInventoryOpen).LocalRelease())
394 {
395 //close radial quickbar menu
396 if (g_Game.GetUIManager().IsMenuOpen(MENU_RADIAL_QUICKBAR))
397 {
398 RadialQuickbarMenu.CloseMenu();
399 RadialQuickbarMenu.SetItemToAssign(NULL);
400
401 if (g_Game.GetUIManager().IsMenuOpen(MENU_INVENTORY))
402 {
403 AddActiveInputExcludes({"inventory"});
404 AddActiveInputRestriction(EInputRestrictors.INVENTORY);
405 }
406 }
407 }
408
409 if (playerPB)
410 {
411 //Special behaviour for leaning [CONSOLE ONLY]
412 if (playerPB.IsRaised() || playerPB.IsInRasedProne())
413 {
414 GetUApi().GetInputByID(UALeanLeftGamepad).Unlock();
415 GetUApi().GetInputByID(UALeanRightGamepad).Unlock();
416
417 manualInputUnlockProcessed = true;
418 }
419 else if (!GetUApi().GetInputByID(UALeanLeftGamepad).IsLocked() || !GetUApi().GetInputByID(UALeanRightGamepad).IsLocked())
420 {
421 GetUApi().GetInputByID(UALeanLeftGamepad).Lock();
422 GetUApi().GetInputByID(UALeanRightGamepad).Lock();
423 }
424
425 //Special behaviour for freelook & zeroing [CONSOLE ONLY]
426 if (playerPB.IsRaised())
427 {
428 GetUApi().GetInputByID(UALookAround).Lock(); //disable freelook
429 GetUApi().GetInputByID(UALookAroundToggle).Lock(); //disable freelook
430
431 GetUApi().GetInputByID(UAZeroingUp).Unlock(); //enable zeroing
432 GetUApi().GetInputByID(UAZeroingDown).Unlock();
433
434 manualInputUnlockProcessed = true;
435 }
436 else if (GetUApi().GetInputByID(UALookAround).IsLocked() || GetUApi().GetInputByID(UALookAroundToggle).IsLocked())
437 {
438 GetUApi().GetInputByID(UALookAround).Unlock(); //enable freelook
439 GetUApi().GetInputByID(UALookAroundToggle).Unlock(); //enable freelook
440
441 GetUApi().GetInputByID(UAZeroingUp).Lock(); //disable zeroing
442 GetUApi().GetInputByID(UAZeroingDown).Lock();
443
444 manualInputUnlockProcessed = true;
445 }
446 }
447
448 if (m_ExitButtonDisabledRemainingTime > 0)
449 {
450 m_ExitButtonDisabledRemainingTime -= timeslice;
451 }
452#endif
453
454 if (manualInputUnlockProcessed)
455 {
456 RefreshExcludes();
457 }
458
459 //Gestures
460 if ( GetUApi().GetInputByID(UAUIGesturesOpen).LocalPress() && playerPB)
461 {
462 //open gestures menu
463 if ( !playerPB.IsRaised() && (playerPB.GetActionManager().ActionPossibilityCheck(playerPB.m_MovementState.m_CommandTypeId) || playerPB.IsEmotePlaying()) && !playerPB.GetCommand_Vehicle() )
464 {
465 if (GesturesMenu.CanOpenMenu() && !GetUIManager().IsMenuOpen(MENU_GESTURES))
466 {
467 GesturesMenu.OpenMenu();
468 m_Hud.ShowHudUI(false);
469 }
470 }
471 }
472
473 if ( GetUApi().GetInputByID(UAUIGesturesOpen).LocalRelease() || GetUApi().GetInputByID(UAUIGesturesOpen).LocalValue() == 0 )
474 {
475 //close gestures menu
476 if ( GetUIManager().IsMenuOpen( MENU_GESTURES ) )
477 {
478 GesturesMenu.CloseMenu();
479 m_Hud.ShowHudUI( true );
480 }
481 }
482
483 if (player && m_LifeState == EPlayerStates.ALIVE && !player.IsUnconscious() )
484 {
485 // enables HUD on spawn
486 if (m_HudRootWidget)
487 {
488 m_HudRootWidget.Show(true);
489 }
490
491 #ifndef NO_GUI
492 // fade out black screen
493
494 if ( GetUIManager().ScreenFadeVisible() )
495 {
496 GetUIManager().ScreenFadeOut(0.5);
497 }
498
499 #endif
500
501 if (GetUApi().GetInputByID(UAGear).LocalPress())
502 {
503 if (!inventory && playerPB.CanManipulateInventory() && IsMapUnfoldActionRunning(runningAction))
504 {
505 ShowInventory();
506 menu = m_InventoryMenu;
507 }
508 else if (menu == inventory && m_InventoryMenu && m_InventoryMenu.IsOpened())
509 {
510 HideInventory();
511 }
512 }
513
514 if (GetUApi().GetInputByID(UAUIMenu).LocalPress() && menu && inventory && menu == inventory)
515 {
516 HideInventory();
517 }
518
519 #ifndef PLATFORM_CONSOLE
520 if (GetUApi().GetInputByID(UAChat).LocalPress() && input.IsEnabledMouseAndKeyboardEvenOnServer())
521 {
522 ChatInputMenu chat = ChatInputMenu.Cast( m_UIManager.FindMenu(MENU_CHAT) );
523 if ( menu == NULL )
524 {
525 ShowChat();
526 }
527 }
528 #endif
529
530 // voice level updated
531 VONManager.GetInstance().HandleInput(input);
532
533 if (GetUApi().GetInputByID(UAUIQuickbarToggle).LocalHold())
534 {
535 if (!m_QuickbarHold)
536 {
537 m_QuickbarHold = true;
538 m_Hud.ShowHudPlayer(m_Hud.GetHudVisibility().IsContextFlagActive(EHudContextFlags.HUD_HIDE));
539 }
540 }
541
542 if (GetUApi().GetInputByID(UAUIQuickbarToggle).LocalRelease())
543 {
544 if (!m_QuickbarHold)
545 {
546 m_Hud.ShowQuickbarPlayer(m_Hud.GetHudVisibility().IsContextFlagActive(EHudContextFlags.QUICKBAR_HIDE));
547 }
548 m_QuickbarHold = false;
549 }
550
551 if (GetUApi().GetInputByID(UAZeroingUp).LocalPress() || GetUApi().GetInputByID(UAZeroingDown).LocalPress() || GetUApi().GetInputByID(UAToggleWeapons).LocalPress())
552 {
554 }
555
556 if (menu == NULL)
557 {
558 m_ActionMenu.Refresh();
559
560 if (GetUApi().GetInputByID(UANextActionCategory).LocalPress())
561 {
562 m_ActionMenu.NextActionCategory();
563 }
564 else if (GetUApi().GetInputByID(UAPrevActionCategory).LocalPress())
565 {
566 m_ActionMenu.PrevActionCategory();
567 }
568 else if (GetUApi().GetInputByID(UANextAction).LocalPress())
569 {
570 m_ActionMenu.NextAction();
571 }
572 else if (GetUApi().GetInputByID(UAPrevAction).LocalPress())
573 {
574 m_ActionMenu.PrevAction();
575 }
576 }
577 else
578 {
579 m_ActionMenu.Hide();
580 }
581
582 //hologram rotation
583 localPlacingHologram = playerPB.GetHologramLocal();
584 if (menu == null && playerPB.IsPlacingLocal() && localPlacingHologram && localPlacingHologram.GetParentEntity() && localPlacingHologram.GetParentEntity().PlacementCanBeRotated())
585 {
586 if (GetUApi().GetInputByID(UANextAction).LocalRelease())
587 {
588 localPlacingHologram.SubtractProjectionRotation(15);
589 }
590
591 if (GetUApi().GetInputByID(UAPrevAction).LocalRelease())
592 {
593 localPlacingHologram.AddProjectionRotation(15);
594 }
595 }
596
597 if (CfgGameplayHandler.GetMapIgnoreMapOwnership() && !CfgGameplayHandler.GetUse3DMap())
598 {
599 if (GetUApi().GetInputByID(UAMapToggle).LocalPress() && !m_UIManager.GetMenu())
600 {
601 if (IsMapUnfoldActionRunning(runningAction))
602 {
603 HandleMapToggleByKeyboardShortcut(player);
604 }
605 }
606 }
607 }
608
609 // life state check
610 if (player)
611 {
612 int life_state = player.GetPlayerState();
613 m_LifeState = life_state;
614 }
615
616 if (menu && !menu.UseKeyboard() && menu.UseMouse())
617 {
618 int i;
619 for (i = 0; i < 5; i++)
620 {
621 input.DisableKey(i | INPUT_DEVICE_MOUSE);
622 input.DisableKey(i | INPUT_ACTION_TYPE_DOWN_EVENT | INPUT_DEVICE_MOUSE);
623 input.DisableKey(i | INPUT_ACTION_TYPE_DOUBLETAP | INPUT_DEVICE_MOUSE);
624 }
625
626 for (i = 0; i < 6; i++)
627 {
628 input.DisableKey(i | INPUT_DEVICE_MOUSE_AXIS);
629 }
630 }
631
632 if (!m_UIManager.IsDialogVisible())
633 {
634 if (menu)
635 {
636 if (menu == inspect)
637 {
638 if (GetUApi().GetInputByID(UAGear).LocalPress())
639 {
640 if (ItemManager.GetInstance().GetSelectedItem() == NULL)
641 {
642 HideInventory();
643 }
644 }
645 else if (GetUApi().GetInputByID(UAUIBack).LocalPress())
646 {
647 if (ItemManager.GetInstance().GetSelectedItem() == NULL)
648 {
649 HideInventory();
650 }
651 }
652 }
653 else if (menu == note_menu && (!IsInputExcludeActive("inventory") || !IsInputRestrictionActive(EInputRestrictors.INVENTORY)))
654 {
655 AddActiveInputExcludes({"inventory"});
656 AddActiveInputRestriction(EInputRestrictors.INVENTORY);
657 }
658 else if (menu == gestures_menu && !gestures_menu.IsMenuClosing() && !IsInputExcludeActive("radialmenu"))
659 {
660 AddActiveInputExcludes({"radialmenu"});
661 GetUApi().GetInputByID(UAUIGesturesOpen).Unlock();
662 }
663 else if (menu == quickbar_menu && !quickbar_menu.IsMenuClosing() && !IsInputExcludeActive("radialmenu"))
664 {
665 AddActiveInputExcludes({"radialmenu"});
666 GetUApi().GetInputByID(UAUIQuickbarRadialOpen).Unlock();
667 }
668 else if (IsPaused())
669 {
670 InGameMenuXbox menu_xb = InGameMenuXbox.Cast(g_Game.GetUIManager().GetMenu());
671 if (!g_Game.GetUIManager().ScreenFadeVisible() && (!menu_xb || !menu_xb.IsOnlineOpen() && !menu_xb.FeedbackDialogVisible()))
672 {
673 if (GetUApi().GetInputByID(UAUIMenu).LocalPress())
674 {
675 Continue();
676 }
677 else if (GetUApi().GetInputByID(UAUIBack).LocalPress())
678 {
679 Continue();
680 }
681 }
682 else if (GetUApi().GetInputByID(UAUIBack).LocalPress())
683 {
684 if (menu_xb && menu_xb.IsOnlineOpen())
685 {
686 menu_xb.CloseOnline();
687 }
688 }
689 }
690 }
691 else if (GetUApi().GetInputByID(UAUIMenu).LocalPress())
692 {
693 if (IsMapUnfoldActionRunning(runningAction))
694 {
695 Pause();
696 }
697 }
698 }
699
700 UpdateDebugMonitor();
701
702 SEffectManager.Event_OnFrameUpdate(timeslice);
703
704 if (!g_Game.IsMultiplayer())
706
707#ifdef DIAG_DEVELOPER
708 DisplayHairDebug();
709#endif
710 if (m_ProcessInputExcludes)
711 {
712 PerformRefreshExcludes();
713 m_ProcessInputExcludes = false;
714 }
715
716 super.OnUpdate( timeslice );
717 }
718
719 override void OnKeyPress(int key)
720 {
721 super.OnKeyPress(key);
722 m_Hud.KeyPress(key);
723 }
724
725 override void OnKeyRelease(int key)
726 {
727 super.OnKeyRelease(key);
728 }
729
730 override void OnEvent(EventType eventTypeId, Param params)
731 {
732 super.OnEvent(eventTypeId, params);
733 InventoryMenu menu;
734 Man player = g_Game.GetPlayer();
735
736 switch (eventTypeId)
737 {
739 ChatMessageEventParams chat_params = ChatMessageEventParams.Cast( params );
740 if (m_LifeState == EPlayerStates.ALIVE)
741 {
742 m_Chat.Add(chat_params);
743 }
744 break;
745
747 ChatChannelEventParams cc_params = ChatChannelEventParams.Cast( params );
748 ChatInputMenu chatMenu = ChatInputMenu.Cast( GetUIManager().FindMenu(MENU_CHAT_INPUT) );
749 if (chatMenu)
750 {
751 chatMenu.UpdateChannel();
752 }
753 else
754 {
755 m_ChatChannelText.SetText(ChatInputMenu.GetChannelName(cc_params.param1));
756 m_ChatChannelFadeTimer.FadeIn(m_ChatChannelArea, 0.5, true);
757 m_ChatChannelHideTimer.Run(2, m_ChatChannelFadeTimer, "FadeOut", new Param3<Widget, float, bool>(m_ChatChannelArea, 0.5, true));
758 }
759 break;
760
761 case WindowsResizeEventTypeID:
762 DestroyAllMenus();
763 m_Hud.OnResizeScreen();
764
765 break;
766
768 SetFreeCameraEventParams set_free_camera_event_params = SetFreeCameraEventParams.Cast( params );
769 PluginDeveloper plugin_developer = PluginDeveloper.Cast( GetPlugin(PluginDeveloper) );
770 plugin_developer.OnSetFreeCameraEvent( PlayerBase.Cast( player ), set_free_camera_event_params.param1 );
771 break;
773 NetworkInputBufferEventParams networkInputBufferParams = NetworkInputBufferEventParams.Cast(params);
774 if (networkInputBufferParams)
775 {
776 OnInputBufferEvent(networkInputBufferParams.param1);
777 }
778 break;
779 }
780 }
781
782 override void OnItemUsed(InventoryItem item, Man owner)
783 {
784 if (item && GetUIManager().GetMenu() == NULL)
785 {
786 if (item.IsInherited(ItemBook))
787 {
788 BookMenu bookMenu = BookMenu.Cast( GetUIManager().EnterScriptedMenu(MENU_BOOK, NULL) );
789 if (bookMenu)
790 {
791 bookMenu.ReadBook(item);
792 }
793 }
794 }
795 }
796
797#ifdef DEVELOPER
798 override void SetInputSuppression(bool state)
799 {
800 m_SuppressNextFrame = state;
801 }
802
803 override bool GetInputSuppression()
804 {
805 return m_SuppressNextFrame;
806 }
807#endif
808
810 override void PlayerControlEnable( bool bForceSupress )
811 {
812 super.PlayerControlEnable(bForceSupress);
813
814 if (m_ControlDisabledMode != -1)
815 {
816 switch (m_ControlDisabledMode)
817 {
819 {
820 RemoveActiveInputExcludes({"menu"},bForceSupress);
821 break;
822 }
824 {
825 RemoveActiveInputExcludes({"inventory"},bForceSupress);
826 RemoveActiveInputRestriction(EInputRestrictors.INVENTORY);
827 break;
828 }
830 {
831 RemoveActiveInputExcludes({"loopedactions"},bForceSupress);
832 RemoveActiveInputRestriction(EInputRestrictors.MAP);
833 break;
834 }
836 {
837 RemoveActiveInputExcludes({"radialmenu"},bForceSupress);
838 break;
839 }
841 {
842 RemoveActiveInputExcludes({"radialmenu"},bForceSupress);
843 break;
844 }
845 }
846
847 m_ControlDisabledMode = -1;
848
849 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
850 if (player)
851 {
852 HumanInputController hic = player.GetInputController();
853 hic.LimitsDisableSprint(false);
854 }
855 }
856 }
857
859 override void PlayerControlDisable(int mode)
860 {
861 super.PlayerControlDisable(mode);
862
863 switch (mode)
864 {
866 {
867 AddActiveInputExcludes({"menu"});
868 break;
869 }
871 {
872 AddActiveInputExcludes({"inventory"});
873 AddActiveInputRestriction(EInputRestrictors.INVENTORY);
874 break;
875 }
877 {
878 AddActiveInputExcludes({"loopedactions"});
879 AddActiveInputRestriction(EInputRestrictors.MAP);
880 break;
881 }
883 {
884 AddActiveInputExcludes({"radialmenu"});
885 break;
886 }
888 {
889 AddActiveInputExcludes({"radialmenu"});
890 break;
891 }
892 default:
893 {
894 Debug.Log("Unknown controls disable mode");
895 return;
896 }
897 }
898
899 m_ControlDisabledMode = mode;
900
901 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
902 if ( player )
903 {
904 ItemBase item = player.GetItemInHands();
905 if (item && item.IsWeapon())
906 player.RequestResetADSSync();
907 }
908 }
909
911 override void RemoveActiveInputExcludes(array<string> excludes, bool bForceSupress = false)
912 {
913 super.RemoveActiveInputExcludes(excludes,bForceSupress);
914
915 if (excludes.Count() != 0)
916 {
917 bool changed = false;
918
919 if (m_ActiveInputExcludeGroups)
920 {
921 foreach (string excl : excludes)
922 {
923 if (m_ActiveInputExcludeGroups.Find(excl) != -1)
924 {
925 m_ActiveInputExcludeGroups.RemoveItem(excl);
926 changed = true;
927 }
928 }
929
930 if (changed)
931 {
932 RefreshExcludes();
933 }
934 }
935
936 // supress control for next frame
937 GetUApi().SupressNextFrame(bForceSupress);
938 }
939 }
940
942 override void RemoveActiveInputRestriction(int restrictor)
943 {
944 //unique behaviour outside regular excludes
945 if (restrictor > -1)
946 {
947 switch (restrictor)
948 {
949 case EInputRestrictors.INVENTORY:
950 {
951 GetUApi().GetInputByID(UAWalkRunForced).ForceEnable(false); // force walk off!
952 break;
953 }
954 case EInputRestrictors.MAP:
955 {
956 GetUApi().GetInputByID(UAWalkRunForced).ForceEnable(false); // force walk off!
957 break;
958 }
959 }
960
961 if (m_ActiveInputRestrictions && m_ActiveInputRestrictions.Find(restrictor) != -1)
962 {
963 m_ActiveInputRestrictions.RemoveItem(restrictor);
964 }
965 }
966 }
967
969 override void AddActiveInputExcludes(array<string> excludes)
970 {
971 super.AddActiveInputExcludes(excludes);
972
973 if (excludes.Count() != 0)
974 {
975 bool changed = false;
976 if (!m_ActiveInputExcludeGroups)
977 {
978 m_ActiveInputExcludeGroups = new array<string>;
979 }
980
981 foreach (string excl : excludes)
982 {
983 if (m_ActiveInputExcludeGroups.Find(excl) == -1)
984 {
985 m_ActiveInputExcludeGroups.Insert(excl);
986 changed = true;
987 }
988 }
989
990 if (changed)
991 {
992 RefreshExcludes();
993 #ifdef BULDOZER
994 GetUApi().SupressNextFrame(true);
995 #endif
996 }
997 }
998 }
999
1001 override void AddActiveInputRestriction(int restrictor)
1002 {
1003 //unique behaviour outside regular excludes
1004 if (restrictor > -1)
1005 {
1006 switch (restrictor)
1007 {
1008 case EInputRestrictors.INVENTORY:
1009 {
1010 GetUApi().GetInputByID(UAWalkRunForced).ForceEnable(true); // force walk on!
1011 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
1012 if ( player )
1013 {
1014 ItemBase item = player.GetItemInHands();
1015 if (item && item.IsWeapon())
1016 player.RequestResetADSSync();
1017 }
1018 break;
1019 }
1020 case EInputRestrictors.MAP:
1021 {
1022 GetUApi().GetInputByID(UAWalkRunForced).ForceEnable(true); // force walk on!
1023 break;
1024 }
1025 }
1026
1027 if (!m_ActiveInputRestrictions)
1028 {
1029 m_ActiveInputRestrictions = new array<int>;
1030 }
1031 if (m_ActiveInputRestrictions.Find(restrictor) == -1)
1032 {
1033 m_ActiveInputRestrictions.Insert(restrictor);
1034 }
1035 }
1036 }
1037
1039 override void RefreshExcludes()
1040 {
1041 m_ProcessInputExcludes = true;
1042 }
1043
1045 protected void PerformRefreshExcludes()
1046 {
1048 {
1049 foreach (string excl : m_ActiveInputExcludeGroups)
1050 {
1051 GetUApi().ActivateExclude(excl);
1052 }
1053 }
1054
1055 GetUApi().UpdateControls();
1056 }
1057
1059 override void EnableAllInputs(bool bForceSupress = false)
1060 {
1062
1064 {
1065 int count = m_ActiveInputRestrictions.Count();
1066 for (int i = 0; i < count; i++)
1067 {
1068 RemoveActiveInputRestriction(m_ActiveInputRestrictions[0]);
1069 }
1070 m_ActiveInputRestrictions.Clear(); //redundant?
1071 }
1073 {
1075 }
1076
1077 GetUApi().UpdateControls(); //it is meant to happen instantly, does not wait for update to process
1078 GetUApi().SupressNextFrame(bForceSupress); // supress control for next frame
1079 }
1080
1082 override bool IsControlDisabled()
1083 {
1084 bool active = false;
1086 {
1087 active |= m_ActiveInputExcludeGroups.Count() > 0;
1088 }
1090 {
1091 active |= m_ActiveInputRestrictions.Count() > 0;
1092 }
1093 active |= m_ControlDisabledMode >= INPUT_EXCLUDE_ALL; //legacy stuff, Justin case
1094 return active;
1095 }
1096
1098 override bool IsInputExcludeActive(string exclude)
1099 {
1100 return m_ActiveInputExcludeGroups && m_ActiveInputExcludeGroups.Find(exclude) != -1;
1101 }
1102
1104 override bool IsInputRestrictionActive(int restriction)
1105 {
1106 return m_ActiveInputRestrictions && m_ActiveInputRestrictions.Find(restriction) != -1;
1107 }
1108
1111 {
1112 return m_ControlDisabledMode;
1113 }
1114
1116 {
1117 GetUIManager().CloseAll();
1118 }
1119
1120
1122 {
1123 if( GetUIManager() )
1124 {
1125 GetUIManager().HideDialog();
1126 GetUIManager().CloseAll();
1127 }
1128
1130
1131 if( m_Chat )
1132 m_Chat.Clear();
1133 }
1134
1135 void MoveHudForInventory( bool inv_open )
1136 {
1137 #ifdef PLATFORM_CONSOLE
1138 IngameHud hud = IngameHud.Cast( GetHud() );
1139 if( hud )
1140 {
1141 if( inv_open )
1142 {
1143 hud.GetHudPanelWidget().SetPos( 0, -0.055 );
1144 }
1145 else
1146 {
1147 hud.GetHudPanelWidget().SetPos( 0, 0 );
1148 }
1149 }
1150 #endif
1151 }
1152
1153 override void ShowInventory()
1154 {
1155 UIScriptedMenu menu = GetUIManager().GetMenu();
1156
1157 if ( !menu && g_Game.GetPlayer().GetHumanInventory().CanOpenInventory() && !g_Game.GetPlayer().IsInventorySoftLocked() )
1158 {
1159 if( !m_InventoryMenu )
1160 {
1161 InitInventory();
1162 }
1163
1164 if( !GetUIManager().FindMenu( MENU_INVENTORY ) )
1165 {
1166 GetUIManager().ShowScriptedMenu(m_InventoryMenu, null);
1167 PlayerBase.Cast(g_Game.GetPlayer()).OnInventoryMenuOpen();
1168 }
1169 AddActiveInputExcludes({"inventory"});
1170 AddActiveInputRestriction(EInputRestrictors.INVENTORY);
1171 }
1172 }
1173
1174 override void HideInventory()
1175 {
1176 if (m_InventoryMenu)
1177 {
1178 GetUIManager().HideScriptedMenu(m_InventoryMenu);
1179 RemoveActiveInputExcludes({"inventory"},false);
1180 RemoveActiveInputRestriction(EInputRestrictors.INVENTORY);
1181 PlayerBase.Cast(g_Game.GetPlayer()).OnInventoryMenuClose();
1182 VicinityItemManager.GetInstance().ResetRefreshCounter();
1183 }
1184 }
1185
1187 {
1188 if (m_InventoryMenu)
1189 {
1190 if (!m_InventoryMenu.GetParentMenu() && GetUIManager().GetMenu() != m_InventoryMenu)
1191 {
1192 m_InventoryMenu.SetParentMenu(GetUIManager().GetMenu()); //hack; guarantees the 'm_pCurrentMenu' will be set to whatever is on top currently
1193 }
1194 m_InventoryMenu.Close();
1195 m_InventoryMenu = NULL;
1196 }
1197 }
1198
1199 override void ResetGUI()
1200 {
1202 InitInventory();
1203 }
1204
1205 override void ShowChat()
1206 {
1209 m_ChatChannelArea.Show(false);
1210 m_UIManager.EnterScriptedMenu(MENU_CHAT_INPUT, NULL);
1211
1212 int level = g_Game.GetVoiceLevel();
1214
1215 AddActiveInputExcludes({"menu"});
1216 }
1217
1218 override void HideChat()
1219 {
1220 RemoveActiveInputExcludes({"menu"},true);
1221 }
1222
1224 {
1225 if ( GetHud() )
1226 GetHud().ShowVehicleInfo();
1227 }
1228
1230 {
1231 if ( GetHud() )
1232 GetHud().HideVehicleInfo();
1233 }
1234
1235 override Hud GetHud()
1236 {
1237 return m_Hud;
1238 }
1239
1241 {
1242 return m_HudDebug;
1243 }
1244
1246 {
1247 if (GetHudDebug())
1248 GetHudDebug().RefreshCrosshairVisibility();
1249 }
1250
1252 {
1253 if (GetHudDebug())
1254 GetHudDebug().HideCrosshairVisibility();
1255 }
1256
1257 override bool IsPaused()
1258 {
1259 return g_Game.GetUIManager().IsMenuOpen(MENU_INGAME);
1260 }
1261
1262 override void Pause()
1263 {
1264 if (IsPaused() || (g_Game.GetUIManager().GetMenu() && g_Game.GetUIManager().GetMenu().GetID() == MENU_INGAME))
1265 {
1266 return;
1267 }
1268
1269 m_PauseQueued = true;
1270
1271 if ( g_Game.IsClient() && g_Game.GetGameState() != DayZGameState.IN_GAME )
1272 {
1273 return;
1274 }
1275
1276 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
1277 if ( player && !player.IsPlayerLoaded() || IsPlayerRespawning() )
1278 {
1279 return;
1280 }
1281
1282 CloseAllMenus();
1283
1284 // open ingame menu
1285 UIScriptedMenu menu = GetUIManager().EnterScriptedMenu( MENU_INGAME, g_Game.GetUIManager().GetMenu() );
1286 if (!menu || !menu.IsVisible())
1287 {
1288 return;
1289 }
1290
1291 AddActiveInputExcludes({"menu"});
1292 AddActiveInputRestriction(EInputRestrictors.INVENTORY);
1293
1294 m_PauseQueued = false;
1295 }
1296
1297 override void Continue()
1298 {
1299 UIScriptedMenu menu = g_Game.GetUIManager().GetMenu();
1300 if (menu)
1301 {
1302 int menu_id = menu.GetID();
1303 if (!IsPaused() || (menu_id != MENU_INGAME && menu_id != MENU_LOGOUT && menu_id != MENU_RESPAWN_DIALOGUE) || (m_Logout && m_Logout.layoutRoot.IsVisible()))
1304 {
1305 return;
1306 }
1307 }
1308
1309 RemoveActiveInputExcludes({"menu"},true);
1310 RemoveActiveInputRestriction(EInputRestrictors.INVENTORY);
1311 GetUIManager().CloseMenu(MENU_INGAME);
1312 }
1313
1314 override bool IsMissionGameplay()
1315 {
1316 return true;
1317 }
1318
1319 override void AbortMission()
1320 {
1321 #ifdef BULDOZER
1322 g_Game.GetCallQueue(CALL_CATEGORY_GUI).Call(g_Game.RequestExit, IDC_MAIN_QUIT);
1323 #else
1324 g_Game.GetCallQueue(CALL_CATEGORY_GUI).Call(g_Game.AbortMission);
1325 #endif
1326 }
1327
1328 override void CreateLogoutMenu(UIMenuPanel parent)
1329 {
1330 // prevent creating logout dialog if input buffer has reached server config maximumClientInputs limit.
1332 return;
1333
1334 // prevent creating the logout dialog if the in-game menu was closed before (DZ-23150)
1335 UIScriptedMenu menu = GetUIManager().GetMenu();
1336 if (menu && menu.GetID() != MENU_LOGOUT && menu.IsClosing())
1337 return;
1338
1339 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
1340 // do not show logout screen if player's dead
1341 if (!player || player.IsDamageDestroyed())
1342 {
1343 // exit the game immediately
1344 AbortMission();
1345 return;
1346 }
1347
1348 if (parent)
1349 {
1350 m_Logout = LogoutMenu.Cast(parent.EnterScriptedMenu(MENU_LOGOUT));
1351
1352 if (m_Logout)
1353 {
1354 m_Logout.SetLogoutTime();
1355 }
1356 }
1357 }
1358
1359 override void StartLogoutMenu(int time)
1360 {
1361 if (m_Logout)
1362 {
1363 if (time > 0)
1364 {
1365 // character will be deleted from server int "time" seconds
1366 m_Logout.SetTime(time);
1367 m_Logout.Show();
1368
1369 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(m_Logout.UpdateTime, 1000, true);
1370 }
1371 else
1372 {
1373 // no waiting time -> player is most likely dead
1374 m_Logout.Exit();
1375 }
1376 }
1377 }
1378
1379 override void CreateDebugMonitor()
1380 {
1381 if (!m_DebugMonitor)
1382 {
1384 m_DebugMonitor.Init();
1385 }
1386 else
1387 m_DebugMonitor.Show();
1388
1389 }
1390 override void HideDebugMonitor()
1391 {
1392 if (m_DebugMonitor)
1393 {
1394 m_DebugMonitor.Hide();
1395 }
1396 }
1397
1398 protected void HandleMapToggleByKeyboardShortcut(Man player)
1399 {
1400 UIManager um = g_Game.GetUIManager();
1401 if (um && !um.IsMenuOpen(MENU_MAP))
1402 {
1403 um.CloseAll();
1404 if (!CfgGameplayHandler.GetUse3DMap())
1405 {
1406 um.EnterScriptedMenu(MENU_MAP, null);
1407 Mission mission = g_Game.GetMission();
1408 mission.AddActiveInputExcludes({"map"});
1409 mission.AddActiveInputRestriction(EInputRestrictors.MAP);
1410 }
1411 }
1412 }
1413
1414 protected bool IsMapUnfoldActionRunning(ActionBase pAction)
1415 {
1416 return !pAction || pAction.Type() != ActionUnfoldMap;
1417 }
1418
1419 /*void ChangeBleedingIndicatorVisibility(bool visible)
1420 {
1421 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
1422 if (player)
1423 {
1424 BleedingSourcesManagerRemote manager = player.GetBleedingManagerRemote();
1425 if (manager && manager.GetBleedingSourcesCount() > 0)
1426 {
1427 manager.ChangeBleedingIndicatorVisibility(visible);
1428 }
1429 }
1430 }*/
1431
1433 {
1434 if (!m_DebugMonitor) return;
1435
1436 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
1437 if (player)
1438 {
1439 DebugMonitorValues values = player.GetDebugMonitorValues();
1440 if (values)
1441 {
1442 m_DebugMonitor.SetHealth(values.GetHealth());
1443 m_DebugMonitor.SetBlood(values.GetBlood());
1444 m_DebugMonitor.SetLastDamage(values.GetLastDamage());
1445 m_DebugMonitor.SetPosition(MiscGameplayFunctions.TruncateVec(player.GetPosition(),1));
1446 }
1447 }
1448
1449 float currFPS = g_Game.GetAvgFPS(10); // Not using last, but average of last x to prevent jitter
1450 float minFPS, maxFPS, avgFPS;
1451 g_Game.GetFPSStats(minFPS, maxFPS, avgFPS);
1452 m_DebugMonitor.SetFramerate(currFPS, minFPS, maxFPS, avgFPS);
1453 }
1454
1455 void SetActionDownTime( int time_down )
1456 {
1457 m_ActionDownTime = time_down;
1458 }
1459
1460 void SetActionUpTime( int time_up )
1461 {
1462 m_ActionUpTime = time_up;
1463 }
1464
1466 {
1467 return m_ActionDownTime;
1468 }
1469
1471 {
1472 return m_ActionUpTime;
1473 }
1474
1476 {
1477 float hold_action_time = LocalReleaseTime() - LocalPressTime();
1478 return hold_action_time;
1479 }
1480
1482 {
1483#ifndef SERVER
1484 ShowHairDebugValues(DiagMenu.GetBool(DiagMenuIDs.MISC_HAIR_DISPLAY_DEBUG));
1485#endif
1486 }
1487
1488 void ShowHairDebugValues(bool state)
1489 {
1490#ifdef DIAG_DEVELOPER
1491 if ( state )
1492 {
1494
1495 int i = DiagMenu.GetValue(DiagMenuIDs.MISC_HAIR_LEVEL);
1496 bool bState = diagmenu.m_HairHidingStateMap.Get(i);
1497 string selectionState;
1498 if (!bState)
1499 selectionState = "Hidden";
1500 else
1501 selectionState = "Shown";
1502 string selectionName = diagmenu.m_HairSelectionArray.Get(i);
1503
1504 DbgUI.BeginCleanupScope();
1505 DbgUI.Begin("Hair Debug", 50, 150);
1506 DbgUI.Text("Current Hair Selection:" + selectionName);
1507 DbgUI.Text("State: " + selectionState);
1508
1509 DbgUI.End();
1510 DbgUI.EndCleanupScope();
1511 }
1512 else
1513 {
1514 DbgUI.BeginCleanupScope();
1515 DbgUI.Begin("Hair Debug", 50, 50);
1516 DbgUI.End();
1517 DbgUI.EndCleanupScope();
1518 }
1519#endif
1520 }
1521
1522 override void UpdateVoiceLevelWidgets(int level)
1523 {
1524 for ( int n = 0; n < m_VoiceLevelsWidgets.Count(); n++ )
1525 {
1526 int voiceKey = m_VoiceLevelsWidgets.GetKey(n);
1527 ImageWidget voiceWidget = m_VoiceLevelsWidgets.Get(n);
1528
1529 // stop fade timer since it will be refreshed
1530 WidgetFadeTimer timer = m_VoiceLevelTimers.Get(n);
1531 timer.Stop();
1532
1533 // show widgets according to the level
1534 if ( voiceKey <= level )
1535 {
1536 voiceWidget.SetAlpha(1.0); // reset from possible previous fade out
1537 voiceWidget.Show(true);
1538
1539 if ( !m_VoNActive && !GetUIManager().FindMenu(MENU_CHAT_INPUT) )
1540 timer.FadeOut(voiceWidget, 3.0);
1541 }
1542 else
1543 voiceWidget.Show(false);
1544 }
1545
1546 // fade out microphone icon when switching levels without von on
1547 if ( !m_VoNActive )
1548 {
1549 if ( !GetUIManager().FindMenu(MENU_CHAT_INPUT) )
1550 {
1551 m_MicrophoneIcon.SetAlpha(1.0);
1552 m_MicrophoneIcon.Show(true);
1553
1554 m_MicFadeTimer.FadeOut(m_MicrophoneIcon, 3.0);
1555 }
1556 }
1557 else
1558 {
1559 // stop mic icon fade timer when von is activated
1560 m_MicFadeTimer.Stop();
1561 }
1562 }
1563
1564 override ImageWidget GetMicrophoneIcon()
1565 {
1566 return m_MicrophoneIcon;
1567 }
1568
1569 override WidgetFadeTimer GetMicWidgetFadeTimer()
1570 {
1571 return m_MicFadeTimer;
1572 }
1573
1578
1583
1584 override bool IsVoNActive()
1585 {
1586 return m_VoNActive;
1587 }
1588
1589 override void SetVoNActive(bool active)
1590 {
1591 m_VoNActive = active;
1592 }
1593
1595 {
1596 for ( int n = 0; n < m_VoiceLevelsWidgets.Count(); n++ )
1597 {
1598 ImageWidget voiceWidget = m_VoiceLevelsWidgets.Get( n );
1599 voiceWidget.Show(false);
1600 }
1601 }
1602
1604 {
1605 return m_Note;
1606 };
1607
1608 override void SetNoteMenu(UIScriptedMenu menu)
1609 {
1610 m_Note = NoteMenu.Cast(menu);
1611 };
1612
1613 override void OnPlayerRespawned(Man player)
1614 {
1615 #ifdef DIAG_DEVELOPER
1616 if (m_HudDebug)
1617 m_HudDebug.RefreshByLocalProfile();
1618 #endif
1619
1620 PlayerBase playerBase = PlayerBase.Cast(player);
1621 if (playerBase)
1622 {
1623 g_Game.GetCallQueue(CALL_CATEGORY_GUI).Call(playerBase.ShowDeadScreen, false, 0);
1624 }
1625
1626 g_Game.GetSoundScene().SetSoundVolume(g_Game.m_volume_sound,1);
1627 g_Game.GetSoundScene().SetSpeechExVolume(g_Game.m_volume_speechEX,1);
1628 g_Game.GetSoundScene().SetMusicVolume(g_Game.m_volume_music,1);
1629 g_Game.GetSoundScene().SetVOIPVolume(g_Game.m_volume_VOIP,1);
1630 g_Game.GetSoundScene().SetRadioVolume(g_Game.m_volume_radio,1);
1631 }
1632
1633 override void SetPlayerRespawning(bool state)
1634 {
1635 m_PlayerRespawning = state;
1636 }
1637
1638 override bool IsPlayerRespawning()
1639 {
1640 return m_PlayerRespawning;
1641 }
1642
1644 {
1645 return m_ActiveRefresherLocations;
1646 }
1647
1648 override void SetRespawnModeClient(int mode)
1649 {
1650 m_RespawnModeClient = mode;
1651 }
1652
1654 {
1655 return m_RespawnModeClient;
1656 }
1657
1658 override GameplayEffectWidgets GetEffectWidgets()
1659 {
1660 return m_EffectWidgets;
1661 }
1662
1671
1672 protected void OnInputBufferEvent(bool state)
1673 {
1674 if (m_InputBufferFull != state)
1675 {
1676 m_InputBufferFull = state;
1678 {
1679 UIManager uiManager = g_Game.GetUIManager();
1680 UIScriptedMenu menu = uiManager.GetMenu();
1681 if (menu && menu.GetID() == MENU_INVENTORY)
1682 {
1683 g_Game.GetMission().HideInventory();
1684 }
1685
1686 uiManager.CloseAll();
1687
1688 m_ConnectionMenu = uiManager.EnterScriptedMenu(MENU_CONNECTION_DIALOGUE, menu);
1689 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(InputBufferCheck, 0.500, true);
1690 }
1691 }
1692 }
1693
1694 protected void InputBufferCheck()
1695 {
1696 PlayerBase player;
1698 ActionBase action;
1699
1701 {
1702 DayZPlayer dayzPlayer = g_Game.GetPlayer();
1703 if (m_ConnectionMenu && (!dayzPlayer.IsAlive() || dayzPlayer.IsUnconscious()))
1704 {
1705 m_ConnectionMenu.Close();
1706
1707 player = PlayerBase.Cast(dayzPlayer);
1708 if (!player)
1709 return;
1710
1711 amb = player.GetActionManager();
1712 if (!amb)
1713 return;
1714
1715 action = amb.GetRunningAction();
1716 if (action && amb.GetActionState(action) != UA_NONE)
1717 {
1718 amb.RequestInterruptAction();
1719 }
1720 return;
1721 }
1722
1723 if (!m_ConnectionMenu)
1724 {
1725 UIManager uiManager = g_Game.GetUIManager();
1726 UIScriptedMenu menu = uiManager.GetMenu();
1727 if (menu && menu.GetID() == MENU_INVENTORY)
1728 {
1729 g_Game.GetMission().HideInventory();
1730 }
1731
1732 uiManager.CloseAll();
1733 m_ConnectionMenu = uiManager.EnterScriptedMenu(MENU_CONNECTION_DIALOGUE, menu);
1734 }
1735 }
1736 else
1737 {
1738 if (m_ConnectionMenu)
1739 {
1740 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(InputBufferCheck);
1741 m_ConnectionMenu.Close();
1742
1743 player = PlayerBase.Cast(g_Game.GetPlayer());
1744 if (!player)
1745 return;
1746
1747 amb = player.GetActionManager();
1748 if (!amb)
1749 return;
1750
1751 action = amb.GetRunningAction();
1752 if (action && amb.GetActionState(action) != UA_NONE)
1753 {
1754 amb.RequestInterruptAction();
1755 }
1756 }
1757 }
1758 }
1759
1761 {
1762 return m_ExitButtonDisabledRemainingTime;
1763 }
1764
1766 {
1767 m_ExitButtonDisabledRemainingTime = value;
1768 }
1769}
void ActionManagerBase(PlayerBase player)
ActionUnfoldMapCB ActionBaseCB ActionUnfoldMap()
string Debug()
Definition chat.c:15
Definition dbgui.c:60
EntityAI GetParentEntity()
Definition hologram.c:1322
void AddProjectionRotation(float addition)
Definition hologram.c:1416
void UpdateHologram(float timeslice)
Definition hologram.c:256
void SubtractProjectionRotation(float subtraction)
Definition hologram.c:1421
void ZeroingKeyPress()
Definition ingamehud.c:726
IngameHudVisibility GetHudVisibility()
Definition ingamehud.c:873
bool KeyPress(int key)
Definition ingamehud.c:721
override void EnableAllInputs(bool bForceSupress=false)
Removes all active input excludes and restrictions.
override void CreateDebugMonitor()
HudDebug GetHudDebug()
void InputBufferCheck()
float GetHoldActionTime()
override UIScriptedMenu GetNoteMenu()
ref Watermark m_Watermark
int m_ControlDisabledMode
ref ActionMenu m_ActionMenu
void SetActionUpTime(int time_up)
override map< int, ref WidgetFadeTimer > GetVoiceLevelTimers()
override void OnPlayerRespawned(Man player)
float GetExitButtonDisabledRemainingTime()
override void ShowInventory()
ref IngameHud m_Hud
void DestroyInventory()
override void Continue()
ref map< int, ImageWidget > m_VoiceLevelsWidgets
ref HudDebug m_HudDebug
override bool IsInputExcludeActive(string exclude)
Returns true if the particular input exclude group had been activated via script and is active.
ref array< string > m_ActiveInputExcludeGroups
override void StartLogoutMenu(int time)
bool m_PlayerRespawning
ImageWidget m_MicrophoneIcon
override bool IsControlDisabled()
returns if ANY exclude groups, restriction (or deprecated disable, if applicable) is active
override map< int, ImageWidget > GetVoiceLevelWidgets()
UIManager m_UIManager
override ImageWidget GetMicrophoneIcon()
override void SetNoteMenu(UIScriptedMenu menu)
override void HideDebugMonitor()
override void ResetGUI()
override void ShowChat()
void HandleMapToggleByKeyboardShortcut(Man player)
override void HideCrosshairVisibility()
override void RefreshCrosshairVisibility()
ref ScriptInvoker m_OnConnectivityChanged
override bool IsInputRestrictionActive(int restriction)
Returns true if the particular 'restriction' (those govern special behaviour outside regular input ex...
override void SetVoNActive(bool active)
ref DebugMonitor m_DebugMonitor
override bool IsMissionGameplay()
override void HideChat()
void ShowHairDebugValues(bool state)
ref WidgetFadeTimer m_ChatChannelFadeTimer
override int GetControlDisabledMode()
(mostly)DEPRECATED; only set on the old 'PlayerControlDisable' method
ref array< int > m_ActiveInputRestrictions
override bool IsPlayerRespawning()
Widget m_VoiceLevels
override void AbortMission()
override Hud GetHud()
ref WidgetFadeTimer m_MicFadeTimer
const int HOLD_LIMIT_TIME
void SetActionDownTime(int time_down)
override void HideVoiceLevelWidgets()
override bool IsVoNActive()
ref Timer m_ChatChannelHideTimer
TextWidget m_ChatChannelText
ScriptInvoker GetConnectivityInvoker()
ref LogoutMenu m_Logout
Widget m_HudRootWidget
override int GetRespawnModeClient()
UIScriptedMenu m_ConnectionMenu
override void HideInventory()
override void Pause()
override void CreateLogoutMenu(UIMenuPanel parent)
override GameplayEffectWidgets GetEffectWidgets()
void OnInputBufferEvent(bool state)
ref map< int, ref WidgetFadeTimer > m_VoiceLevelTimers
Widget m_ChatChannelArea
void MoveHudForInventory(bool inv_open)
void UpdateDebugMonitor()
bool m_ProcessInputExcludes
override void SetPlayerRespawning(bool state)
void PerformRefreshExcludes()
applies queued excludes (0 == clear excludes)
void SetExitButtonDisabledRemainingTime(float value)
ref GameplayEffectWidgets m_EffectWidgets
ref Chat m_Chat
bool IsMapUnfoldActionRunning(ActionBase pAction)
override bool IsPaused()
void DisplayHairDebug()
ref Timer m_ToggleHudTimer
override void SetRespawnModeClient(int mode)
override WidgetFadeTimer GetMicWidgetFadeTimer()
override void UpdateVoiceLevelWidgets(int level)
NoteMenu m_Note
ref InventoryMenu m_InventoryMenu
override array< vector > GetActiveRefresherLocations()
Mission class.
Definition gameplay.c:686
ScriptInvoker Class provide list of callbacks usage:
Definition tools.c:116
Part of main menu hierarchy to create custom menus from script.
override bool UseMouse()
static EntityAI GetItemToAssign()
void UpdateBaseEnvTemperature(float timeslice)
Definition worlddata.c:165
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override void OnEvent(EventType eventTypeId, Param params)
Handles VON-related events.
DayZGame g_Game
Definition dayzgame.c:3942
Hud m_Hud
Mission mission
DiagMenuIDs
Definition ediagmenuids.c:2
WorldData m_WorldData
Definition environment.c:85
EPlayerStates
ERPCs
Definition erpcs.c:2
Param1< bool > NetworkInputBufferEventParams
isFull
Definition gameplay.c:463
const EventType SetFreeCameraEventTypeID
params: SetFreeCameraEventParams
Definition gameplay.c:565
Param4< int, string, string, string > ChatMessageEventParams
channel, from, text, color config class
Definition gameplay.c:407
Param1< int > ChatChannelEventParams
Definition gameplay.c:408
const EventType NetworkInputBufferEventTypeID
params: NetworkInputBufferEventParams
Definition gameplay.c:573
const EventType ChatChannelEventTypeID
params: ChatChannelEventParams
Definition gameplay.c:501
Param1< FreeDebugCamera > SetFreeCameraEventParams
Camera.
Definition gameplay.c:455
const EventType ChatMessageEventTypeID
params: ChatMessageEventParams
Definition gameplay.c:499
class GP5GasMask extends MaskBase ItemBase
const int INPUT_EXCLUDE_MOUSE_RADIAL
Definition constants.c:660
const int INPUT_EXCLUDE_ALL
Definition constants.c:657
const int INPUT_EXCLUDE_INVENTORY
Definition constants.c:658
const int INPUT_EXCLUDE_MAP
Definition constants.c:661
const int INPUT_EXCLUDE_MOUSE_ALL
Definition constants.c:659
const int INPUT_DEVICE_MOUSE
Definition constants.c:24
const int INPUT_ACTION_TYPE_DOUBLETAP
Definition constants.c:40
const int INPUT_DEVICE_MOUSE_AXIS
Definition constants.c:42
const int INPUT_ACTION_TYPE_DOWN_EVENT
Definition constants.c:33
const int MENU_LOGOUT
Definition constants.c:195
const int MENU_INSPECT
Definition constants.c:179
const int MENU_MAP
Definition constants.c:191
const int MENU_RESPAWN_DIALOGUE
Definition constants.c:209
const int MENU_GESTURES
Definition constants.c:194
const int MENU_CONNECTION_DIALOGUE
Definition constants.c:215
const int MENU_CHAT
Definition constants.c:175
const int MENU_INVENTORY
Definition constants.c:180
const int MENU_NOTE
Definition constants.c:190
const int MENU_RADIAL_QUICKBAR
Definition constants.c:198
const int MENU_BOOK
Definition constants.c:192
const int MENU_INGAME
Definition constants.c:178
const int MENU_CHAT_INPUT
Definition constants.c:186
void OnInit()
Callback for user defined initialization. Called for all suites during TestHarness....
Definition freezestate.c:81
proto native bool IsCLIParam(string param)
Returns if command line argument is present.
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
void Pause()
Pause Timer, internal counter is not restarted, so timer can continue later. Can be unpaused via Cont...
Definition tools.c:239
void OnUpdate()
Definition tools.c:349
void Continue()
Timer continue when it was paused.
Definition tools.c:247
const int CALL_CATEGORY_GUI
Definition tools.c:9
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
const int UA_NONE
Definition constants.c:465
const int IDC_MAIN_QUIT
Definition constants.c:144
TypeID EventType
Definition enwidgets.c:55
void HudDebug()
Definition huddebug.c:108
void InventoryMenu()
bool IsLocked()
PluginBase GetPlugin(typename plugin_type)
PPERequesterCategory
proto native UAInputAPI GetUApi()
bool m_Initialized