Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
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 }
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_EditableEntityUIInfo
Definition: SCR_EditableEntityUIInfo.c:2
SCR_SupplyRefundTooltipDetail
Definition: SCR_SupplyRefundTooltipDetail.c:3
EEditableEntityBudget
EEditableEntityBudget
Definition: EEditableEntityBudget.c:1
BaseContainerCustomTitleField
class SCR_KeyBindingFilter BaseContainerCustomTitleField("m_sBindString")
Definition: SCR_KeyBindingMenuConfig.c:113
SCR_EntityBudgetValue
Definition: SCR_EntityBudgetValue.c:2
SCR_EntityTooltipDetail
Definition: SCR_EntityTooltipDetail.c:2
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
EEditorMode
EEditorMode
Editor mode that defines overall functionality.
Definition: EEditorMode.c:5
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
SCR_EditorManagerEntity
Definition: SCR_EditorManagerEntity.c:26