Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AssignedGroupLabelUIComponent.c
Go to the documentation of this file.
2{
3 [Attribute("{1228936E5DB30403}UI/Textures/GroupManagement/FlagIcons/GroupFlagsBlufor.imageset", params: "layout")]
5
6 [Attribute("{7CD99D22C7AE8195}UI/Textures/GroupManagement/FlagIcons/GroupFlagsOpfor.imageset", params: "layout")]
8
9 [Attribute("{301FC1A2A46D3E0D}UI/Textures/GroupManagement/FlagIcons/GroupFlagsIndfor.imageset", params: "layout")]
11
12 [Attribute("{D7E06968B5F9FC92}UI/Textures/GroupManagement/FlagIcons/GroupFlagsCivilian.imageset", params: "layout")]
14
16
17 protected const string DEFAULT_ICON_NAME = "undefined";
18 protected const string CUSTOM_GROUP_NAME_FORMAT = "#AR-Player_Groups_CustomName_Format";
19
20 //------------------------------------------------------------------------------------------------
21 override void HandlerAttached(Widget w)
22 {
23 super.HandlerAttached(w);
24
25 m_Widgets.Init(w);
26 }
27
28 //------------------------------------------------------------------------------------------------
29 void LoadGroupFlag(notnull SCR_AIGroup aiGroup)
30 {
31 SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
32 if (!groupsManager)
33 return;
34
35 ResourceName flag = aiGroup.GetGroupFlag();
36 if (flag.IsEmpty())
37 return;
38
39 if (aiGroup.GetFlagIsFromImageSet())
41 else
42 m_Widgets.m_wGroupIcon.LoadImageTexture(0, flag, false, false);
43 }
44
45 //------------------------------------------------------------------------------------------------
48 protected void SetFlagButtonFromImageSet(string name)
49 {
50 if (name.IsEmpty())
51 return;
52
53 SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
54 if (!factionManager)
55 return;
56
57 SCR_Faction playerFaction = SCR_Faction.Cast(factionManager.GetLocalPlayerFaction());
58 if (!playerFaction)
59 return;
60
61 ResourceName res = playerFaction.GetGroupFlagImageSet();
62 if (!res)
63 return;
64
65 m_Widgets.m_wGroupIcon.LoadImageFromSet(0, res, name);
66 }
67
68 //------------------------------------------------------------------------------------------------
71 void LoadGroupName(notnull SCR_AIGroup aiGroup)
72 {
73 string groupName = aiGroup.GetCustomNameWithOriginal();
74 string company, platoon, squad, character, format;
75 aiGroup.GetCallsigns(company, platoon, squad, character, format);
76
77 if (groupName.IsEmpty())
78 {
79 m_Widgets.m_wGroupName.SetTextFormat(format, company, platoon, squad, character);
80 }
81 else
82 {
83 string customName = aiGroup.GetCustomName().Trim();
84
85 if (customName.IsEmpty())
86 m_Widgets.m_wGroupName.SetTextFormat(format, company, platoon, squad, character);
87 else
88 m_Widgets.m_wGroupName.SetText(SCR_GroupHelperUI.GetTranslatedGroupName(aiGroup));
89 }
90 }
91
92 //------------------------------------------------------------------------------------------------
94 void SetGroupName(string name)
95 {
96 if (name.IsEmpty())
97 return;
98
99 m_Widgets.m_wGroupName.SetText(name);
100 }
101
102 //------------------------------------------------------------------------------------------------
103 void SetGroupIcon(ResourceName imageset, string iconName)
104 {
105 m_Widgets.m_wGroupIcon.LoadImageFromSet(0, imageset, iconName);
106 }
107
108 //------------------------------------------------------------------------------------------------
112 void SetGroupIconFromFaction(Faction faction, string iconName = string.Empty)
113 {
114 if (!iconName)
115 iconName = DEFAULT_ICON_NAME;
116
117 ResourceName imageset;
118 switch (faction.GetFactionKey())
119 {
120 case "US":
121 {
122 imageset = m_sGroupsBLUFOR;
123 break;
124 }
125
126 case "USSR":
127 {
128 imageset = m_sGroupsOPFOR;
129 break;
130 }
131
132 case "FIA":
133 {
134 imageset = m_sGroupsINDFOR;
135 break;
136 }
137
138 case "CIV":
139 {
140 imageset = m_sGroupsCIVILIAN;
141 break;
142 }
143
144 default:
145 {
146 imageset = m_sGroupsBLUFOR;
147 }
148 }
149
150 m_Widgets.m_wGroupIcon.LoadImageFromSet(0, imageset, iconName);
151 }
152}
ArmaReforgerScripted GetGame()
Definition game.c:1398
void SCR_FactionManager(IEntitySource src, IEntity parent)
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void LoadGroupName(notnull SCR_AIGroup aiGroup)
void LoadGroupFlag(notnull SCR_AIGroup aiGroup)
void SetGroupIcon(ResourceName imageset, string iconName)
void SetGroupIconFromFaction(Faction faction, string iconName=string.Empty)
ResourceName GetGroupFlagImageSet()
static string GetTranslatedGroupName(notnull SCR_AIGroup group)
SCR_FieldOfViewSettings Attribute