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