Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_FuelTooltipDetail.c
Go to the documentation of this file.
3 {
4  [Attribute(desc: "If any of these are set and none of the Ignore are then it is used to display the fuel tooltip. (Leave empty to get all and none SCR_FuelNodes are always displayed)", uiwidget: UIWidgets.Flags, enums: ParamEnumArray.FromEnum(SCR_EFuelNodeTypeFlag))]
5  protected SCR_EFuelNodeTypeFlag m_eFuelNodeTypes;
6 
7  [Attribute(desc: "If any of these are present then the fuel node is ignored (Leave empty to ignore none and none SCR_FuelNodes are always displayed) ", uiwidget: UIWidgets.Flags, enums: ParamEnumArray.FromEnum(SCR_EFuelNodeTypeFlag))]
8  protected SCR_EFuelNodeTypeFlag m_eIgnoreFuelNodeTypes;
9 
10  [Attribute("#AR-ValueUnit_Percentage")]
11  protected string m_sPercentageText;
12 
13  protected TextWidget m_Value;
14  protected SCR_WLibProgressBarComponent m_wBar;
15 
16  protected ref array<SCR_FuelManagerComponent> m_aFuelManagers = {};
17 
18  //------------------------------------------------------------------------------------------------
19  override bool NeedUpdate()
20  {
21  return true;
22  }
23 
24  //------------------------------------------------------------------------------------------------
25  override void UpdateDetail(SCR_EditableEntityComponent entity)
26  {
27  float totalFuel, totalMaxFuel, percentage;
28 
29  SCR_FuelManagerComponent.GetTotalValuesOfFuelNodesOfFuelManagers(m_aFuelManagers, totalFuel, totalMaxFuel, percentage, m_eFuelNodeTypes, m_eIgnoreFuelNodeTypes);
30 
31  if (m_wBar)
32  m_wBar.SetValue(percentage);
33 
34  if (m_Value)
35  m_Value.SetTextFormat(m_sPercentageText, Math.Round(percentage * 100));
36  }
37 
38  //------------------------------------------------------------------------------------------------
39  override bool InitDetail(SCR_EditableEntityComponent entity, Widget widget)
40  {
41  m_Value = TextWidget.Cast(m_Widget.FindAnyWidget("Value"));
42 
43  Widget barWidget = m_Widget.FindAnyWidget("ProgressBar");
44  if (barWidget)
45  m_wBar = SCR_WLibProgressBarComponent.Cast(barWidget.FindHandler(SCR_WLibProgressBarComponent));
46 
47  if (!m_Value && !m_wBar)
48  return false;
49 
50  DamageManagerComponent damageManager = DamageManagerComponent.Cast(entity.GetOwner().FindComponent(DamageManagerComponent));
51  if (damageManager && damageManager.GetState() == EDamageState.DESTROYED)
52  return false;
53 
54  SCR_FuelManagerComponent.GetAllFuelManagers(entity.GetOwner(), m_aFuelManagers);
55  if (m_aFuelManagers.IsEmpty())
56  return false;
57 
58  float totalFuel, totalMaxFuel, percentage;
59  SCR_FuelManagerComponent.GetTotalValuesOfFuelNodesOfFuelManagers(m_aFuelManagers, totalFuel, totalMaxFuel, percentage, m_eFuelNodeTypes, m_eIgnoreFuelNodeTypes);
60 
61  return totalMaxFuel > 0;
62  }
63 }
EDamageState
EDamageState
Definition: EDamageState.c:12
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_FuelTooltipDetail
Definition: SCR_FuelTooltipDetail.c:2
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
SCR_FuelManagerComponent
void SCR_FuelManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_FuelManagerComponent.c:475
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
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