Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EditableEntityCoreBudgetSetting.c
Go to the documentation of this file.
3 {
4  [Attribute()]
5  protected ref SCR_UIInfo m_Info;
6 
7  [Attribute("0", UIWidgets.ComboBox, "", enums: ParamEnumArray.FromEnum(EEditableEntityBudget))]
8  protected EEditableEntityBudget m_BudgetType;
9 
10  [Attribute("1", UIWidgets.Auto, "")]
11  protected int m_iMinBudgetCost;
12 
13  protected int m_iCurrentBudget;
14 
15  protected SCR_BudgetEditorComponent m_BudgetEditor;
17  protected int m_iReservedBudget;
18 
19  EEditableEntityBudget GetBudgetType()
20  {
21  return m_BudgetType;
22  }
23  int GetMinBudgetCost()
24  {
25  return m_iMinBudgetCost;
26  }
27  int GetCurrentBudget()
28  {
29  return m_iCurrentBudget;
30  }
31  SCR_UIInfo GetInfo()
32  {
33  return m_Info;
34  }
35 
36  //------------------------------------------------------------------------------------------------
38  int GetReservedBudget()
39  {
40  return m_iReservedBudget;
41  }
42 
43  //------------------------------------------------------------------------------------------------
45  void ReserveBudget(int reserveValue)
46  {
47  m_iReservedBudget += reserveValue;
48  }
49 
50  //------------------------------------------------------------------------------------------------
52  void UnreserveBudget(int reserveValue)
53  {
54  m_iReservedBudget -= reserveValue;
55  if (m_iReservedBudget < 0)
56  m_iReservedBudget = 0;
57  }
58 
59  int SetCurrentBudget(int budgetValue)
60  {
61  int oldBudget = m_iCurrentBudget;
62  m_iCurrentBudget = budgetValue;
63 
64  return m_iCurrentBudget - oldBudget;
65  }
66 
67  int AddToBudget(SCR_EntityBudgetValue budgetCost = null)
68  {
69  int budgetCostValue = GetMinBudgetCost();
70  if (budgetCost) budgetCostValue = budgetCost.GetBudgetValue();
71 
72  int budgetChange = Math.Max(budgetCostValue, GetMinBudgetCost());
73  m_iCurrentBudget += budgetChange;
74 
75  return budgetChange;
76  }
77 
78  int AddToBudget(int budgetValue)
79  {
80  int budgetChange = Math.Max(budgetValue, GetMinBudgetCost());
81  m_iCurrentBudget += budgetChange;
82 
83  return budgetChange;
84  }
85 
86  int SubtractFromBudget(SCR_EntityBudgetValue budgetCost = null)
87  {
88  int budgetCostValue = GetMinBudgetCost();
89  if (budgetCost) budgetCostValue = Math.Max(budgetCost.GetBudgetValue(), budgetCostValue);
90 
91  m_iCurrentBudget = Math.Max(m_iCurrentBudget - budgetCostValue, 0);
92 
93  return -budgetCostValue;
94  }
95 
96  int SubtractFromBudget(int budgetValue)
97  {
98  int budgetChange = Math.Min(m_iCurrentBudget, Math.Max(GetMinBudgetCost(), budgetValue));
99  m_iCurrentBudget -= budgetChange;
100 
101  return budgetChange;
102  }
103 
104  void SetBudgetComponent(notnull SCR_BudgetEditorComponent budgetEditor)
105  {
106  m_BudgetEditor = budgetEditor;
107  }
108 
109  void SCR_EditableEntityCoreBudgetSetting(int budgetValue = -1, EEditableEntityBudget budgetType = EEditableEntityBudget.PROPS, int minBudgetCost = 0, SCR_UIInfo info = null)
110  {
111  if (budgetValue == -1)
112  return;
113 
114  m_BudgetType = budgetType;
115  m_iMinBudgetCost = minBudgetCost;
116  m_Info = info;
117  }
118 }
SCR_EditableEntityCoreBudgetSetting
Definition: SCR_EditableEntityCoreBudgetSetting.c:2
SCR_BaseContainerCustomTitleEnum
class SCR_CampaignHintStorage SCR_BaseContainerCustomTitleEnum(EHint, "m_eHintId")
Definition: SCR_CampaignHintStorage.c:22
EEditableEntityBudget
EEditableEntityBudget
Definition: EEditableEntityBudget.c:1
SCR_BudgetEditorComponent
Definition: SCR_BudgetEditorComponent.c:18
Attribute
typedef Attribute
Post-process effect of scripted camera.
m_Info
protected ref SCR_HintUIInfo m_Info
Definition: SCR_BaseHintCondition.c:3
SCR_EntityBudgetValue
Definition: SCR_EntityBudgetValue.c:2
SCR_UIInfo
Definition: SCR_UIInfo.c:7
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