Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_EntityBudgetValue.c
Go to the documentation of this file.
2class SCR_EntityBudgetValue
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};
EEditableEntityBudget
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
class SCR_CampaignHintStorage SCR_BaseContainerCustomTitleEnum(EHint, "m_eHintId")
SCR_FieldOfViewSettings Attribute