Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EntityBudgetValue.c
Go to the documentation of this file.
3 {
4  [Attribute("0", UIWidgets.SearchComboBox, "", enums: ParamEnumArray.FromEnum(EEditableEntityBudget))]
5  private EEditableEntityBudget m_BudgetType;
6 
7  [Attribute("0", UIWidgets.Auto, "")]
8  private int m_Value;
9 
10  EEditableEntityBudget GetBudgetType()
11  {
12  return m_BudgetType;
13  }
14 
15  int GetBudgetValue()
16  {
17  return m_Value;
18  }
19 
20  void SetBudgetValue(int newValue)
21  {
22  m_Value = newValue;
23  }
24 
25  bool AddBudgetValue(SCR_EntityBudgetValue entityBudgetValue)
26  {
27  if (entityBudgetValue.GetBudgetType() == GetBudgetType())
28  {
29  m_Value += entityBudgetValue.GetBudgetValue();
30  return true;
31  }
32  return false;
33  }
34 
35  static void MergeBudgetCosts(out notnull array<ref SCR_EntityBudgetValue> outExistingBudgets, array<ref SCR_EntityBudgetValue> newBudgetCosts)
36  {
37  foreach (SCR_EntityBudgetValue newBudgetCost : newBudgetCosts)
38  {
39  bool budgetExists = false;
40  foreach (SCR_EntityBudgetValue existingBudget : outExistingBudgets)
41  {
42  if (existingBudget.AddBudgetValue(newBudgetCost))
43  {
44  budgetExists = true;
45  break;
46  }
47  }
48  if (!budgetExists)
49  {
50  outExistingBudgets.Insert(newBudgetCost);
51  }
52  }
53  }
54 
55  static void AddBudgetValueToBudgetArray(out notnull array<ref SCR_EntityBudgetValue> budgets, EEditableEntityBudget budgetType, int value)
56  {
57  foreach (SCR_EntityBudgetValue budgetValue : budgets)
58  {
59  if (budgetValue.GetBudgetType() == budgetType)
60  {
61  budgetValue.SetBudgetValue(budgetValue.GetBudgetValue() + value);
62  return;
63  }
64  }
65 
66  budgets.Insert(new SCR_EntityBudgetValue(budgetType, value));
67  }
68 
69  void SCR_EntityBudgetValue(EEditableEntityBudget budgetType, int budgetValue = -1)
70  {
71  if (budgetValue == -1) return;
72  m_BudgetType = budgetType;
73  m_Value = budgetValue;
74  }
75 };
SCR_BaseContainerCustomTitleEnum
class SCR_CampaignHintStorage SCR_BaseContainerCustomTitleEnum(EHint, "m_eHintId")
Definition: SCR_CampaignHintStorage.c:22
EEditableEntityBudget
EEditableEntityBudget
Definition: EEditableEntityBudget.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_EntityBudgetValue
Definition: SCR_EntityBudgetValue.c:2
m_Value
class SCR_ScenarioFrameworkParamBase m_Value
Definition: SCR_ScenarioFrameworkActionsGetters.c:20
m_BudgetType
protected EEditableEntityBudget m_BudgetType
Definition: SCR_CampaignBuildingManagerComponent.c:20
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