Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SupplyRefundTooltipDetail.c
Go to the documentation of this file.
1
4{
5 //------------------------------------------------------------------------------------------------
6 override bool InitDetail(SCR_EditableEntityComponent entity, Widget widget)
7 {
8 TextWidget text = TextWidget.Cast(widget.FindAnyWidget("Text"));
9 if (!text)
10 return false;
11
12 BaseGameMode gameMode = GetGame().GetGameMode();
13 if (!gameMode)
14 return false;
15
16 SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
17 if (!editorManager || editorManager.GetCurrentMode() != EEditorMode.BUILDING)
18 return false;
19
20
21 SCR_CampaignBuildingManagerComponent buildingManager = SCR_CampaignBuildingManagerComponent.Cast(gameMode.FindComponent(SCR_CampaignBuildingManagerComponent));
22 if (!buildingManager)
23 return false;
24
25 SCR_EditableEntityUIInfo editableUiInfo = SCR_EditableEntityUIInfo.Cast(entity.GetInfo());
26 if (!editableUiInfo)
27 return false;
28
29 array<ref SCR_EntityBudgetValue> budgets = {};
30 if (!editableUiInfo.GetEntityBudgetCost(budgets) || budgets.IsEmpty())
31 return false;
32
33 int conflictBudget = 0;
34
35 foreach (SCR_EntityBudgetValue budget: budgets)
36 {
37 if (budget.GetBudgetType() == EEditableEntityBudget.CAMPAIGN)
38 conflictBudget += budget.GetBudgetValue();
39 }
40
41 if (conflictBudget <= 0)
42 return false;
43
44 //~ Calculate refund amound
45 text.SetText(Math.Round(conflictBudget * (buildingManager.GetCompositionRefundPercentage() * 0.01)).ToString());
46
47 return true;
48 }
49}
EEditableEntityBudget
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
class SCR_KeyBindingFilter BaseContainerCustomTitleField("m_sBindString")
Definition Math.c:13
SCR_UIInfo GetInfo(IEntity owner=null)
bool GetEntityBudgetCost(out notnull array< ref SCR_EntityBudgetValue > outBudgets)
EEditorMode
Editor mode that defines overall functionality.
Definition EEditorMode.c:6