Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EditableEntityUIInfo.c
Go to the documentation of this file.
3 {
4  [Attribute(params: "edds imageset", uiwidget: UIWidgets.ResourcePickerThumbnail)]
5  private ResourceName m_Image;
6 
7  [Attribute()]
8  private FactionKey m_sFaction;
9 
10  [Attribute("1", UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(EEditableEntityLabel), desc: "Entity labels configured by developers, changes will be applied when updating editable entities")]
11  private ref array<EEditableEntityLabel> m_aAuthoredLabels;
12 
13  [Attribute("1", UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(EEditableEntityLabel), desc: "Autoconfigured labels, for manual changes edit AuthoredLabels array instead")]
14  private ref array<EEditableEntityLabel> m_aAutoLabels;
15 
16  [Attribute("", category: "Editable Entity", desc: "Define budget costs")]
17  private ref array<ref SCR_EntityBudgetValue> m_EntityBudgetCost;
18 
19  [Attribute("", category: "Editable Entity", desc: "Autoconfigured budget costs of child entities (group/composition entities)")]
20  private ref array<ref SCR_EntityBudgetValue> m_EntityChildrenBudgetCost;
21 
22  [Attribute(category: "Editable Entity", params: "et", desc: "Prefab this entity extends.")]
23  protected ResourceName m_SlotPrefab;
24 
25  //--- Hidden vars, used only in content browser where they're filled from component source
26  protected EEditableEntityType m_EntityType;
27  protected EEditableEntityFlag m_EntityFlags;
28 
29  //~ Hotfix to make sure Entity names that are not localized get a default fallback name
30  static const LocalizedString EDITABLE_ENTITY_FALLBACK_NAME = "#AR-AttributesDialog_TitlePage_Entity_Text";
31 
32  //------------------------------------------------------------------------------------------------
33  //~ Hotfix to make sure Entity names that are not localized get a default fallback name
34  override LocalizedString GetName()
35  {
36  //~ If empty string, placeholder string it will use the the fallback string so the name at least is localized.
37  //~ It checks for '(' as all placeholder names check for it as checking for '#' will override the string for modders
38  if (Name.IsEmpty() || Name[0] == "(")
39  return EDITABLE_ENTITY_FALLBACK_NAME;
40 
41  return Name;
42  }
43 
44  //------------------------------------------------------------------------------------------------
45  ResourceName GetImage()
46  {
47  return m_Image;
48  }
49 
50  //------------------------------------------------------------------------------------------------
51  EEditableEntityType GetEntityTypex()
52  {
53  return 0;
54  }
55 
56  //------------------------------------------------------------------------------------------------
57  FactionKey GetFactionKey()
58  {
59  return m_sFaction;
60  }
61 
62  //------------------------------------------------------------------------------------------------
63  Faction GetFaction()
64  {
65  FactionManager factionManager = GetGame().GetFactionManager();
66  if (factionManager)
67  return factionManager.GetFactionByKey(m_sFaction);
68  else
69  return null;
70  }
71 
72  //------------------------------------------------------------------------------------------------
76  int GetEntityLabels(out notnull array<EEditableEntityLabel> entityLabels)
77  {
78  entityLabels.InsertAll(m_aAutoLabels);
79  entityLabels.InsertAll(m_aAuthoredLabels);
80  return entityLabels.Count();
81  }
82 
83  //------------------------------------------------------------------------------------------------
87  bool HasEntityLabel(EEditableEntityLabel label)
88  {
89  if (m_aAutoLabels.Contains(label))
90  return true;
91 
92  if (m_aAuthoredLabels.Contains(label))
93  return true;
94 
95  return false;
96  }
97 
98  //------------------------------------------------------------------------------------------------
101  bool GetEntityBudgetCost(out notnull array<ref SCR_EntityBudgetValue> outBudgets)
102  {
103  SCR_EntityBudgetValue.MergeBudgetCosts(outBudgets, m_EntityBudgetCost);
104  return !outBudgets.IsEmpty();
105  }
106 
107  //------------------------------------------------------------------------------------------------
109  void GetEntityAndChildrenBudgetCost(out notnull array<ref SCR_EntityBudgetValue> outBudgets)
110  {
111  SCR_EntityBudgetValue.MergeBudgetCosts(outBudgets, m_EntityBudgetCost);
112  SCR_EntityBudgetValue.MergeBudgetCosts(outBudgets, m_EntityChildrenBudgetCost);
113  }
114 
115  //------------------------------------------------------------------------------------------------
117  void GetEntityChildrenBudgetCost(out notnull array<ref SCR_EntityBudgetValue> outBudgets)
118  {
119  SCR_EntityBudgetValue.MergeBudgetCosts(outBudgets, m_EntityChildrenBudgetCost);
120  }
121 
122  //------------------------------------------------------------------------------------------------
125  ResourceName GetSlotPrefab()
126  {
127  return m_SlotPrefab;
128  }
129 
130  //------------------------------------------------------------------------------------------------
133  EEditableEntityType GetEntityType()
134  {
135  return m_EntityType;
136  }
137 
138  //------------------------------------------------------------------------------------------------
142  bool HasEntityFlag(EEditableEntityFlag flag)
143  {
144  return (m_EntityFlags & flag) == flag;
145  }
146 
147  //------------------------------------------------------------------------------------------------
153  bool SetAssetImageTo(ImageWidget imageWidget)
154  {
155  if (!imageWidget || m_Image.IsEmpty())
156  return false;
157 
158  imageWidget.LoadImageTexture(0, m_Image);
159  return true;
160  }
161 
162  //------------------------------------------------------------------------------------------------
165  void InitFromSource(IEntityComponentSource componentSource)
166  {
167  m_EntityType = SCR_EditableEntityComponentClass.GetEntityType(componentSource);
168  m_EntityFlags = SCR_EditableEntityComponentClass.GetEntityFlags(componentSource);
169  }
170 
171  //------------------------------------------------------------------------------------------------
172  protected override void CopyFrom(SCR_UIName source)
173  {
174  SCR_EditableEntityUIInfo editableEntitySource = SCR_EditableEntityUIInfo.Cast(source);
175  if (editableEntitySource)
176  {
177  m_Image = editableEntitySource.m_Image;
178  m_sFaction = editableEntitySource.m_sFaction;
179  m_aAuthoredLabels = editableEntitySource.m_aAuthoredLabels;
180  m_aAutoLabels = editableEntitySource.m_aAutoLabels;
181  m_EntityBudgetCost = editableEntitySource.m_EntityBudgetCost;
182  m_EntityChildrenBudgetCost = editableEntitySource.m_EntityChildrenBudgetCost;
183  m_SlotPrefab = editableEntitySource.m_SlotPrefab;
184  }
185 
186  super.CopyFrom(source);
187  }
188 }
EEditableEntityLabel
EEditableEntityLabel
Definition: EEditableEntityLabel.c:1
EEditableEntityFlag
EEditableEntityFlag
Unique flags of the entity.
Definition: EEditableEntityFlag.c:5
SCR_UIName
Definition: SCR_UIName.c:5
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_EditableEntityUIInfo
Definition: SCR_EditableEntityUIInfo.c:2
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
m_SlotPrefab
protected ResourceName m_SlotPrefab
Definition: SCR_EntitiesEditorUIComponent.c:9
Attribute
typedef Attribute
Post-process effect of scripted camera.
EEditableEntityType
EEditableEntityType
Defines type of SCR_EditableEntityComponent. Assigned automatically based on IEntity inheritance.
Definition: EEditableEntityType.c:5
SCR_EntityBudgetValue
Definition: SCR_EntityBudgetValue.c:2
SCR_UIInfo
Definition: SCR_UIInfo.c:7
Faction
Definition: Faction.c:12
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
SCR_EditableEntityComponentClass
Definition: SCR_EditableEntityComponentClass.c:2
LocalizedString
Definition: LocalizedString.c:21
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
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180