Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_MANW_RankComponent.c
Go to the documentation of this file.
2{
3 protected const string IMAGESET_AWARD = "{402BB92E44897D60}UI/Textures/MANW2025/CupRanks.imageset";
4
6
7 [Attribute("")]
8 protected ref array<ref SCR_MANW_RankCategoryData> m_aAwardCategories;
10
11 [Attribute("")]
12 protected ref array<ref SCR_MANW_RankIconData> m_aAwardIcons;
13
14 [Attribute("")]
15 protected ref array<ref SCR_MANW_RankTagCategoryData> m_aTagCategoryData;
17
18 [Attribute("")]
19 protected ref array<ref SCR_MANW_RankTagRankData> m_aTagRankData;
21
22 //------------------------------------------------------------------------------------------------
23 override void HandlerAttached(Widget w)
24 {
25 super.HandlerAttached(w);
26
27 if (!GetGame().InPlayMode())
28 return;
29
30 m_Widgets.Init(m_wRoot);
31 m_wRoot.SetVisible(false);
32
34 foreach (SCR_MANW_RankCategoryData rankCategory : m_aAwardCategories)
35 {
36 m_MapAwardCategories.Insert(rankCategory.m_sIdentifier, rankCategory.m_sName);
37 }
38
40 foreach (SCR_MANW_RankTagCategoryData tagCategoryData : m_aTagCategoryData)
41 {
42 m_MapTagCategoryData.Insert(tagCategoryData.m_sTagName, tagCategoryData.m_sCategoryName);
43 }
44
46 foreach (SCR_MANW_RankTagRankData tagRankData : m_aTagRankData)
47 {
48 m_MapTagRankData.Insert(tagRankData.m_sTagName, tagRankData.m_sRankId);
49 }
50 }
51
52 //------------------------------------------------------------------------------------------------
53 void UpdateAwards(notnull SCR_WorkshopItem workshopItem)
54 {
55 string category;
56 int place;
57 if (!GetAwardData(workshopItem, category, place))
58 {
59 m_wRoot.SetVisible(false);
60 }
61 else
62 {
63 m_wRoot.SetVisible(true);
64
65 m_Widgets.m_wRankIcon.LoadImageFromSet(0, IMAGESET_AWARD, m_aAwardIcons[place - 1].m_sName);
66 m_Widgets.m_wRankIcon.SetColor(m_aAwardIcons[place - 1].m_Color);
67
68 m_Widgets.m_wCategoryText.SetText(m_MapAwardCategories.Get(category));
69 }
70 }
71
72 //------------------------------------------------------------------------------------------------
73 protected bool GetAwardData(notnull SCR_WorkshopItem workshopItem, out string category, out int place)
74 {
75 bool hasCategory, hasRank;
76 string categoryOutput;
77 int placeOutput;
78 array<WorkshopTag> items = {};
79 workshopItem.GetWorkshopItem().GetTags(items);
80 foreach (WorkshopTag item : items)
81 {
82 if (!hasCategory)
83 {
84 if (m_MapTagCategoryData.Find(item.Name(), categoryOutput))
85 {
86 category = categoryOutput;
87 hasCategory = true;
88 }
89 }
90
91 if (!hasRank)
92 {
93 if (m_MapTagRankData.Find(item.Name(), placeOutput))
94 {
95 place = placeOutput;
96 hasRank = true;
97 }
98 }
99
100 if (hasCategory && hasRank)
101 return true;
102 }
103
104 return false;
105 }
106}
107
108[BaseContainerProps(configRoot : true)]
109class SCR_MANW_RankCategoryData
110{
112 string m_sIdentifier;
113
115 string m_sName;
116}
117
118[BaseContainerProps(configRoot : true)]
127
128[BaseContainerProps(configRoot : true)]
129class SCR_MANW_RankTagCategoryData
131 [Attribute("")]
132 string m_sTagName;
134 [Attribute("")]
135 string m_sCategoryName;
136}
137
138[BaseContainerProps(configRoot : true)]
140{
141 [Attribute("")]
142 string m_sTagName;
143
144 [Attribute("")]
145 int m_sRankId;
146}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
ref Color m_Color
LocalizedString m_sName
ref Color m_Color
string m_sName
string m_sIdentifier
Definition Color.c:13
ref array< ref SCR_MANW_RankIconData > m_aAwardIcons
void UpdateAwards(notnull SCR_WorkshopItem workshopItem)
ref array< ref SCR_MANW_RankTagCategoryData > m_aTagCategoryData
ref SCR_MANW_RankLabelWidgets m_Widgets
bool GetAwardData(notnull SCR_WorkshopItem workshopItem, out string category, out int place)
ref map< string, int > m_MapTagRankData
override void HandlerAttached(Widget w)
ref map< string, string > m_MapTagCategoryData
ref array< ref SCR_MANW_RankCategoryData > m_aAwardCategories
ref map< string, string > m_MapAwardCategories
ref array< ref SCR_MANW_RankTagRankData > m_aTagRankData
Definition Types.c:486
SCR_FieldOfViewSettings Attribute