4 protected ref array<EEditableEntityBudget> m_aVisibleBudgetUI;
6 protected static const int UNLIMITED_PROP_BUDGET = -1;
9 override void InitializeBudgets()
11 array<ref SCR_EditableEntityCoreBudgetSetting> budgets = {};
12 m_BudgetManager.GetBudgets(budgets);
16 if (!m_aVisibleBudgetUI.Contains(budget.GetBudgetType()))
19 int MaxBudgetValue = GetMaxBudgetValue(budget.GetBudgetType());
21 if (MaxBudgetValue == UNLIMITED_PROP_BUDGET)
27 OnBudgetAdd(budget, MaxBudgetValue);
34 WorkspaceWidget workspace =
GetGame().GetWorkspace();
35 if (!workspace || !
m_Layout || m_BudgetEntryPrefab.IsEmpty())
39 if (m_BudgetWidgets.Contains(budgetType))
42 Widget budgetWidget = workspace.CreateWidgets(m_BudgetEntryPrefab,
m_Layout);
43 SetBudgetData(budgetWidget, GetCurrentBudgetValue(), maxBudget, budget.GetInfo());
45 m_BudgetWidgets.Insert(budgetType, budgetWidget);
49 override void OnBudgetUpdate(
EEditableEntityBudget budgetType,
int originalBudgetValue,
int updatedBudgetValue,
int maxBudgetValue)
51 TextWidget budgetWidget;
52 if (m_BudgetWidgets.Find(budgetType, budgetWidget))
54 SetBudgetData(budgetWidget, GetCurrentBudgetValue(), maxBudgetValue);
55 SetBudgetPreviewData(budgetWidget, 0, 0);
61 SCR_CampaignBuildingProviderComponent GetProviderComponent()
75 SCR_CampaignBuildingEditorComponent editorComponent = SCR_CampaignBuildingEditorComponent.Cast(modeEntity.FindComponent(SCR_CampaignBuildingEditorComponent));
79 return editorComponent.GetProviderComponent();
86 SCR_CampaignBuildingProviderComponent provider = GetProviderComponent();
88 return UNLIMITED_PROP_BUDGET;
90 return provider.GetMaxBudgetValue(budget);
95 int GetCurrentBudgetValue()
97 SCR_CampaignBuildingProviderComponent provider = GetProviderComponent();
99 return UNLIMITED_PROP_BUDGET;
101 return provider.GetCurrentPropValue();