Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_DpsConditionBarBaseTooltipDetail.c
Go to the documentation of this file.
3 {
4  [Attribute("#AR-ValueUnit_Percentage")]
5  private string m_sPercentageText;
6 
7  [Attribute("0", uiwidget: UIWidgets.ComboBox, "Colors the bar if damage over time condition is true", enums: ParamEnumArray.FromEnum(EDamageType))]
8  protected ref array<EDamageType> m_aDamageOverTimeConditions;
9 
10  [Attribute()]
11  protected ref Color m_cHasDpsBarColor;
12 
13  protected ref Color m_cDefaultBarColor;
14 
15  protected TextWidget m_TextWidget;
16  protected TextWidget m_Value;
17  protected SCR_WLibProgressBarComponent m_Bar;
18  protected DamageManagerComponent m_DamageManager;
19 
20  protected bool m_bBarIsColored;
21 
22  //------------------------------------------------------------------------------------------------
23  override bool NeedUpdate()
24  {
25  return m_DamageManager != null;
26  }
27 
28  //------------------------------------------------------------------------------------------------
29  override void UpdateDetail(SCR_EditableEntityComponent entity)
30  {
31  if (m_aDamageOverTimeConditions.IsEmpty())
32  return;
33 
34  bool damageOverTime = false;
35  foreach (EDamageType dpsType: m_aDamageOverTimeConditions)
36  {
37  if (m_DamageManager.IsDamagedOverTime(dpsType))
38  {
39  damageOverTime = true;
40  break;
41  }
42  }
43 
44  SetBarColor(damageOverTime);
45  }
46 
47  //------------------------------------------------------------------------------------------------
48  protected void SetBarColor(bool SetConditionColor)
49  {
50  if (!m_Bar || m_bBarIsColored == SetConditionColor)
51  return;
52 
53  m_bBarIsColored = SetConditionColor;
54 
55  if (m_bBarIsColored)
56  m_Bar.SetSliderColor(m_cHasDpsBarColor);
57  else
58  m_Bar.SetSliderColor(m_cDefaultBarColor);
59 
60  }
61 
62  //------------------------------------------------------------------------------------------------
63  protected void SetBarAndPercentageValue(float newValue)
64  {
65  if (m_Bar)
66  m_Bar.SetValue(newValue);
67 
68  if (m_Value)
69  m_Value.SetTextFormat(m_sPercentageText, Math.Round(newValue * 100));
70  }
71 
72  //------------------------------------------------------------------------------------------------
73  override bool InitDetail(SCR_EditableEntityComponent entity, Widget widget)
74  {
75  m_DamageManager = DamageManagerComponent.Cast(entity.GetOwner().FindComponent(DamageManagerComponent));
76  if (!m_DamageManager)
77  return false;
78 
79  m_Value = TextWidget.Cast(m_Widget.FindAnyWidget("Value"));
80 
81  Widget barWidget = m_Widget.FindAnyWidget("ProgressBar");
82  if (barWidget)
83  m_Bar = SCR_WLibProgressBarComponent.Cast(barWidget.FindHandler(SCR_WLibProgressBarComponent));
84 
85  if (!m_Value && !m_Bar)
86  return false;
87 
88  m_cDefaultBarColor = m_Bar.m_SliderColor;
89 
90  return true;
91  }
92 }
BaseContainerCustomTitleField
class SCR_KeyBindingFilter BaseContainerCustomTitleField("m_sBindString")
Definition: SCR_KeyBindingMenuConfig.c:113
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_EntityTooltipDetail
Definition: SCR_EntityTooltipDetail.c:2
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
EDamageType
EDamageType
Definition: EDamageType.c:12
SCR_DpsConditionBarBaseTooltipDetail
Definition: SCR_DpsConditionBarBaseTooltipDetail.c:2
m_Value
class SCR_ScenarioFrameworkParamBase m_Value
Definition: SCR_ScenarioFrameworkActionsGetters.c:20
SCR_WLibProgressBarComponent
Minimalist progress bar.
Definition: SCR_WLibProgressBar.c:3
DamageManagerComponent
Definition: DamageManagerComponent.c:12
m_DamageManager
DamageManagerComponent m_DamageManager
Definition: SCR_AITargetInfo.c:19
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468