13 if (!ValidEntity(editableEntity.GetOwner()))
16 FactionManager factionManager =
GetGame().GetFactionManager();
20 Faction faction = GetFaction(editableEntity.GetOwner());
25 if (!delegateFactionManager)
28 SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates =
new SCR_SortedArray<SCR_EditableFactionComponent>;
29 int count = delegateFactionManager.GetSortedFactionDelegates(factionDelegates);
31 if (factionDelegates.IsEmpty())
34 int factionIndex = factionManager.GetFactionIndex(faction);
36 for (
int i = 0; i < count; i++)
38 if (factionDelegates.GetValue(i).GetFactionIndex() == factionIndex)
64 protected override void CreatePresets()
67 if (!delegateFactionManager)
70 FactionManager factionManager =
GetGame().GetFactionManager();
76 SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates =
new SCR_SortedArray<SCR_EditableFactionComponent>;
77 int count = delegateFactionManager.GetSortedFactionDelegates(factionDelegates);
81 for(
int i = 0; i < count; ++i)
83 scrFaction =
SCR_Faction.Cast(factionDelegates.Get(i).GetFaction());
89 value.SetWithUIInfo(scrFaction.GetUIInfo(), factionDelegates.GetValue(i).GetFactionIndex());
94 override void WriteVariable(Managed item,
SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager,
int playerID)
99 FactionManager factionManager =
GetGame().GetFactionManager();
108 if (!delegateFactionManager)
111 SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates =
new SCR_SortedArray<SCR_EditableFactionComponent>;
112 delegateFactionManager.GetSortedFactionDelegates(factionDelegates);
114 if (factionDelegates.IsEmpty())
118 Faction faction = factionManager.GetFactionByIndex(factionDelegates.GetValue(var.GetInt()).GetFactionIndex());
122 SetFaction(editableEntity.GetOwner(), faction);