1 class IngameHud
extends Hud
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;
11 protected const float TENDENCY_BLINK_TIME = 0.25;
12 protected float m_BlinkTime;
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;
24 protected bool m_IsStaminaVisible;
25 protected float m_StaminaTimer;
26 protected float m_StaminaShowTime = 0.15;
31 protected Widget m_HudPanelWidget;
32 protected Widget m_LeftHudPanelWidget;
36 protected Widget m_VehiclePanel;
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;
50 protected TextWidget m_VehicleCurrentGearValue;
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;
60 protected bool m_VehicleDamageZoneHitEngineState;
61 protected float m_VehicleDamageZonesHitTimer;
63 protected bool m_InVehicleAsDriver;
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;
77 protected Widget m_BadgeNotifierDivider;
79 protected ref
Timer m_HideTimer;
80 protected ref WidgetFadeTimer m_FadeTimerCrosshair;
81 protected ref WidgetFadeTimer m_FadeTimerActionCursor;
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;
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;
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;
117 protected Widget m_ActionWidget;
120 protected Widget m_ActionItemQuantityWrapper
121 protected ImageWidget m_ActionHealthMark;
122 protected ProgressBarWidget m_ActionQuantityBar;
123 protected Widget m_ActionQuantityBox;
125 protected ImageWidget m_ActionIcon;
128 protected Widget m_ActionIconFrame;
129 protected Widget m_ActionMultipleItemsFrame;
131 protected Widget m_ActionTarget;
135 protected ImageWidget m_PermanentCrossHair;
137 protected bool m_HudHideUI;
138 protected bool m_HudHidePlayer;
139 protected bool m_HudInventory;
140 protected bool m_HudState;
141 protected bool m_QuickbarHideUI;
142 protected bool m_QuickbarHidePlayer;
143 protected bool m_QuickbarState;
144 protected bool m_IsQuickbarVisible;
145 protected bool m_IsHudVisible;
146 protected bool m_Faded;
147 protected bool m_ZeroingKeyPressed;
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;
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;
177 m_VehicleDamageZonesHitTimer = 0;
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");
193 m_VehicleGearTableAuto.Set(-1,
"");
202 m_HudPanelWidget = hud_panel_widget;
203 m_HudPanelWidget.Show(
true );
210 m_LeftHudPanelWidget = m_HudPanelWidget.FindAnyWidget(
"LeftHUDPanel");
214 myTimer.Run( 1,
this,
"InitQuickbar" );
216 m_CursorWidget = m_HudPanelWidget.FindAnyWidget(
"CursorIcons");
217 m_CursorWidget.Show(
true);
218 Class.CastTo(m_CursorIcon, m_HudPanelWidget.FindAnyWidget(
"Cursor"));
221 Class.CastTo(m_PermanentCrossHair, m_HudPanelWidget.FindAnyWidget(
"PermanentCrossHair"));
223 m_WalkieTalkie = m_HudPanelWidget.FindAnyWidget(
"WalkieTalkie");
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");
232 m_BadgeNotifierDivider = m_HudPanelWidget.FindAnyWidget(
"BadgeNotifierDivider");
234 m_BloodPosType =
TextWidget.Cast( m_HudPanelWidget.FindAnyWidget(
"BloodPosType") );
236 m_VehiclePanel = m_HudPanelWidget.FindAnyWidget(
"VehiclePanel");
237 m_VehiclePanel.Show(
false);
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") );
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") );
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"));
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"));
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");
270 m_ActionTarget = m_HudPanelWidget.FindAnyWidget(
"ActionTargetsCursorWidget");
272 m_ActionTarget.GetScript(m_ActionTargetsCursor);
275 m_HeatBufferPlus = ImageWidget.Cast( m_HudPanelWidget.FindAnyWidget(
"HeatBuffer" ) );
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"));
285 if ( m_HeatBufferPlus )
286 m_HeatBufferPlus.Show(
false );
290 m_Timer.Run(0.333,
this,
"RefreshQuickbar", NULL,
true );
292 InitBadgesAndNotifiers();
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 );
305 SetLeftStatsVisibility(
true );
307 MissionGameplay.Cast(
GetGame().GetMission()).GetConnectivityInvoker().Insert(OnConnectionIconsSettingsChanged);
312 void InitBadgesAndNotifiers()
315 m_StatesWidgetNames.Clear();
316 m_StatesWidgets.Clear();
324 m_Badges.Show(
true );
328 for ( i = 0; i < m_StatesWidgetNames.Count(); i++ )
330 string widget_name = m_StatesWidgetNames.GetElement(i);
331 key = m_StatesWidgetNames.GetKey(i);
334 m_StatesWidgets.Set( key, w );
336 for (
int y = 0;
y < 5;
y++ )
338 w.LoadImageFile(
y,
"set:dayz_gui image:icon" + widget_name +
y );
342 float alpha = w.GetAlpha();
343 w.SetColor(
ARGB( alpha * 255, 220, 220, 220 ) );
344 m_TendencyStatusCritical.Remove( w );
346 for (
int x = 1;
x < 4;
x++ )
358 m_BadgesWidgetNames.Clear();
359 m_BadgesWidgets.Clear();
360 m_BadgesWidgetDisplay.Clear();
361 m_BadgesSupportedLevels.Clear();
371 m_BadgesWidgetNames.Set(
NTFKEY_LEGS,
"InjuredLegs" );
376 for ( i = 0; i < m_BadgesWidgetNames.Count(); i++ )
378 string badge_name = m_BadgesWidgetNames.GetElement( i);
379 key = m_BadgesWidgetNames.GetKey( i );
380 ImageWidget badge_widget;
383 Class.CastTo(badge_widget, m_Badges.FindAnyWidget( badge_name ) );
385 if (m_BadgesSupportedLevels.Contains(key))
387 int badgeCountMax = m_BadgesSupportedLevels.Get(key);
389 for (
int q = 0; q < badgeCountMax; q++ )
391 badge_widget.LoadImageFile( q,
"set:dayz_gui image:icon" + badge_name + q );
395 m_BadgesWidgets.Set( key, badge_widget );
396 badge_widget.Show(
false );
397 m_BadgesWidgetDisplay.Set( key,
false );
399 m_AnyBadgeVisible =
false;
400 m_BadgeNotifierDivider.Show(
false);
404 void OnConnectionIconsSettingsChanged(
bool enabled)
406 m_GameStatusIconsPanel.Show(enabled);
409 override void OnResizeScreen()
412 m_HudPanelWidget.GetScreenSize(
x,
y );
413 m_HudPanelWidget.Update();
418 override void Show(
bool show )
420 m_HudPanelWidget.Show( show );
423 override void ShowWalkieTalkie(
bool show )
425 m_FadeTimerWalkieTalkie.Stop();
426 m_FadeTimerWalkieTalkieText.Stop();
427 m_WalkieTalkie.Show( show );
430 override void ShowWalkieTalkie(
int fadeOutSeconds )
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 );
439 override void SetWalkieTalkieText(
string text )
442 Class.CastTo(txt, m_WalkieTalkie.FindAnyWidget(
"Text"));
446 override void SetCursorIcon(
string icon )
448 if ( icon.Length() == 0 || icon ==
CursorIcons.None )
449 m_CursorIcon.Show(
false);
452 m_CursorIcon.LoadImageFile( 0, icon );
453 m_CursorIcon.Show(
true);
457 override void ShowCursor()
459 m_CursorWidget.Show(
true );
462 override void HideCursor()
464 m_CursorWidget.Show(
false );
467 override void SetCursorIconScale(
string type,
float percentage )
470 m_CursorIcon.FindAnyWidget( type ).GetParent().GetSize(
x,
y );
471 m_CursorIcon.FindAnyWidget( type ).GetParent().SetSize(
x * percentage,
y * percentage );
474 override void SetCursorIconOffset(
string type,
float x,
float y )
476 m_CursorIcon.FindAnyWidget( type ).GetParent().SetPos(
x,
y );
479 override void SetCursorIconSize(
string type,
float x,
float y )
481 m_CursorIcon.FindAnyWidget( type ).GetParent().SetSize(
x,
y );
484 #ifdef DIAG_DEVELOPER
486 override void SetPermanentCrossHair(
bool show )
488 m_PermanentCrossHair.Show(show);
492 override void DisplayNotifier(
int key,
int tendency,
int status )
497 DisplayTendencyTemp( key, tendency, status );
501 DisplayTendencyNormal( key, tendency, status );
505 string arrow_name =
"ArrowUp";
508 arrow_name =
"ArrowDown";
510 tendency =
Math.AbsInt( tendency );
512 for (
int x = 1;
x < 4;
x++ )
514 Class.CastTo(w,
m_Notifiers.FindAnyWidget(
String( m_StatesWidgetNames.Get( key ) +
"ArrowUp" +
x.ToString() ) ) );
517 Class.CastTo(w,
m_Notifiers.FindAnyWidget(
String( m_StatesWidgetNames.Get( key ) +
"ArrowDown" +
x.ToString() ) ) );
524 string widget_name = m_StatesWidgetNames.Get( key ) + arrow_name +
Math.Clamp( tendency, 1, 3 );
531 void DisplayTendencyNormal(
int key,
int tendency,
int status )
538 w.SetImage(
Math.Clamp( status - 1, 0, 4 ) );
539 float alpha = w.GetAlpha();
544 w.SetColor(
ARGB( alpha * 255, 220, 220, 0 ) );
545 m_TendencyStatusCritical.Remove( w );
548 w.SetColor(
ARGB( alpha * 255, 220, 0, 0 ) );
549 m_TendencyStatusCritical.Remove( w );
552 if ( !m_TendencyStatusCritical.Contains( w ) )
554 m_TendencyStatusCritical.Insert( w,
ARGB( alpha * 255, 220, 0, 0 ) );
558 w.SetColor(
ARGB( alpha * 255, 220, 220, 220 ) );
559 m_TendencyStatusCritical.Remove( w );
565 void DisplayTendencyTemp(
int key,
int tendency,
int status )
567 ImageWidget w = ImageWidget.Cast(
m_Notifiers.FindAnyWidget(
String(
"Icon" + m_StatesWidgetNames.Get( key ) ) ) );
571 float alpha = w.GetAlpha();
575 temp_top.Show(
true );
576 temp_bot.Show(
false );
580 temp_top.Show(
false );
581 temp_bot.Show(
true );
587 w.SetColor(
ARGB( alpha * 255, 220, 220, 0 ) );
588 m_TendencyStatusCritical.Remove( w );
593 w.SetColor(
ARGB( alpha * 255, 220, 0, 0 ) );
594 m_TendencyStatusCritical.Remove( w );
598 if ( !m_TendencyStatusCritical.Contains( w ) )
600 m_TendencyStatusCritical.Insert( w,
ARGB( alpha * 255, 220, 0, 0 ) );
605 w.SetColor(
ARGB( alpha * 255, 0, 206, 209 ) );
606 m_TendencyStatusCritical.Remove( w );
610 w.SetColor(
ARGB( alpha * 255, 30, 144, 220 ) );
611 m_TendencyStatusCritical.Remove( w );
615 if ( !m_TendencyStatusCritical.Contains( w ) )
617 m_TendencyStatusCritical.Insert( w,
ARGB( alpha * 255, 30, 144, 220 ) );
622 w.SetColor(
ARGB( alpha * 255, 220, 220, 220 ) );
623 m_TendencyStatusCritical.Remove( w );
629 override void DisplayBadge(
int key,
int value )
633 m_BadgesWidgetDisplay.Set( key, value );
634 m_AnyBadgeVisible =
false;
635 for (
int i = 0; i < m_BadgesWidgetDisplay.Count(); i++ )
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 );
641 ImageWidget badge_widget
642 Class.CastTo(badge_widget, m_Badges.FindAnyWidget( badge_name ) );
645 if ( badge_value > 0 )
647 if (m_BadgesSupportedLevels.Contains(badge_key))
649 int levelIndex = badge_value - 1;
650 int maxSupportedIndex = m_BadgesSupportedLevels.Get(badge_key) - 1;
651 if (maxSupportedIndex >= levelIndex)
652 badge_widget.SetImage(levelIndex);
655 badge_widget.Show(
true );
656 m_AnyBadgeVisible =
true;
659 bleed_count.Show(
true );
660 bleed_count.SetText( m_BadgesWidgetDisplay.Get( badge_key ).ToString() );
667 bleed_count.Show(
false );
669 badge_widget.Show(
false );
674 RefreshHudVisibility();
679 m_IsTemperatureVisible =
true;
682 temp_top.SetText( temp );
683 temp_bot.SetText( temp );
684 m_TemperatureTimer = 0;
687 void HideTemperature()
689 m_IsTemperatureVisible =
false;
692 temp_top.SetText(
"" );
693 temp_bot.SetText(
"" );
694 m_TemperatureTimer = 0;
697 override void SetStaminaBarVisibility(
bool show )
712 m_IsStaminaVisible = show;
719 void SetStomachState(
int state )
721 ImageWidget stomach = ImageWidget.Cast( m_Badges.FindAnyWidget(
"Stomach" ) );
722 stomach.LoadImageFile( 0,
"set:dayz_gui image:iconStomach" + state );
725 override void SetStamina(
int value ,
int range )
729 float percentage = 1;
732 percentage = range / max;
737 m_Stamina.SetCurrent(( value / range ) * 100);
746 m_StaminaBackground.SetSize(1 - percentage, sy);
749 if (!
GetGame().IsMultiplayer())
758 float h1 = player.GetHealth(
"",
"");
759 float b1 = player.GetHealth(
"",
"Blood");
771 bool KeyPress(
int key)
776 void ZeroingKeyPress()
778 m_ZeroingKeyPressed =
true;
781 override void DisplayStance(
int stance )
786 if ( !
Class.CastTo(car, player.GetDrivingVehicle()) )
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 );
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 );
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 );
816 m_StanceStand.Show(
false);
817 m_StanceCrouch.Show(
false);
818 m_StanceProne.Show(
false);
819 m_StanceCar.Show(
true );
823 override void DisplayPresence()
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 );
836 if ( presence_level > 0 )
838 m_PresenceLevel0.Show(
true );
840 if ( presence_level > 1 )
842 m_PresenceLevel1.Show(
true );
844 if ( presence_level > 2 )
846 m_PresenceLevel2.Show(
true );
848 if ( presence_level > 3 )
850 m_PresenceLevel3.Show(
true );
852 if ( presence_level > 4 )
854 m_PresenceLevel4.Show(
true );
859 int m_VehicleGearCount = -1;
860 float m_TimeSinceLastEngineLightChange;
861 bool m_VehicleHasOil;
862 bool m_VehicleHasCoolant;
864 override void ShowVehicleInfo()
872 m_CurrentVehicle =
CarScript.Cast(hcv.GetTransport());
873 if (m_CurrentVehicle)
875 m_InVehicleAsDriver =
true;
876 m_VehicleGearCount = m_CurrentVehicle.GetGearsCount();
877 m_VehicleOilLight.Show(m_VehicleHasOil);
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);
883 m_HudPanelWidget.FindAnyWidget(
"PlayerPanel").Show(
false);
884 m_Presence.Show(
false);
885 m_StancePanel.Show(
false);
887 m_VehiclePanel.Show(
true);
893 override void HideVehicleInfo()
895 m_HudPanelWidget.FindAnyWidget(
"PlayerPanel").Show(
true);
896 m_Presence.Show(
true);
897 m_StancePanel.Show(
true);
898 m_VehiclePanel.Show(
false);
900 m_InVehicleAsDriver =
false;
901 m_CurrentVehicle =
null;
902 m_VehicleGearCount = -1;
905 void RefreshVehicleHud(
float timeslice)
907 if (m_CurrentVehicle && !
GetGame().GetUIManager().GetMenu())
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;
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());
918 int engineHealthLevel = m_CurrentVehicle.GetHealthLevel(
"Engine");
919 int fuelTankHealthLevel = m_CurrentVehicle.GetHealthLevel(
"FuelTank");
920 bool newHealth =
false;
923 if (m_CurrentVehicle.HasEngineZoneReceivedHit())
925 if (m_TimeSinceLastEngineLightChange > 0.35)
927 m_VehicleEngineLight.Show(!m_VehicleEngineLight.IsVisible());
930 m_VehicleEngineLight.SetColor(
Colors.WHITE);
934 m_VehicleEngineLight.SetColor(
ItemManager.GetItemHealthColor(engineHealthLevel));
937 m_VehicleEngineLight.SetAlpha(1);
938 m_TimeSinceLastEngineLightChange = 0;
941 m_TimeSinceLastEngineLightChange += timeslice;
946 m_VehicleEngineLight.SetColor(
ItemManager.GetItemHealthColor(engineHealthLevel));
947 m_VehicleEngineLight.SetAlpha(1);
948 m_VehicleEngineLight.Show(
true);
952 m_VehicleEngineLight.Show(
false);
958 m_VehicleFuelLight.SetColor(
Colors.WHITE);
959 m_VehicleFuelLight.SetAlpha(1);
960 m_VehicleFuelLight.Show(
true);
964 m_VehicleFuelLight.SetColor(
ItemManager.GetItemHealthColor(fuelTankHealthLevel));
965 m_VehicleFuelLight.SetAlpha(1);
966 m_VehicleFuelLight.Show(
true);
970 if (m_CurrentVehicle.IsVitalRadiator())
972 m_VehicleTemperatureIndicator.Show(
true);
973 if (m_CurrentVehicle.HasRadiator())
975 int radiatorHealthLevel = m_CurrentVehicle.GetRadiator().GetHealthLevel(
"");
978 m_VehicleTemperatureLight.SetColor(
Colors.WHITE);
979 m_VehicleTemperatureLight.SetAlpha(1);
980 m_VehicleTemperatureLight.Show(
true);
984 m_VehicleTemperatureLight.SetColor(
ItemManager.GetItemHealthColor(radiatorHealthLevel));
985 m_VehicleTemperatureLight.SetAlpha(1);
986 m_VehicleTemperatureLight.Show(
true);
991 m_VehicleTemperatureLight.SetColor(
Colors.COLOR_RUINED);
992 m_VehicleTemperatureLight.SetAlpha(1);
993 m_VehicleTemperatureLight.Show(
true);
998 m_VehicleTemperatureIndicator.Show(
false);
1001 m_VehicleHandBrakeLight.Show(m_CurrentVehicle.IsHandbrakeActive());
1002 m_VehicleWheelLight.Show(m_CurrentVehicle.WheelIsAnyLocked());
1005 int engagedGear = -1;
1011 engagedGear = m_CurrentVehicle.GetGear();
1012 prevGear = engagedGear - 1;
1013 nextGear = engagedGear + 1;
1015 if (engagedGear == CarGear.NEUTRAL)
1017 prevGear = CarGear.REVERSE;
1019 else if (engagedGear == CarGear.REVERSE)
1022 nextGear = CarGear.NEUTRAL;
1025 m_VehicleCurrentGearValue.SetText(m_VehicleGearTable.Get(engagedGear));
1026 m_VehicleNextGearValue.Show(nextGear < m_VehicleGearCount);
1028 m_VehicleNextGearValue.SetText(m_VehicleGearTable.Get(nextGear));
1029 m_VehiclePrevGearValue.SetText(m_VehicleGearTable.Get(prevGear));
1033 engagedGear = m_CurrentVehicle.GearboxGetMode();
1034 prevGear = engagedGear - 1;
1035 nextGear = engagedGear + 1;
1037 m_VehicleCurrentGearValue.SetText(m_VehicleGearTableAuto.Get(engagedGear));
1040 m_VehicleNextGearValue.SetText(m_VehicleGearTableAuto.Get(nextGear));
1041 m_VehiclePrevGearValue.SetText(m_VehicleGearTableAuto.Get(prevGear));
1045 GetDayZGame().GetBacklit().RefreshVehicleLayout(engagedGear, newHealth);
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 );
1051 if (m_VehicleDamageZonesHitTimer > 1)
1053 m_VehicleDamageZoneHitEngineState =
false;
1054 m_VehicleDamageZonesHitTimer = 0;
1057 m_VehicleDamageZonesHitTimer += timeslice;
1061 m_VehiclePanel.Show(
false);
1073 InventoryQuickbar GetQuickbar()
1078 bool IsQuickbarVisible()
1080 return m_IsQuickbarVisible;
1085 return m_IsHudVisible;
1088 override void UpdateQuickbarGlobalVisibility()
1090 #ifdef PLATFORM_CONSOLE
1091 ShowQuickBar(
GetGame().
GetInput().IsEnabledMouseAndKeyboardEvenOnServer());
1097 void RefreshQuickbarVisibility()
1099 m_IsQuickbarVisible = !m_QuickbarHideUI && !m_QuickbarHidePlayer && m_QuickbarState;
1103 void RefreshHudVisibility()
1105 m_IsHudVisible = ( !m_HudHidePlayer && !m_HudHideUI && m_HudState ) || m_HudInventory;
1107 SetLeftStatsVisibility( m_IsHudVisible );
1108 m_Badges.Show( m_IsHudVisible );
1110 m_BadgeNotifierDivider.Show( m_IsHudVisible && m_AnyBadgeVisible );
1111 #ifdef PLATFORM_CONSOLE
1112 m_SpecializatonPanel.Show(m_HudInventory);
1114 m_SpecializatonPanel.Show(
false);
1120 #ifdef PLATFORM_CONSOLE
1125 bool IsHideQuickbarPlayer()
1127 return m_QuickbarHidePlayer;
1130 bool IsHideHudPlayer()
1132 return m_HudHidePlayer;
1135 override void ShowQuickbarUI(
bool show )
1137 m_QuickbarHideUI = !show;
1138 RefreshQuickbarVisibility();
1141 override void ShowQuickbarPlayer(
bool show )
1143 m_QuickbarHidePlayer = !show;
1144 RefreshQuickbarVisibility();
1147 override void ShowHudPlayer(
bool show )
1149 m_HudHidePlayer = !show;
1152 RefreshHudVisibility();
1156 override void ShowHudUI(
bool show )
1158 m_HudHideUI = !show;
1161 RefreshHudVisibility();
1165 override void ShowHudInventory(
bool show )
1167 m_HudInventory = show;
1168 RefreshHudVisibility();
1171 override void ToggleHeatBufferPlusSign(
bool show )
1173 m_HeatBufferPlus.Show( show );
1177 override void ShowQuickBar(
bool show )
1179 m_QuickbarState = show;
1181 m_QuickbarHidePlayer =
false;
1182 RefreshQuickbarVisibility();
1185 override void ShowHud(
bool show )
1188 m_HudHidePlayer =
false;
1189 RefreshHudVisibility();
1192 bool GetQuickBarState()
1194 return m_QuickbarState;
1210 case EConnectivityStatLevel.OFF:
1211 m_HighPingA.Show(
false);
1212 m_HighPingB.Show(
false);
1214 case EConnectivityStatLevel.LEVEL1:
1215 m_HighPingA.Show(
true);
1216 m_HighPingB.Show(
false);
1218 case EConnectivityStatLevel.LEVEL2:
1219 m_HighPingA.Show(
false);
1220 m_HighPingB.Show(
true);
1228 case EConnectivityStatLevel.OFF:
1229 m_LowServerPerfA.Show(
false);
1230 m_LowServerPerfB.Show(
false);
1232 case EConnectivityStatLevel.LEVEL1:
1233 m_LowServerPerfA.Show(
true);
1234 m_LowServerPerfB.Show(
false);
1236 case EConnectivityStatLevel.LEVEL2:
1237 m_LowServerPerfA.Show(
false);
1238 m_LowServerPerfB.Show(
true);
1246 case EConnectivityStatLevel.OFF:
1247 m_ConnectionLost.Show(
false);
1249 case EConnectivityStatLevel.LEVEL1:
1250 m_ConnectionLost.Show(
true);
1257 void SetLeftStatsVisibility(
bool visible)
1259 Widget child = m_LeftHudPanelWidget.GetChildren();
1262 if (child.GetName() ==
"ChatFrameWidget")
1264 child = child.GetSibling();
1268 child.Show(visible);
1269 child = child.GetSibling();
1275 if ((!m_QuickbarState || m_QuickbarHidePlayer || m_QuickbarHideUI) && !itemChanged)
1283 MissionGameplay
mission = MissionGameplay.Cast(
GetGame().GetMission());
1287 inventory =
mission.GetInventory();
1292 inventory.RefreshQuickbar();
1302 Widget GetHudPanelWidget()
1304 return m_HudPanelWidget;
1307 override void UpdateBloodName()
1316 BloodTypes.GetBloodTypeName( player.GetBloodType(), blood_name, positive );
1317 bool blood_type_visible = player.HasBloodTypeVisible();
1319 if( blood_type_visible )
1323 m_BloodPosType.SetText(
"+" );
1325 m_BloodPosType.SetText(
"-" );
1330 m_BloodPosType.SetText(
"" );
1335 void RefreshPlayerTags()
1342 foreach( Man player :
ClientData.m_PlayerBaseList )
1344 vector target_player = player.GetPosition();
1345 distance =
vector.Distance( head_pos, target_player );
1347 target_player[1] = target_player[1] + 1.2;
1351 vector screen_pos =
GetGame().GetScreenPosRelative( target_player );
1352 vector end_pos = head_pos +
GetGame().GetCurrentCameraDirection() * 25;
1354 params.sorted =
true;
1358 if( results.Count() > 0 )
1360 if( results.Get( 0 ).obj == player )
1362 m_CurrentTaggedPlayer =
PlayerBase.Cast( player );
1370 m_CurrentTaggedPlayer =
null;
1375 int m_PlayerSpineIndex;
1380 void ShowPlayerTag(
float timeslice )
1382 if ( m_CurrentTaggedPlayer && m_CurrentTaggedPlayer.GetIdentity() )
1386 m_PlayerTag =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/hud/hud_player_tag.layout");
1387 m_PlayerTagText =
TextWidget.Cast( m_PlayerTag.FindAnyWidget(
"TagText" ) );
1389 m_PlayerSpineIndex = m_CurrentTaggedPlayer.GetBoneIndex(
"Spine2" );
1390 vector player_pos = m_CurrentTaggedPlayer.GetBonePositionWS( m_PlayerSpineIndex );
1391 vector screen_pos =
GetGame().GetScreenPosRelative( player_pos );
1393 if ( screen_pos[2] > 0 )
1395 if ( screen_pos[0] > 0 && screen_pos[0] < 1 )
1397 if ( screen_pos[1] > 0 && screen_pos[1] < 1 )
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() );
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 )
1416 m_PlayerTagText.SetText(
"" );
1417 m_CurrentTaggedPlayer =
null;
1422 override void Update(
float timeslice )
1424 super.Update( timeslice );
1426 m_ActionTargetsCursor.Update();
1430 if ( m_BlinkTime > TENDENCY_BLINK_TIME )
1433 if ( m_TendencyStatusCritical.Count() > 0 )
1435 for (
int i = 0; i < m_TendencyStatusCritical.Count(); ++i )
1438 ImageWidget widget = m_TendencyStatusCritical.GetKey( i );
1439 int alpha = widget.GetAlpha() * 255;
1441 int colorA =
ARGB( alpha, 255, 255, 255 );
1442 int colorB = m_TendencyStatusCritical.Get( widget );
1445 if ( widget.GetColor() == colorA )
1454 widget.SetColor( color );
1462 m_BlinkTime += timeslice;
1465 if( m_IsTemperatureVisible )
1467 m_TemperatureTimer += timeslice;
1468 if( m_TemperatureTimer > m_TemperatureShowTime )
1474 if ( !m_IsStaminaVisible )
1476 m_StaminaTimer += timeslice;
1477 if ( m_StaminaTimer > m_StaminaShowTime )
1479 SetStaminaBarVisibility(
true );
1484 if ( m_HitDirEffectArray && m_HitDirEffectArray.Count() > 0 )
1486 UpdateHitDirEffects(timeslice);
1487 CleanupHitDirEffects();
1490 RefreshVehicleHud(timeslice);
1493 RefreshPlayerTags();
1494 ShowPlayerTag(timeslice);
1498 override void SpawnHitDirEffect(
DayZPlayer player,
float hit_direction,
float intensity_max)
1505 if (m_HitDirEffectArray ==
null)
1510 hiteff.Init(player,hit_direction,intensity_max);
1511 m_HitDirEffectArray.Insert(hiteff);
1514 void UpdateHitDirEffects(
float timeslice )
1516 for (
int i = 0; i < m_HitDirEffectArray.Count(); i++)
1518 m_HitDirEffectArray[i].Update(timeslice);
1522 void CleanupHitDirEffects()
1524 for (
int i = m_HitDirEffectArray.Count() - 1; i > -1; i--)
1526 if ( m_HitDirEffectArray[i].DurationCheck() )
1528 m_HitDirEffectArray.Remove(i);
1535 foreach (
int val:m_BadgesWidgetDisplay)
1537 int key = m_BadgesWidgetDisplay.GetKeyByValue(val);
1540 Print(
"---------------------");
1548 void HideQuickbarTimer()