Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
ingamehud.c
Go to the documentation of this file.
1 class IngameHud extends Hud
2 {
3  protected const float FADE_IN_TIME = 0.3;
4  protected const float FADE_OUT_TIME = 0.3;
5  protected const float HIDE_MENU_TIME = 5;
6 
7  protected ref map<int,string> m_StatesWidgetNames;
8  protected ref map<int,ImageWidget> m_StatesWidgets; // [key] ImageWidget
9 
10  protected ref map<ImageWidget, int> m_TendencyStatusCritical; //array of icons that are blinking due to critical tendency status
11  protected const float TENDENCY_BLINK_TIME = 0.25;
12  protected float m_BlinkTime;
13 
14  protected ref map<int,string> m_BadgesWidgetNames;
15  protected ref map<int,int> m_BadgesSupportedLevels;
16  protected ref map<int,int> m_BadgesWidgetDisplay;
17  protected ref map<int,ImageWidget> m_BadgesWidgets; // [key] ImageWidget
18  protected bool m_AnyBadgeVisible;
19  protected bool m_IsTemperatureVisible;
20  protected float m_TemperatureTimer;
21  protected float m_TemperatureShowTime = 30;
22  protected ImageWidget m_HeatBufferPlus;
23 
24  protected bool m_IsStaminaVisible;
25  protected float m_StaminaTimer;
26  protected float m_StaminaShowTime = 0.15;
27 
28  protected ref map<int,string> m_VehicleGearTable;
29  protected ref map<int,string> m_VehicleGearTableAuto;
30 
31  protected Widget m_HudPanelWidget;
32  protected Widget m_LeftHudPanelWidget;
33  protected Widget m_QuickbarWidget;
34  protected ref InventoryQuickbar m_Quickbar;
35 
36  protected Widget m_VehiclePanel;
37 
38  protected ImageWidget m_VehicleRPMPointer;
39  protected ImageWidget m_VehicleRPMDial;
40  protected ImageWidget m_VehicleRPMRedline;
41  protected ImageWidget m_VehicleSpeedPointer;
42  protected Widget m_VehicleTemperatureIndicator;
43  protected ImageWidget m_VehicleTemperaturePointer;
44  protected ImageWidget m_VehicleTemperatureLight;
45  protected ImageWidget m_VehicleFuelPointer;
46  protected ImageWidget m_VehicleFuelLight;
47 
48  protected TextWidget m_VehicleSpeedValue;
49 
50  protected TextWidget m_VehicleCurrentGearValue;
51  protected TextWidget m_VehicleNextGearValue;
52  protected TextWidget m_VehiclePrevGearValue;
53 
54  protected ImageWidget m_VehicleBatteryLight;
55  protected ImageWidget m_VehicleEngineLight;
56  protected ImageWidget m_VehicleOilLight;
57  protected ImageWidget m_VehicleHandBrakeLight;
58  protected ImageWidget m_VehicleWheelLight;
59 
60  protected bool m_VehicleDamageZoneHitEngineState;
61  protected float m_VehicleDamageZonesHitTimer;
62 
63  protected bool m_InVehicleAsDriver;
64  protected CarScript m_CurrentVehicle;
65 
66 
67  protected Widget m_GameStatusIconsPanel;
68  protected ImageWidget m_HighPingA;
69  protected ImageWidget m_HighPingB;
70  protected ImageWidget m_LowServerPerfA;
71  protected ImageWidget m_LowServerPerfB;
72  protected ImageWidget m_ConnectionLost;
73 
74  protected Widget m_Notifiers;
75  protected TextWidget m_BloodType;
76  protected TextWidget m_BloodPosType;
77  protected Widget m_BadgeNotifierDivider;
78  protected Widget m_Badges;
79  protected ref Timer m_HideTimer;
80  protected ref WidgetFadeTimer m_FadeTimerCrosshair;
81  protected ref WidgetFadeTimer m_FadeTimerActionCursor;
82 // protected ref WidgetFadeTimer m_FadeTimerWeaponMode;
83 // protected ref WidgetFadeTimer m_FadeTimerZeroing;
84  protected ref WidgetFadeTimer m_FadeTimerZeroingOld;
85  protected ref WidgetFadeTimer m_FadeTimerMagazineName;
86  protected ref WidgetFadeTimer m_FadeTimerWeaponName;
87  protected ref WidgetFadeTimer m_FadeTimerWeaponStats;
88  protected ref WidgetFadeTimer m_FadeTimerQuickbar;
89  protected ref WidgetFadeTimer m_FadeTimerWalkieTalkie;
90  protected ref WidgetFadeTimer m_FadeTimerWalkieTalkieText;
91 
92  protected ProgressBarWidget m_Stamina;
93  protected Widget m_StaminaBackground;
94  protected Widget m_Presence;
95  protected Widget m_StanceProne;
96  protected Widget m_StanceStand;
97  protected Widget m_StanceStandWalk;
98  protected Widget m_StanceCrouch;
99  protected Widget m_StanceCar;
100  protected Widget m_StancePanel;
101  protected Widget m_PresenceLevel0;
102  protected Widget m_PresenceLevel1;
103  protected Widget m_PresenceLevel2;
104  protected Widget m_PresenceLevel3;
105  protected Widget m_PresenceLevel4;
106  protected ref Timer myTimer; //TEMP
107  protected ref array<ref WidgetFadeTimer> m_FadeTimers = new array<ref WidgetFadeTimer>;
108  protected Widget m_MouseSingleAction;
109  protected Widget m_MouseContinuousAction;
110  protected Widget m_RadialProgressBar1;
111  protected Widget m_RadialProgressBarCrossHair;
112  protected Widget m_RadialProgressBar;
113  protected Widget m_CursorWidget;
114  protected ImageWidget m_CursorIcon;
115  protected Widget m_WalkieTalkie;
116 
117  protected Widget m_ActionWidget;
118  protected TextWidget m_ActionDesc;
119  protected TextWidget m_ActionItemDesc;
120  protected Widget m_ActionItemQuantityWrapper
121  protected ImageWidget m_ActionHealthMark;
122  protected ProgressBarWidget m_ActionQuantityBar;
123  protected Widget m_ActionQuantityBox;
124  protected TextWidget m_ActionQuantityBoxText;
125  protected ImageWidget m_ActionIcon;
126  protected TextWidget m_ActionButtonText;
127 
128  protected Widget m_ActionIconFrame;
129  protected Widget m_ActionMultipleItemsFrame;
130 
131  protected Widget m_ActionTarget;
132  protected ActionTargetsCursor m_ActionTargetsCursor;
133 
134  // CrossHairs
135  protected ImageWidget m_PermanentCrossHair;
136 
137  protected bool m_HudHideUI;
138  protected bool m_HudHidePlayer;
139  protected bool m_HudInventory;
140  protected bool m_HudState; //options-driven global setting
141  protected bool m_QuickbarHideUI;
142  protected bool m_QuickbarHidePlayer;
143  protected bool m_QuickbarState; //options-driven global setting
144  protected bool m_IsQuickbarVisible;
145  protected bool m_IsHudVisible;
146  protected bool m_Faded;
147  protected bool m_ZeroingKeyPressed;
148 
149  protected Widget m_HitIndicatorUp;
150  protected Widget m_HitIndicatorDown;
151  protected Widget m_HitIndicatorLeft;
152  protected Widget m_HitIndicatorRight;
153  protected Widget m_HitIndicatorSingle;
154  protected Widget m_SpecializatonPanel;
155  protected Widget m_SpecializationIcon;
156 
157  ref array<ref HitDirectionEffectBase> m_HitDirEffectArray;
158 
159  void IngameHud()
160  {
161  m_FadeTimerCrosshair = new WidgetFadeTimer;
162  m_FadeTimerActionCursor = new WidgetFadeTimer;
163  m_FadeTimerQuickbar = new WidgetFadeTimer;
164  m_FadeTimerWalkieTalkie = new WidgetFadeTimer;
165  m_FadeTimerWalkieTalkieText = new WidgetFadeTimer;
166 
167  m_StatesWidgets = new map<int, ImageWidget>; // [key] widgetName
168  m_StatesWidgetNames = new map<int, string>;
169 
170  m_TendencyStatusCritical = new map<ImageWidget, int>;
171 
172  m_BadgesWidgets = new map<int, ImageWidget>; // [key] widgetName
173  m_BadgesWidgetNames = new map<int, string>;
174  m_BadgesSupportedLevels = new map<int, int>;
175  m_BadgesWidgetDisplay = new map<int, int>;
176 
177  m_VehicleDamageZonesHitTimer = 0;
178 
179  m_VehicleGearTable = new map<int, string>;
180  m_VehicleGearTable.Set(-1, "");
181  m_VehicleGearTable.Set(CarGear.REVERSE, "R");
182  m_VehicleGearTable.Set(CarGear.NEUTRAL, "N");
183  m_VehicleGearTable.Set(CarGear.FIRST, "1");
184  m_VehicleGearTable.Set(CarGear.SECOND, "2");
185  m_VehicleGearTable.Set(CarGear.THIRD, "3");
186  m_VehicleGearTable.Set(CarGear.FOURTH, "4");
187  m_VehicleGearTable.Set(CarGear.FIFTH, "5");
188  m_VehicleGearTable.Set(CarGear.SIXTH, "6");
189  m_VehicleGearTable.Set(CarGear.SEVENTH, "7");
190  m_VehicleGearTable.Set(CarGear.EIGTH, "8");
191 
192  m_VehicleGearTableAuto = new map<int, string>;
193  m_VehicleGearTableAuto.Set(-1, "");
194  m_VehicleGearTableAuto.Set(CarAutomaticGearboxMode.R, "R");
195  m_VehicleGearTableAuto.Set(CarAutomaticGearboxMode.N, "N");
196  m_VehicleGearTableAuto.Set(CarAutomaticGearboxMode.D, "D");
197 
198  }
199 
200  override void Init( Widget hud_panel_widget )
201  {
202  m_HudPanelWidget = hud_panel_widget;
203  m_HudPanelWidget.Show( true );
204 
205  //Quickbar
206  m_QuickbarWidget = m_HudPanelWidget.FindAnyWidget("QuickbarGrid");
207  m_QuickbarWidget.Show( false );
208 
209  //Left HUD Panel
210  m_LeftHudPanelWidget = m_HudPanelWidget.FindAnyWidget("LeftHUDPanel");
211 
212  //TEMPORARY HACK!!! player is not present when Hud is being initialized
213  myTimer = new Timer( CALL_CATEGORY_GAMEPLAY );
214  myTimer.Run( 1, this, "InitQuickbar" );
215 
216  m_CursorWidget = m_HudPanelWidget.FindAnyWidget("CursorIcons");
217  m_CursorWidget.Show(true);
218  Class.CastTo(m_CursorIcon, m_HudPanelWidget.FindAnyWidget("Cursor"));
219 
220  //Permanent Crosshair
221  Class.CastTo(m_PermanentCrossHair, m_HudPanelWidget.FindAnyWidget("PermanentCrossHair"));
222 
223  m_WalkieTalkie = m_HudPanelWidget.FindAnyWidget("WalkieTalkie");
224 
225  //Panels
226  Class.CastTo(m_Stamina, m_HudPanelWidget.FindAnyWidget("StaminaBar"));
227  m_Presence = m_HudPanelWidget.FindAnyWidget("PresencePanel");
228  m_Badges = hud_panel_widget.FindAnyWidget("BadgesPanel");
229  m_Notifiers = m_HudPanelWidget.FindAnyWidget("NotifiersPanel");
230  m_SpecializatonPanel = m_HudPanelWidget.FindAnyWidget("SpecializationPanel");
231  m_SpecializationIcon = m_HudPanelWidget.FindAnyWidget("SpecializationIcon");
232  m_BadgeNotifierDivider = m_HudPanelWidget.FindAnyWidget("BadgeNotifierDivider");
233  m_BloodType = TextWidget.Cast( m_HudPanelWidget.FindAnyWidget("BloodType") );
234  m_BloodPosType = TextWidget.Cast( m_HudPanelWidget.FindAnyWidget("BloodPosType") );
235 
236  m_VehiclePanel = m_HudPanelWidget.FindAnyWidget("VehiclePanel");
237  m_VehiclePanel.Show(false);
238 
239  m_VehicleRPMPointer = ImageWidget.Cast( m_VehiclePanel.FindAnyWidget("RPMPointer") );
240  m_VehicleRPMDial = ImageWidget.Cast( m_VehiclePanel.FindAnyWidget("RPMDial") );
241  m_VehicleRPMRedline = ImageWidget.Cast( m_VehiclePanel.FindAnyWidget("RPMDialRedline") );
242  m_VehicleSpeedPointer = ImageWidget.Cast( m_VehiclePanel.FindAnyWidget("SpeedPointer") );
243  m_VehicleSpeedValue = TextWidget.Cast( m_VehiclePanel.FindAnyWidget("SpeedValue") );
244 
245  m_VehicleCurrentGearValue = TextWidget.Cast( m_VehiclePanel.FindAnyWidget("Current") );
246  m_VehicleNextGearValue = TextWidget.Cast( m_VehiclePanel.FindAnyWidget("Next") );
247  m_VehiclePrevGearValue = TextWidget.Cast( m_VehiclePanel.FindAnyWidget("Prev") );
248 
249  m_VehicleBatteryLight = ImageWidget.Cast( m_VehiclePanel.FindAnyWidget("BatteryLight"));
250  m_VehicleEngineLight = ImageWidget.Cast( m_VehiclePanel.FindAnyWidget("EngineLight"));
251  m_VehicleOilLight = ImageWidget.Cast( m_VehiclePanel.FindAnyWidget("OilLight"));
252  m_VehicleHandBrakeLight = ImageWidget.Cast( m_VehiclePanel.FindAnyWidget("HandBrakeLight"));
253  m_VehicleWheelLight = ImageWidget.Cast( m_VehiclePanel.FindAnyWidget("WheelLight"));
254 
255  m_VehicleTemperatureIndicator = m_VehiclePanel.FindAnyWidget("TemperatureIndicator");
256  m_VehicleTemperaturePointer = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("TemperaturePointer"));
257  m_VehicleTemperatureLight = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("TemperatureLight"));
258  m_VehicleFuelPointer = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("FuelPointer"));
259  m_VehicleFuelLight = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("FuelLight"));
260 
261  m_StaminaBackground = m_HudPanelWidget.FindAnyWidget("StaminaBackground");
262  m_StaminaBackground.Show(true);
263  m_StanceProne = m_HudPanelWidget.FindAnyWidget("StanceProne");
264  m_StanceCrouch = m_HudPanelWidget.FindAnyWidget("StanceCrouch");
265  m_StanceStand = m_HudPanelWidget.FindAnyWidget("StanceStand");
266  m_StanceStandWalk = m_HudPanelWidget.FindAnyWidget("StanceStandWalk");
267  m_StanceCar = m_HudPanelWidget.FindAnyWidget("StanceCar");
268  m_StancePanel = m_HudPanelWidget.FindAnyWidget("StancePanel");
269 
270  m_ActionTarget = m_HudPanelWidget.FindAnyWidget("ActionTargetsCursorWidget");
272  m_ActionTarget.GetScript(m_ActionTargetsCursor);
273 
274  // heat buffer plus sign
275  m_HeatBufferPlus = ImageWidget.Cast( m_HudPanelWidget.FindAnyWidget( "HeatBuffer" ) );
276 
277  //Game State Icons
278  m_GameStatusIconsPanel = m_HudPanelWidget.FindAnyWidget("GameStatusIcons");
279  m_HighPingA = ImageWidget.Cast(m_HudPanelWidget.FindAnyWidget("HighPingA"));
280  m_HighPingB = ImageWidget.Cast(m_HudPanelWidget.FindAnyWidget("HighPingB"));
281  m_LowServerPerfA = ImageWidget.Cast(m_HudPanelWidget.FindAnyWidget("LowServerPerfA"));
282  m_LowServerPerfB = ImageWidget.Cast(m_HudPanelWidget.FindAnyWidget("LowServerPerfB"));
283  m_ConnectionLost = ImageWidget.Cast(m_HudPanelWidget.FindAnyWidget("ConnectionLost"));
284 
285  if ( m_HeatBufferPlus )
286  m_HeatBufferPlus.Show( false );
287 
288  #ifndef NO_GUI
290  m_Timer.Run(0.333, this, "RefreshQuickbar", NULL, true );
291  #endif
292  InitBadgesAndNotifiers();
293 
294  m_PresenceLevel0 = hud_panel_widget.FindAnyWidget("Presence0");
295  m_PresenceLevel1 = hud_panel_widget.FindAnyWidget("Presence1");
296  m_PresenceLevel2 = hud_panel_widget.FindAnyWidget("Presence2");
297  m_PresenceLevel3 = hud_panel_widget.FindAnyWidget("Presence3");
298  m_PresenceLevel4 = hud_panel_widget.FindAnyWidget("Presence4");
299  m_PresenceLevel0.Show( false );
300  m_PresenceLevel1.Show( false );
301  m_PresenceLevel2.Show( false );
302  m_PresenceLevel3.Show( false );
303  m_PresenceLevel4.Show( false );
304 
305  SetLeftStatsVisibility( true );
306  m_HudState = g_Game.GetProfileOption( EDayZProfilesOptions.HUD );
307  MissionGameplay.Cast(GetGame().GetMission()).GetConnectivityInvoker().Insert(OnConnectionIconsSettingsChanged);
308  m_GameStatusIconsPanel.Show(g_Game.GetProfileOption(EDayZProfilesOptions.CONNECTIVITY_INFO));
309  //ShowQuickBar(GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() && g_Game.GetProfileOption(EDayZProfilesOptions.QUICKBAR)); //unreliable
310  }
311 
312  void InitBadgesAndNotifiers()
313  {
314  // state notifiers
315  m_StatesWidgetNames.Clear();
316  m_StatesWidgets.Clear();
317  m_StatesWidgetNames.Set( NTFKEY_THIRSTY, "Thirsty" );
318  m_StatesWidgetNames.Set( NTFKEY_HUNGRY, "Hungry" );
319  m_StatesWidgetNames.Set( NTFKEY_SICK, "Health" );
320  m_StatesWidgetNames.Set( NTFKEY_BLEEDISH, "Blood" );
321  m_StatesWidgetNames.Set( NTFKEY_FEVERISH, "Temperature" );
322 
323  m_Notifiers.Show( true );
324  m_Badges.Show( true );
325 
326  int i = 0;
327  int key = 0;
328  for ( i = 0; i < m_StatesWidgetNames.Count(); i++ )
329  {
330  string widget_name = m_StatesWidgetNames.GetElement(i);
331  key = m_StatesWidgetNames.GetKey(i);
332  ImageWidget w;
333  Class.CastTo(w, m_Notifiers.FindAnyWidget( String( "Icon" + widget_name ) ) );
334  m_StatesWidgets.Set( key, w );
335  w.Show( true );
336  for ( int y = 0; y < 5; y++ )
337  {
338  w.LoadImageFile( y, "set:dayz_gui image:icon" + widget_name + y );
339  }
340 
341  w.SetImage( 0 );
342  float alpha = w.GetAlpha();
343  w.SetColor( ARGB( alpha * 255, 220, 220, 220 ) ); //white
344  m_TendencyStatusCritical.Remove( w );
345  // clear all arrows
346  for ( int x = 1; x < 4; x++ )
347  {
348  Class.CastTo(w, m_Notifiers.FindAnyWidget( String( widget_name + "ArrowUp" + x.ToString() ) ) );
349  w.Show( false );
350  Class.CastTo(w, m_Notifiers.FindAnyWidget( String( widget_name + "ArrowDown" + x.ToString() ) ) );
351  w.Show( false );
352  }
353 
354 
355  }
356 
357  // badges
358  m_BadgesWidgetNames.Clear();
359  m_BadgesWidgets.Clear();
360  m_BadgesWidgetDisplay.Clear();
361  m_BadgesSupportedLevels.Clear();
362 
363  m_BadgesWidgetNames.Set( NTFKEY_FRACTURE, "Fracture" );
364  m_BadgesWidgetNames.Set( NTFKEY_STUFFED, "Stomach" );
365  m_BadgesWidgetNames.Set( NTFKEY_SICK, "Sick" );
366  m_BadgesWidgetNames.Set( NTFKEY_WETNESS, "Wetness" );
367  m_BadgesWidgetNames.Set( NTFKEY_POISONED, "Poisoned" );
368  m_BadgesWidgetNames.Set( NTFKEY_BLEEDISH, "Bleeding" );
369  m_BadgesWidgetNames.Set( NTFKEY_LIVES, "Shock" );
370  m_BadgesWidgetNames.Set( NTFKEY_PILLS, "Pills" );
371  m_BadgesWidgetNames.Set( NTFKEY_LEGS, "InjuredLegs" );
372 
373  // any badges not included bellow are just ON/OFF
374  m_BadgesSupportedLevels.Insert(NTFKEY_LEGS,3);
375 
376  for ( i = 0; i < m_BadgesWidgetNames.Count(); i++ )
377  {
378  string badge_name = m_BadgesWidgetNames.GetElement( i);
379  key = m_BadgesWidgetNames.GetKey( i );
380  ImageWidget badge_widget;
381 
382 
383  Class.CastTo(badge_widget, m_Badges.FindAnyWidget( badge_name ) );
384 
385  if (m_BadgesSupportedLevels.Contains(key))
386  {
387  int badgeCountMax = m_BadgesSupportedLevels.Get(key);
388 
389  for ( int q = 0; q < badgeCountMax; q++ )
390  {
391  badge_widget.LoadImageFile( q, "set:dayz_gui image:icon" + badge_name + q );
392  }
393  }
394 
395  m_BadgesWidgets.Set( key, badge_widget );
396  badge_widget.Show( false );
397  m_BadgesWidgetDisplay.Set( key, false );
398  }
399  m_AnyBadgeVisible = false;
400  m_BadgeNotifierDivider.Show(false);
401 
402  }
403 
404  void OnConnectionIconsSettingsChanged(bool enabled)
405  {
406  m_GameStatusIconsPanel.Show(enabled);
407  }
408 
409  override void OnResizeScreen()
410  {
411  float x, y;
412  m_HudPanelWidget.GetScreenSize( x, y );
413  m_HudPanelWidget.Update();
414  m_Badges.Update();
415  m_Notifiers.SetPos( 0, 0 );
416  }
417 
418  override void Show( bool show )
419  {
420  m_HudPanelWidget.Show( show );
421  }
422 
423  override void ShowWalkieTalkie( bool show )
424  {
425  m_FadeTimerWalkieTalkie.Stop();
426  m_FadeTimerWalkieTalkieText.Stop();
427  m_WalkieTalkie.Show( show );
428  }
429 
430  override void ShowWalkieTalkie( int fadeOutSeconds )
431  {
432  m_WalkieTalkie.Show(true);
433  m_FadeTimerWalkieTalkie.Stop();
434  m_FadeTimerWalkieTalkieText.Stop();
435  m_FadeTimerWalkieTalkie.FadeOut( m_WalkieTalkie.FindAnyWidget("Icon") , fadeOutSeconds );
436  m_FadeTimerWalkieTalkieText.FadeOut( m_WalkieTalkie.FindAnyWidget("Text") , fadeOutSeconds );
437  }
438 
439  override void SetWalkieTalkieText( string text )
440  {
441  TextWidget txt;
442  Class.CastTo(txt, m_WalkieTalkie.FindAnyWidget("Text"));
443  txt.SetText(text);
444  }
445 
446  override void SetCursorIcon( string icon )
447  {
448  if ( icon.Length() == 0 || icon == CursorIcons.None )
449  m_CursorIcon.Show(false);
450  else
451  {
452  m_CursorIcon.LoadImageFile( 0, icon );
453  m_CursorIcon.Show(true);
454  }
455  }
456 
457  override void ShowCursor()
458  {
459  m_CursorWidget.Show( true );
460  }
461 
462  override void HideCursor()
463  {
464  m_CursorWidget.Show( false );
465  }
466 
467  override void SetCursorIconScale( string type, float percentage )
468  {
469  float x, y;
470  m_CursorIcon.FindAnyWidget( type ).GetParent().GetSize( x, y );
471  m_CursorIcon.FindAnyWidget( type ).GetParent().SetSize( x * percentage, y * percentage );
472  }
473 
474  override void SetCursorIconOffset( string type, float x, float y )
475  {
476  m_CursorIcon.FindAnyWidget( type ).GetParent().SetPos( x, y );
477  }
478 
479  override void SetCursorIconSize( string type, float x, float y )
480  {
481  m_CursorIcon.FindAnyWidget( type ).GetParent().SetSize( x, y );
482  }
483 
484 #ifdef DIAG_DEVELOPER
485  // Debug Crosshair
486  override void SetPermanentCrossHair( bool show )
487  {
488  m_PermanentCrossHair.Show(show);
489  }
490 #endif
491 
492  override void DisplayNotifier( int key, int tendency, int status )
493  {
494  ImageWidget w;
495  if ( key == NTFKEY_FEVERISH )
496  {
497  DisplayTendencyTemp( key, tendency, status );
498  }
499  else
500  {
501  DisplayTendencyNormal( key, tendency, status );
502  }
503 
504  // tendency arrows
505  string arrow_name = "ArrowUp";
506  if ( tendency < 0 )
507  {
508  arrow_name = "ArrowDown";
509  }
510  tendency = Math.AbsInt( tendency );
511 
512  for ( int x = 1; x < 4; x++ )
513  {
514  Class.CastTo(w, m_Notifiers.FindAnyWidget( String( m_StatesWidgetNames.Get( key ) + "ArrowUp" + x.ToString() ) ) );
515  if( w )
516  w.Show( false );
517  Class.CastTo(w, m_Notifiers.FindAnyWidget( String( m_StatesWidgetNames.Get( key ) + "ArrowDown" + x.ToString() ) ) );
518  if( w )
519  w.Show( false );
520  }
521 
522  if( tendency > 0 )
523  {
524  string widget_name = m_StatesWidgetNames.Get( key ) + arrow_name + Math.Clamp( tendency, 1, 3 );
525  Class.CastTo(w, m_Notifiers.FindAnyWidget( widget_name ) );
526  if( w )
527  w.Show( true );
528  }
529  }
530 
531  void DisplayTendencyNormal( int key, int tendency, int status )
532  {
533  ImageWidget w;
534  Class.CastTo(w, m_Notifiers.FindAnyWidget( String( "Icon" + m_StatesWidgetNames.Get( key ) ) ) );
535 
536  if( w )
537  {
538  w.SetImage( Math.Clamp( status - 1, 0, 4 ) );
539  float alpha = w.GetAlpha();
540 
541  switch( status )
542  {
543  case 3:
544  w.SetColor( ARGB( alpha * 255, 220, 220, 0 ) ); //yellow
545  m_TendencyStatusCritical.Remove( w ); //remove from blinking group
546  break;
547  case 4:
548  w.SetColor( ARGB( alpha * 255, 220, 0, 0 ) ); //red
549  m_TendencyStatusCritical.Remove( w ); //remove from blinking group
550  break;
551  case 5:
552  if ( !m_TendencyStatusCritical.Contains( w ) )
553  {
554  m_TendencyStatusCritical.Insert( w, ARGB( alpha * 255, 220, 0, 0 ) ); //add to blinking group
555  }
556  break;
557  default:
558  w.SetColor( ARGB( alpha * 255, 220, 220, 220 ) ); //white
559  m_TendencyStatusCritical.Remove( w ); //remove from blinking group
560  break;
561  }
562  }
563  }
564 
565  void DisplayTendencyTemp( int key, int tendency, int status )
566  {
567  ImageWidget w = ImageWidget.Cast( m_Notifiers.FindAnyWidget( String( "Icon" + m_StatesWidgetNames.Get( key ) ) ) );
568  TextWidget temp_top = TextWidget.Cast( m_Notifiers.FindAnyWidget( "TemperatureValueTop" ) );
569  TextWidget temp_bot = TextWidget.Cast( m_Notifiers.FindAnyWidget( "TemperatureValueBottom" ) );
570  //string temp = player..ToString() + "°C";
571  float alpha = w.GetAlpha();
572 
573  if ( tendency < 0 )
574  {
575  temp_top.Show( true );
576  temp_bot.Show( false );
577  }
578  else
579  {
580  temp_top.Show( false );
581  temp_bot.Show( true );
582  }
583 
584  switch( status )
585  {
586  case 2:
587  w.SetColor( ARGB( alpha * 255, 220, 220, 0 ) ); //WARNING_PLUS
588  m_TendencyStatusCritical.Remove( w );
589  w.SetImage( 1 );
590 
591  break;
592  case 3:
593  w.SetColor( ARGB( alpha * 255, 220, 0, 0 ) ); //CRITICAL_PLUS
594  m_TendencyStatusCritical.Remove( w );
595  w.SetImage( 0 );
596  break;
597  case 4:
598  if ( !m_TendencyStatusCritical.Contains( w ) ) //BLINKING_PLUS
599  {
600  m_TendencyStatusCritical.Insert( w, ARGB( alpha * 255, 220, 0, 0 ) );
601  }
602  w.SetImage( 0 );
603  break;
604  case 5:
605  w.SetColor( ARGB( alpha * 255, 0, 206, 209 ) ); //WARNING_MINUS
606  m_TendencyStatusCritical.Remove( w );
607  w.SetImage( 3 );
608  break;
609  case 6:
610  w.SetColor( ARGB( alpha * 255, 30, 144, 220 ) ); //CRITICAL_MINUS
611  m_TendencyStatusCritical.Remove( w );
612  w.SetImage( 4 );
613  break;
614  case 7: //BLINKING_MINUS
615  if ( !m_TendencyStatusCritical.Contains( w ) )
616  {
617  m_TendencyStatusCritical.Insert( w, ARGB( alpha * 255, 30, 144, 220 ) );
618  }
619  w.SetImage( 4 );
620  break;
621  default:
622  w.SetColor( ARGB( alpha * 255, 220, 220, 220 ) ); //DEFAULT
623  m_TendencyStatusCritical.Remove( w );
624  w.SetImage( 2 );
625  break;
626  }
627  }
628 
629  override void DisplayBadge( int key, int value )
630  {
631  TextWidget bleed_count = TextWidget.Cast( m_Badges.FindAnyWidget( "BleedingCount" ) );
632 
633  m_BadgesWidgetDisplay.Set( key, value );
634  m_AnyBadgeVisible = false;
635  for ( int i = 0; i < m_BadgesWidgetDisplay.Count(); i++ )
636  {
637  int badge_key = m_BadgesWidgetDisplay.GetKey( i );
638  int badge_value = m_BadgesWidgetDisplay.Get( badge_key );
639  string badge_name = m_BadgesWidgetNames.Get( badge_key );
640 
641  ImageWidget badge_widget
642  Class.CastTo(badge_widget, m_Badges.FindAnyWidget( badge_name ) );
643  if ( badge_widget )
644  {
645  if ( badge_value > 0 )
646  {
647  if (m_BadgesSupportedLevels.Contains(badge_key))
648  {
649  int levelIndex = badge_value - 1;
650  int maxSupportedIndex = m_BadgesSupportedLevels.Get(badge_key) - 1;
651  if (maxSupportedIndex >= levelIndex)
652  badge_widget.SetImage(levelIndex);
653  }
654 
655  badge_widget.Show( true );
656  m_AnyBadgeVisible = true;
657  if( badge_key == NTFKEY_BLEEDISH )
658  {
659  bleed_count.Show( true );
660  bleed_count.SetText( m_BadgesWidgetDisplay.Get( badge_key ).ToString() );
661  }
662  }
663  else
664  {
665  if( badge_key == NTFKEY_BLEEDISH )
666  {
667  bleed_count.Show( false );
668  }
669  badge_widget.Show( false );
670  }
671  }
672  }
673 
674  RefreshHudVisibility();
675  }
676 
677  override void SetTemperature( string temp )
678  {
679  m_IsTemperatureVisible = true;
680  TextWidget temp_top = TextWidget.Cast( m_Notifiers.FindAnyWidget( "TemperatureValueTop" ) );
681  TextWidget temp_bot = TextWidget.Cast( m_Notifiers.FindAnyWidget( "TemperatureValueBottom" ) );
682  temp_top.SetText( temp );
683  temp_bot.SetText( temp );
684  m_TemperatureTimer = 0;
685  }
686 
687  void HideTemperature()
688  {
689  m_IsTemperatureVisible = false;
690  TextWidget temp_top = TextWidget.Cast( m_Notifiers.FindAnyWidget( "TemperatureValueTop" ) );
691  TextWidget temp_bot = TextWidget.Cast( m_Notifiers.FindAnyWidget( "TemperatureValueBottom" ) );
692  temp_top.SetText( "" );
693  temp_bot.SetText( "" );
694  m_TemperatureTimer = 0;
695  }
696 
697  override void SetStaminaBarVisibility( bool show )
698  {
699  //m_StaminaBackground.Show( show );
700  //m_Stamina.Show( show );
701  if ( show )
702  {
703  m_Stamina.SetAlpha(1);
704  //m_Stamina.SetTextColor( ColorManager.COLOR_NORMAL_TEXT );
705  }
706  else
707  {
708  m_Stamina.SetAlpha(0.3);
709  //m_Stamina.SetTextColor( ColorManager.RED_COLOR );
710  }
711 
712  m_IsStaminaVisible = show;
713  m_StaminaTimer = 0;
714  }
715 
716  // state 0 = empty
717  // state 1 = digesting
718  // state 2 = full
719  void SetStomachState( int state )
720  {
721  ImageWidget stomach = ImageWidget.Cast( m_Badges.FindAnyWidget( "Stomach" ) );
722  stomach.LoadImageFile( 0, "set:dayz_gui image:iconStomach" + state );
723  }
724 
725  override void SetStamina( int value , int range )
726  {
727  float sx, sy;
728  float max = CfgGameplayHandler.GetStaminaMax();
729  float percentage = 1;
730  if (max != 0)
731  {
732  percentage = range / max;
733  }
734 
735  if (range != 0)
736  {
737  m_Stamina.SetCurrent(( value / range ) * 100);
738  }
739  else
740  {
741  m_Stamina.SetCurrent(0);
742  }
743 
744  m_Stamina.GetSize(sx, sy);
745  m_Stamina.SetSize(percentage, sy);
746  m_StaminaBackground.SetSize(1 - percentage, sy);
747 
748  // set health & blood values
749  if (!GetGame().IsMultiplayer())
750  {
751  if (GetGame().GetPlayer())
752  {
753  PlayerBase player;
754  Class.CastTo(player, GetGame().GetPlayer());
755 
756  if (player)
757  {
758  float h1 = player.GetHealth("","");
759  float b1 = player.GetHealth("","Blood");
760 
761  GetDayZGame().GetBacklit().SetHealth(h1);
762  GetDayZGame().GetBacklit().SetBlood(b1);
763  }
764  }
765  }
766 
767  // update backlit
768  GetDayZGame().GetBacklit().UpdatePlayer(false);
769  }
770 
771  bool KeyPress(int key)
772  {
773  return false;
774  }
775 
776  void ZeroingKeyPress()
777  {
778  m_ZeroingKeyPressed = true;
779  }
780 
781  override void DisplayStance( int stance )
782  {
783  PlayerBase player;
784  Class.CastTo(player, GetGame().GetPlayer() );
785  Car car;
786  if ( !Class.CastTo(car, player.GetDrivingVehicle()) )
787  {
788  if( stance == 1 )
789  {
790  bool is_walking;
791  m_StanceStand.Show(!is_walking);
792  m_StanceStandWalk.Show(is_walking);
793  m_StanceCrouch.Show(false);
794  m_StanceProne.Show(false);
795  m_StanceCar.Show( false );
796  }
797  if( stance == 2 )
798  {
799  m_StanceStand.Show(false);
800  m_StanceStandWalk.Show(false);
801  m_StanceCrouch.Show(true);
802  m_StanceProne.Show(false);
803  m_StanceCar.Show( false );
804  }
805  if( stance == 3 )
806  {
807  m_StanceStand.Show(false);
808  m_StanceStandWalk.Show(false);
809  m_StanceCrouch.Show(false);
810  m_StanceProne.Show(true);
811  m_StanceCar.Show( false );
812  }
813  }
814  else
815  {
816  m_StanceStand.Show(false);
817  m_StanceCrouch.Show(false);
818  m_StanceProne.Show(false);
819  m_StanceCar.Show( true );
820  }
821  }
822 
823  override void DisplayPresence()
824  {
825  PlayerBase player;
826 
827  if ( Class.CastTo(player, GetGame().GetPlayer()) )
828  {
829  int presence_level = player.GetNoisePresenceInAI();
830  m_PresenceLevel0.Show( false );
831  m_PresenceLevel1.Show( false );
832  m_PresenceLevel2.Show( false );
833  m_PresenceLevel3.Show( false );
834  m_PresenceLevel4.Show( false );
835 
836  if ( presence_level > 0 )
837  {
838  m_PresenceLevel0.Show( true );
839  }
840  if ( presence_level > 1 )
841  {
842  m_PresenceLevel1.Show( true );
843  }
844  if ( presence_level > 2 )
845  {
846  m_PresenceLevel2.Show( true );
847  }
848  if ( presence_level > 3 )
849  {
850  m_PresenceLevel3.Show( true );
851  }
852  if ( presence_level > 4 )
853  {
854  m_PresenceLevel4.Show( true );
855  }
856  }
857  }
858 
859  int m_VehicleGearCount = -1;
860  float m_TimeSinceLastEngineLightChange;
861  bool m_VehicleHasOil;
862  bool m_VehicleHasCoolant;
863 
864  override void ShowVehicleInfo()
865  {
866  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
867  if (player)
868  {
869  HumanCommandVehicle hcv = player.GetCommand_Vehicle();
870  if (hcv)
871  {
872  m_CurrentVehicle = CarScript.Cast(hcv.GetTransport());
873  if (m_CurrentVehicle)
874  {
875  m_InVehicleAsDriver = true;
876  m_VehicleGearCount = m_CurrentVehicle.GetGearsCount();
877  m_VehicleOilLight.Show(m_VehicleHasOil);
878 
879  float rpm_value_red = m_CurrentVehicle.EngineGetRPMRedline() / m_CurrentVehicle.EngineGetRPMMax();
880  m_VehicleRPMDial.SetMaskProgress(rpm_value_red);
881  m_VehicleRPMRedline.SetMaskProgress(1 - rpm_value_red);
882 
883  m_HudPanelWidget.FindAnyWidget("PlayerPanel").Show(false);
884  m_Presence.Show(false);
885  m_StancePanel.Show(false);
886 
887  m_VehiclePanel.Show(true);
888  }
889  }
890  }
891  }
892 
893  override void HideVehicleInfo()
894  {
895  m_HudPanelWidget.FindAnyWidget("PlayerPanel").Show(true);
896  m_Presence.Show(true);
897  m_StancePanel.Show(true);
898  m_VehiclePanel.Show(false);
899 
900  m_InVehicleAsDriver = false;
901  m_CurrentVehicle = null;
902  m_VehicleGearCount = -1;
903  }
904 
905  void RefreshVehicleHud(float timeslice)
906  {
907  if (m_CurrentVehicle && !GetGame().GetUIManager().GetMenu())
908  {
909  m_VehiclePanel.Show(true);
910  float rpm_value = m_CurrentVehicle.EngineGetRPM() / m_CurrentVehicle.EngineGetRPMMax();
911  float rpm_value_red = m_CurrentVehicle.EngineGetRPMRedline() / m_CurrentVehicle.EngineGetRPMMax();
912  float speed_value = m_CurrentVehicle.GetSpeedometerAbsolute() / 200;
913 
914  m_VehicleRPMPointer.SetRotation(0, 0, rpm_value * 270 - 130, true);
915  m_VehicleSpeedPointer.SetRotation(0, 0, speed_value * 260 - 130, true);
916  m_VehicleSpeedValue.SetText(Math.AbsInt(m_CurrentVehicle.GetSpeedometer()).ToString());
917 
918  int engineHealthLevel = m_CurrentVehicle.GetHealthLevel("Engine");
919  int fuelTankHealthLevel = m_CurrentVehicle.GetHealthLevel("FuelTank");
920  bool newHealth = false;
921 
923  if (m_CurrentVehicle.HasEngineZoneReceivedHit())
924  {
925  if (m_TimeSinceLastEngineLightChange > 0.35)
926  {
927  m_VehicleEngineLight.Show(!m_VehicleEngineLight.IsVisible());
928  if (engineHealthLevel <= GameConstants.STATE_WORN)
929  {
930  m_VehicleEngineLight.SetColor(Colors.WHITE);
931  }
932  else
933  {
934  m_VehicleEngineLight.SetColor(ItemManager.GetItemHealthColor(engineHealthLevel));
935  }
936 
937  m_VehicleEngineLight.SetAlpha(1);
938  m_TimeSinceLastEngineLightChange = 0;
939  }
940 
941  m_TimeSinceLastEngineLightChange += timeslice;
942  newHealth = true;
943  }
944  else if (engineHealthLevel > GameConstants.STATE_WORN)
945  {
946  m_VehicleEngineLight.SetColor(ItemManager.GetItemHealthColor(engineHealthLevel));
947  m_VehicleEngineLight.SetAlpha(1);
948  m_VehicleEngineLight.Show(true);
949  }
950  else
951  {
952  m_VehicleEngineLight.Show(false);
953  }
954 
956  if (fuelTankHealthLevel <= GameConstants.STATE_WORN)
957  {
958  m_VehicleFuelLight.SetColor(Colors.WHITE);
959  m_VehicleFuelLight.SetAlpha(1);
960  m_VehicleFuelLight.Show(true);
961  }
962  else if (fuelTankHealthLevel > GameConstants.STATE_WORN)
963  {
964  m_VehicleFuelLight.SetColor(ItemManager.GetItemHealthColor(fuelTankHealthLevel));
965  m_VehicleFuelLight.SetAlpha(1);
966  m_VehicleFuelLight.Show(true);
967  }
968 
970  if (m_CurrentVehicle.IsVitalRadiator())
971  {
972  m_VehicleTemperatureIndicator.Show(true);
973  if (m_CurrentVehicle.HasRadiator())
974  {
975  int radiatorHealthLevel = m_CurrentVehicle.GetRadiator().GetHealthLevel("");
976  if (radiatorHealthLevel <= GameConstants.STATE_WORN)
977  {
978  m_VehicleTemperatureLight.SetColor(Colors.WHITE);
979  m_VehicleTemperatureLight.SetAlpha(1);
980  m_VehicleTemperatureLight.Show(true);
981  }
982  else if (radiatorHealthLevel > GameConstants.STATE_WORN)
983  {
984  m_VehicleTemperatureLight.SetColor(ItemManager.GetItemHealthColor(radiatorHealthLevel));
985  m_VehicleTemperatureLight.SetAlpha(1);
986  m_VehicleTemperatureLight.Show(true);
987  }
988  }
989  else
990  {
991  m_VehicleTemperatureLight.SetColor(Colors.COLOR_RUINED);
992  m_VehicleTemperatureLight.SetAlpha(1);
993  m_VehicleTemperatureLight.Show(true);
994  }
995  }
996  else
997  {
998  m_VehicleTemperatureIndicator.Show(false);
999  }
1000 
1001  m_VehicleHandBrakeLight.Show(m_CurrentVehicle.IsHandbrakeActive());
1002  m_VehicleWheelLight.Show(m_CurrentVehicle.WheelIsAnyLocked());
1003 
1004 
1005  int engagedGear = -1;
1006  int prevGear = -1;
1007  int nextGear = -1;
1008 
1009  if (m_CurrentVehicle.GearboxGetType() == CarGearboxType.MANUAL)
1010  {
1011  engagedGear = m_CurrentVehicle.GetGear();
1012  prevGear = engagedGear - 1;
1013  nextGear = engagedGear + 1;
1014 
1015  if (engagedGear == CarGear.NEUTRAL)
1016  {
1017  prevGear = CarGear.REVERSE;
1018  }
1019  else if (engagedGear == CarGear.REVERSE)
1020  {
1021  prevGear = -1;
1022  nextGear = CarGear.NEUTRAL;
1023  }
1024 
1025  m_VehicleCurrentGearValue.SetText(m_VehicleGearTable.Get(engagedGear));
1026  m_VehicleNextGearValue.Show(nextGear < m_VehicleGearCount);
1027 
1028  m_VehicleNextGearValue.SetText(m_VehicleGearTable.Get(nextGear));
1029  m_VehiclePrevGearValue.SetText(m_VehicleGearTable.Get(prevGear));
1030  }
1031  else
1032  {
1033  engagedGear = m_CurrentVehicle.GearboxGetMode();
1034  prevGear = engagedGear - 1;
1035  nextGear = engagedGear + 1;
1036 
1037  m_VehicleCurrentGearValue.SetText(m_VehicleGearTableAuto.Get(engagedGear));
1038  m_VehicleNextGearValue.Show(nextGear < EnumTools.GetEnumSize(CarAutomaticGearboxMode));
1039 
1040  m_VehicleNextGearValue.SetText(m_VehicleGearTableAuto.Get(nextGear));
1041  m_VehiclePrevGearValue.SetText(m_VehicleGearTableAuto.Get(prevGear));
1042  }
1043 
1044  // refresh backlit
1045  GetDayZGame().GetBacklit().RefreshVehicleLayout(engagedGear, newHealth);
1046 
1047  m_VehicleFuelPointer.SetRotation( 0, 0, m_CurrentVehicle.GetFluidFraction( CarFluid.FUEL ) * 260 - 130, true );
1048  m_VehicleTemperaturePointer.SetRotation( 0, 0, -1 * m_CurrentVehicle.GetFluidFraction( CarFluid.COOLANT ) * 260 + 130, true );
1049 
1051  if (m_VehicleDamageZonesHitTimer > 1)
1052  {
1053  m_VehicleDamageZoneHitEngineState = false;
1054  m_VehicleDamageZonesHitTimer = 0;
1055  }
1056 
1057  m_VehicleDamageZonesHitTimer += timeslice;
1058  }
1059  else
1060  {
1061  m_VehiclePanel.Show(false);
1062  }
1063  }
1064 
1065  void InitQuickbar()
1066  {
1067  if (m_Quickbar == NULL)
1068  {
1069  m_Quickbar = new InventoryQuickbar( m_QuickbarWidget );
1070  }
1071  }
1072 
1073  InventoryQuickbar GetQuickbar()
1074  {
1075  return m_Quickbar;
1076  }
1077 
1078  bool IsQuickbarVisible()
1079  {
1080  return m_IsQuickbarVisible;
1081  }
1082 
1083  bool IsHudVisible()
1084  {
1085  return m_IsHudVisible;
1086  }
1087 
1088  override void UpdateQuickbarGlobalVisibility()
1089  {
1090  #ifdef PLATFORM_CONSOLE
1091  ShowQuickBar(GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer());
1092  #else
1093  ShowQuickBar(g_Game.GetProfileOption(EDayZProfilesOptions.QUICKBAR));
1094  #endif
1095  }
1096 
1097  void RefreshQuickbarVisibility()
1098  {
1099  m_IsQuickbarVisible = !m_QuickbarHideUI && !m_QuickbarHidePlayer && m_QuickbarState;
1100  m_QuickbarWidget.Show( m_IsQuickbarVisible );
1101  }
1102 
1103  void RefreshHudVisibility()
1104  {
1105  m_IsHudVisible = ( !m_HudHidePlayer && !m_HudHideUI && m_HudState ) || m_HudInventory;
1106 
1107  SetLeftStatsVisibility( m_IsHudVisible );
1108  m_Badges.Show( m_IsHudVisible );
1109  m_Notifiers.Show( m_IsHudVisible );
1110  m_BadgeNotifierDivider.Show( m_IsHudVisible && m_AnyBadgeVisible );
1111  #ifdef PLATFORM_CONSOLE
1112  m_SpecializatonPanel.Show(m_HudInventory);
1113  #else
1114  m_SpecializatonPanel.Show(false);
1115  #endif
1116  }
1117 
1118  void UpdateSpecialtyMeter(float x, float y)
1119  {
1120  #ifdef PLATFORM_CONSOLE
1121  m_SpecializationIcon.SetPos(x, y, true);
1122  #endif
1123  }
1124 
1125  bool IsHideQuickbarPlayer()
1126  {
1127  return m_QuickbarHidePlayer;
1128  }
1129 
1130  bool IsHideHudPlayer()
1131  {
1132  return m_HudHidePlayer;
1133  }
1134 
1135  override void ShowQuickbarUI( bool show )
1136  {
1137  m_QuickbarHideUI = !show;
1138  RefreshQuickbarVisibility();
1139  }
1140 
1141  override void ShowQuickbarPlayer( bool show )
1142  {
1143  m_QuickbarHidePlayer = !show;
1144  RefreshQuickbarVisibility();
1145  }
1146 
1147  override void ShowHudPlayer( bool show )
1148  {
1149  m_HudHidePlayer = !show;
1150  if (m_HudState)
1151  {
1152  RefreshHudVisibility();
1153  }
1154  }
1155 
1156  override void ShowHudUI( bool show )
1157  {
1158  m_HudHideUI = !show;
1159  if (m_HudState)
1160  {
1161  RefreshHudVisibility();
1162  }
1163  }
1164 
1165  override void ShowHudInventory( bool show )
1166  {
1167  m_HudInventory = show;
1168  RefreshHudVisibility();
1169  }
1170 
1171  override void ToggleHeatBufferPlusSign( bool show )
1172  {
1173  m_HeatBufferPlus.Show( show );
1174  }
1175 
1177  override void ShowQuickBar( bool show )
1178  {
1179  m_QuickbarState = show;
1180  //shown by default
1181  m_QuickbarHidePlayer = false;
1182  RefreshQuickbarVisibility();
1183  }
1184 
1185  override void ShowHud( bool show )
1186  {
1187  m_HudState = show;
1188  m_HudHidePlayer = false;
1189  RefreshHudVisibility();
1190  }
1191 
1192  bool GetQuickBarState()
1193  {
1194  return m_QuickbarState;
1195  }
1196 
1197  bool GetHudState()
1198  {
1199  return m_HudState;
1200  }
1201 
1202 
1203 
1204  override void SetConnectivityStatIcon(EConnectivityStatType type, EConnectivityStatLevel level)
1205  {
1206  if (type == EConnectivityStatType.PING)
1207  {
1208  switch (level)
1209  {
1210  case EConnectivityStatLevel.OFF:
1211  m_HighPingA.Show(false);
1212  m_HighPingB.Show(false);
1213  break;
1214  case EConnectivityStatLevel.LEVEL1:
1215  m_HighPingA.Show(true);
1216  m_HighPingB.Show(false);
1217  break;
1218  case EConnectivityStatLevel.LEVEL2:
1219  m_HighPingA.Show(false);
1220  m_HighPingB.Show(true);
1221  break;
1222  }
1223  }
1224  else if (type == EConnectivityStatType.SERVER_PERF)
1225  {
1226  switch (level)
1227  {
1228  case EConnectivityStatLevel.OFF:
1229  m_LowServerPerfA.Show(false);
1230  m_LowServerPerfB.Show(false);
1231  break;
1232  case EConnectivityStatLevel.LEVEL1:
1233  m_LowServerPerfA.Show(true);
1234  m_LowServerPerfB.Show(false);
1235  break;
1236  case EConnectivityStatLevel.LEVEL2:
1237  m_LowServerPerfA.Show(false);
1238  m_LowServerPerfB.Show(true);
1239  break;
1240  }
1241  }
1242  else if (type == EConnectivityStatType.CONN_LOST)
1243  {
1244  switch (level)
1245  {
1246  case EConnectivityStatLevel.OFF:
1247  m_ConnectionLost.Show(false);
1248  break;
1249  case EConnectivityStatLevel.LEVEL1:
1250  m_ConnectionLost.Show(true);
1251  break
1252  }
1253  }
1254  }
1255 
1257  void SetLeftStatsVisibility(bool visible)
1258  {
1259  Widget child = m_LeftHudPanelWidget.GetChildren();
1260  while (child)
1261  {
1262  if (child.GetName() == "ChatFrameWidget")
1263  {
1264  child = child.GetSibling();
1265  continue
1266  }
1267 
1268  child.Show(visible);
1269  child = child.GetSibling();
1270  }
1271  }
1272 
1273  override void RefreshQuickbar( bool itemChanged = false )
1274  {
1275  if ((!m_QuickbarState || m_QuickbarHidePlayer || m_QuickbarHideUI) && !itemChanged) // Don't update when it is hidden or disabled
1276  return;
1277 
1278  if ( itemChanged )
1279  {
1280  UIManager manager = GetGame().GetUIManager();
1281 
1282  InventoryMenu inventory = InventoryMenu.Cast(manager.FindMenu( MENU_INVENTORY ));
1283  MissionGameplay mission = MissionGameplay.Cast(GetGame().GetMission());
1284 
1285  if ( mission )
1286  {
1287  inventory = mission.GetInventory();
1288  }
1289 
1290  if ( inventory )
1291  {
1292  inventory.RefreshQuickbar();
1293  }
1294  }
1295 
1296  if ( m_Quickbar )
1297  {
1298  m_Quickbar.UpdateItems( m_QuickbarWidget );
1299  }
1300  }
1301 
1302  Widget GetHudPanelWidget()
1303  {
1304  return m_HudPanelWidget;
1305  }
1306 
1307  override void UpdateBloodName()
1308  {
1309  PlayerBase player;
1310  Class.CastTo(player, GetGame().GetPlayer() );
1311 
1312  if( player )
1313  {
1314  string blood_name;
1315  bool positive;
1316  BloodTypes.GetBloodTypeName( player.GetBloodType(), blood_name, positive );
1317  bool blood_type_visible = player.HasBloodTypeVisible();
1318 
1319  if( blood_type_visible )
1320  {
1321  m_BloodType.SetText( blood_name );
1322  if( positive )
1323  m_BloodPosType.SetText( "+" );
1324  else
1325  m_BloodPosType.SetText( "-" );
1326  }
1327  else
1328  {
1329  m_BloodType.SetText( "" );
1330  m_BloodPosType.SetText( "" );
1331  }
1332  }
1333  }
1334 
1335  void RefreshPlayerTags()
1336  {
1337  if( GetGame().GetPlayer() )
1338  {
1339  bool found = false;
1340  vector head_pos = GetGame().GetCurrentCameraPosition();
1341  float distance;
1342  foreach( Man player : ClientData.m_PlayerBaseList )
1343  {
1344  vector target_player = player.GetPosition();
1345  distance = vector.Distance( head_pos, target_player );
1346 
1347  target_player[1] = target_player[1] + 1.2;
1348 
1349  if( distance <= 15 && player != GetGame().GetPlayer() )
1350  {
1351  vector screen_pos = GetGame().GetScreenPosRelative( target_player );
1352  vector end_pos = head_pos + GetGame().GetCurrentCameraDirection() * 25;
1353  RaycastRVParams params = new RaycastRVParams( head_pos, end_pos, GetGame().GetPlayer(), 0 );
1354  params.sorted = true;
1355 
1357  DayZPhysics.RaycastRVProxy( params, results );
1358  if( results.Count() > 0 )
1359  {
1360  if( results.Get( 0 ).obj == player )
1361  {
1362  m_CurrentTaggedPlayer = PlayerBase.Cast( player );
1363  found = true;
1364  }
1365  }
1366  }
1367  }
1368  if( !found )
1369  {
1370  m_CurrentTaggedPlayer = null;
1371  }
1372  }
1373  }
1374 
1375  int m_PlayerSpineIndex;
1376  PlayerBase m_CurrentTaggedPlayer;
1377  Widget m_PlayerTag;
1378  TextWidget m_PlayerTagText;
1379 
1380  void ShowPlayerTag( float timeslice )
1381  {
1382  if ( m_CurrentTaggedPlayer && m_CurrentTaggedPlayer.GetIdentity() )
1383  {
1384  if ( !m_PlayerTag )
1385  {
1386  m_PlayerTag = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/hud/hud_player_tag.layout");
1387  m_PlayerTagText = TextWidget.Cast( m_PlayerTag.FindAnyWidget( "TagText" ) );
1388  }
1389  m_PlayerSpineIndex = m_CurrentTaggedPlayer.GetBoneIndex( "Spine2" );
1390  vector player_pos = m_CurrentTaggedPlayer.GetBonePositionWS( m_PlayerSpineIndex );
1391  vector screen_pos = GetGame().GetScreenPosRelative( player_pos );
1392 
1393  if ( screen_pos[2] > 0 )
1394  {
1395  if ( screen_pos[0] > 0 && screen_pos[0] < 1 )
1396  {
1397  if ( screen_pos[1] > 0 && screen_pos[1] < 1 )
1398  {
1399  m_PlayerTagText.SetAlpha( Math.Clamp( m_PlayerTagText.GetAlpha() + timeslice * 10, 0, 1 ) );
1400  m_PlayerTag.SetPos( 0.55, 0.55 );
1401  m_PlayerTagText.SetText( m_CurrentTaggedPlayer.GetIdentity().GetPlainName() );
1402 
1403  //m_PlayerTagText.SetSize( 1, 1 - screen_pos[2] / 25 );
1404  return;
1405  }
1406  }
1407  }
1408  }
1409 
1410  if ( m_PlayerTag )
1411  {
1412  float new_alpha = Math.Clamp( m_PlayerTagText.GetAlpha() - timeslice * 10, 0, 1 );
1413  m_PlayerTagText.SetAlpha( Math.Clamp( m_PlayerTagText.GetAlpha() - timeslice * 10, 0, 1 ) );
1414  if ( new_alpha == 0 )
1415  {
1416  m_PlayerTagText.SetText( "" );
1417  m_CurrentTaggedPlayer = null;
1418  }
1419  }
1420  }
1421 
1422  override void Update( float timeslice )
1423  {
1424  super.Update( timeslice );
1425 
1426  m_ActionTargetsCursor.Update();
1427  DisplayPresence();
1428  //
1429  //modifiers - tendency status (critical)
1430  if ( m_BlinkTime > TENDENCY_BLINK_TIME )
1431  {
1432  //get color & alpha
1433  if ( m_TendencyStatusCritical.Count() > 0 )
1434  {
1435  for ( int i = 0; i < m_TendencyStatusCritical.Count(); ++i )
1436  {
1437 
1438  ImageWidget widget = m_TendencyStatusCritical.GetKey( i );
1439  int alpha = widget.GetAlpha() * 255;
1440  int color;
1441  int colorA = ARGB( alpha, 255, 255, 255 );
1442  int colorB = m_TendencyStatusCritical.Get( widget );
1443 
1444  //set new color to different color
1445  if ( widget.GetColor() == colorA )
1446  {
1447  color = colorB;
1448  }
1449  else
1450  {
1451  color = colorA;
1452  }
1453 
1454  widget.SetColor( color );
1455  }
1456  }
1457 
1458  m_BlinkTime = 0; //reset
1459  }
1460  else
1461  {
1462  m_BlinkTime += timeslice;
1463  }
1464 
1465  if( m_IsTemperatureVisible )
1466  {
1467  m_TemperatureTimer += timeslice;
1468  if( m_TemperatureTimer > m_TemperatureShowTime )
1469  {
1470  HideTemperature();
1471  }
1472  }
1473 
1474  if ( !m_IsStaminaVisible )
1475  {
1476  m_StaminaTimer += timeslice;
1477  if ( m_StaminaTimer > m_StaminaShowTime )
1478  {
1479  SetStaminaBarVisibility( true );
1480  }
1481 
1482  }
1483 
1484  if ( m_HitDirEffectArray && m_HitDirEffectArray.Count() > 0 )
1485  {
1486  UpdateHitDirEffects(timeslice);
1487  CleanupHitDirEffects();
1488  }
1489 
1490  RefreshVehicleHud(timeslice);
1491 
1492  #ifdef PLATFORM_PS4
1493  RefreshPlayerTags();
1494  ShowPlayerTag(timeslice);
1495  #endif
1496  }
1497 
1498  override void SpawnHitDirEffect(DayZPlayer player, float hit_direction,float intensity_max)
1499  {
1500  if (HitDirectionEffectBase.m_Mode == HitDirectionModes.DISABLED)
1501  {
1502  return;
1503  }
1504 
1505  if (m_HitDirEffectArray == null)
1506  {
1507  m_HitDirEffectArray = new array<ref HitDirectionEffectBase>;
1508  }
1509  HitDirectionEffectBase hiteff = HitDirectionEffectBase.Cast(HitDirectionEffectBase.GetCurrentType().Spawn());
1510  hiteff.Init(player,hit_direction,intensity_max);
1511  m_HitDirEffectArray.Insert(hiteff);
1512  }
1513 
1514  void UpdateHitDirEffects( float timeslice )
1515  {
1516  for (int i = 0; i < m_HitDirEffectArray.Count(); i++)
1517  {
1518  m_HitDirEffectArray[i].Update(timeslice);
1519  }
1520  }
1521 
1522  void CleanupHitDirEffects()
1523  {
1524  for (int i = m_HitDirEffectArray.Count() - 1; i > -1; i--)
1525  {
1526  if ( m_HitDirEffectArray[i].DurationCheck() )
1527  {
1528  m_HitDirEffectArray.Remove(i);
1529  }
1530  }
1531  }
1532 
1533  void Debug()
1534  {
1535  foreach (int val:m_BadgesWidgetDisplay)
1536  {
1537  int key = m_BadgesWidgetDisplay.GetKeyByValue(val);
1538  Print(EnumTools.EnumToString(eDisplayElements, key));
1539  Print(val);
1540  Print("---------------------");
1541  }
1542  }
1543 
1544 //------------------------------------------
1545 //ye olde unused methods
1546 
1547  //DEPRECATED
1548  void HideQuickbarTimer()
1549  {
1550  }
1551 }
GetGame
proto native CGame GetGame()
NTFKEY_THIRSTY
enum eBadgeLevel NTFKEY_THIRSTY
RefreshQuickbar
void RefreshQuickbar()
Definition: inventorymenu.c:75
mission
Mission mission
Definition: displaystatus.c:28
EDayZProfilesOptions
EDayZProfilesOptions
Definition: edayzprofilesoptions.c:1
CALL_CATEGORY_GAMEPLAY
const int CALL_CATEGORY_GAMEPLAY
Definition: tools.c:10
NTFKEY_STUFFED
const int NTFKEY_STUFFED
Definition: _constants.c:41
String
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
Definition: enscript.c:339
m_QuickbarWidget
protected Widget m_QuickbarWidget
Definition: inventory.c:34
GetDayZGame
DayZGame GetDayZGame()
Definition: dayzgame.c:3729
Show
proto native void Show(bool show, bool immedUpdate=true)
ActionTargetsCursor
Definition: actiontargetscursor.c:53
CursorIcons
Definition: gameplay.c:575
m_Timer
ref Timer m_Timer
Definition: dayzgame.c:690
NTFKEY_HUNGRY
const int NTFKEY_HUNGRY
Definition: _constants.c:34
CarScript
Definition: civiliansedan.c:1
y
Icon y
Print
proto void Print(void var)
Prints content of variable to console/log.
EConnectivityStatType
EConnectivityStatType
Definition: egamestateicons.c:1
NTFKEY_FEVERISH
const int NTFKEY_FEVERISH
Definition: _constants.c:39
ClientData
Definition: clientdata.c:1
m_SpecializationIcon
protected Widget m_SpecializationIcon
Definition: inventory.c:36
DayZPlayer
Definition: dayzplayerimplement.c:72
MENU_INVENTORY
const int MENU_INVENTORY
Definition: constants.c:170
Colors
Definition: colors.c:3
m_BloodType
protected ref map< PlayerBase, int > m_BloodType
Definition: pluginlifespan.c:35
HitDirectionModes
HitDirectionModes
Definition: constants.c:97
UIManager
Definition: uimanager.c:1
CarGearboxType
CarGearboxType
Enumerated gearbox types. (native, do not change or extend)
Definition: car.c:34
CarFluid
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition: car.c:18
m_Notifiers
ref array< ref NotifierBase > m_Notifiers
Definition: notifiersmanager.c:29
PlayerBase
Definition: playerbaseclient.c:1
RaycastRVParams
Definition: dayzphysics.c:49
map
map
Definition: controlsxboxnew.c:3
vector
Definition: enconvert.c:105
NTFKEY_LEGS
const int NTFKEY_LEGS
Definition: _constants.c:49
Init
class InventoryGridController extends ScriptedWidgetEventHandler Init
Definition: uihintpanel.c:46
TextWidget
Definition: enwidgets.c:219
NTFKEY_SICK
const int NTFKEY_SICK
Definition: _constants.c:40
BloodTypes
Definition: bloodtype.c:1
EnumTools
Definition: enconvert.c:589
NTFKEY_PILLS
const int NTFKEY_PILLS
Definition: _constants.c:47
g_Game
DayZGame g_Game
Definition: dayzgame.c:3727
NTFKEY_BLEEDISH
const int NTFKEY_BLEEDISH
Definition: _constants.c:42
m_Quickbar
protected ref InventoryQuickbar m_Quickbar
Definition: inventory.c:32
NTFKEY_LIVES
const int NTFKEY_LIVES
Definition: _constants.c:44
ItemManager
Definition: itemmanager.c:1
HumanCommandVehicle
Definition: human.c:689
CfgGameplayHandler
Definition: cfggameplayhandler.c:1
array< ref WidgetFadeTimer >
Update
proto native volatile void Update()
Definition: playersoundmanager.c:125
HitDirectionEffectBase
Definition: hitdirectionarrow.c:2
m_Stamina
class StaminaSoundHandlerBase extends SoundHandlerBase m_Stamina
x
Icon x
GetPlayer
protected void GetPlayer()
Definition: crosshairselector.c:127
GameConstants
Definition: constants.c:612
InventoryMenu
void InventoryMenu()
Definition: inventorymenu.c:20
NTFKEY_WETNESS
const int NTFKEY_WETNESS
Definition: _constants.c:36
DayZPhysics
Definition: dayzphysics.c:123
NTFKEY_POISONED
const int NTFKEY_POISONED
Definition: _constants.c:46
SetTemperature
override void SetTemperature(float value, bool allow_client=false)
Definition: itembase.c:3499
Timer
Definition: dayzplayerimplement.c:62
NTFKEY_FRACTURE
const int NTFKEY_FRACTURE
Definition: _constants.c:37
Debug
void Debug()
Definition: universaltemperaturesource.c:297
Widget
Definition: enwidgets.c:189
GetInput
ActionInput GetInput()
Definition: actionbase.c:1066
Math
Definition: enmath.c:6
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
UpdateSpecialtyMeter
void UpdateSpecialtyMeter()
Definition: inventory.c:1186
ARGB
int ARGB(int a, int r, int g, int b)
Definition: proto.c:322
CarAutomaticGearboxMode
CarAutomaticGearboxMode
Enumerated automatic gearbox modes. (native, do not change or extend)
Definition: car.c:68
Hud
Definition: gameplay.c:623