Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_LocalPerceivedFactionWidgetComponent.c
Go to the documentation of this file.
2{
3 [Attribute()]
4 protected ref Color m_DefaultColor;
5
6 [Attribute()]
8
9 [Attribute()]
10 protected ref Color m_WarningColor;
11
12 [Attribute("1")]
13 protected bool m_bShowIcon;
14
15 [Attribute("1")]
17
18 [Attribute("0")]
19 protected bool m_bColorOutline;
20
21 [Attribute("{0B03F611D52043AE}UI/Textures/placeholder.edds", desc: "Icon if perceived faction is unknown")]
23
24 protected const string FACTION_ICON_HOLDER = "IconHolder";
25 protected const string FACTION_ICON_NAME = "FactionIcon";
26 protected const string EYE_ICON_NAME = "EyeIcon";
27 protected const string OUTLINE_NAME = "Outline";
28 protected const string FILTER_NAME = "Filter";
29
33 protected Widget m_wOutline;
34 protected Widget m_wFilter;
35
36 SCR_CharacterFactionAffiliationComponent m_CharFactionAffiliation;
37
38 //------------------------------------------------------------------------------------------------
39 protected void OnOnPerceivedFactionChanged(Faction faction)
40 {
41 //~ Character is not a player (Or is possessed AI) so never show perceived faction
42 if (!m_CharFactionAffiliation || !m_CharFactionAffiliation.HasPerceivedFaction())
43 {
44 GetRootWidget().SetVisible(false);
45 return;
46 }
47
48 //~ If player is punished for killing while disguised set color to warning otherwise set to light warning
50 if (perceivedFactionManager && perceivedFactionManager.GetPunishmentKillingWhileDisguisedFlags() == 0)
52 else
54
55 //~ Get player faction
57
58 //~ No player faction so hide UI
59 if (!playerFaction)
60 {
61 GetRootWidget().SetVisible(false);
62 return;
63 }
64
65 //~ Unknown faction
66 if (!faction)
67 {
68 GetRootWidget().SetVisible(true);
69 m_wFactionIcon.LoadImageTexture(0, m_sUnknownFactionIcon);
70
71 return;
72 }
73
74 //~ Player perceived faction is default faction
75 if (playerFaction == faction)
76 {
77 //~ Do not show default faction
79 {
80 GetRootWidget().SetVisible(false);
81 return;
82 }
83 //~ Show default faction
84 else
85 {
86 GetRootWidget().SetVisible(true);
88 }
89 }
90
91 //~ Set perceived faction icon
92 m_wFactionIcon.LoadImageTexture(0, faction.GetUIInfo().GetIconPath());
93 }
94
95 //------------------------------------------------------------------------------------------------
96 protected void SetWidgetColor(Color color)
97 {
98 //if (m_wEyeIcon)
99 // m_wEyeIcon.SetColor(color);
100
101 if (m_wFilter)
102 m_wFilter.SetColor(color);
103
105 m_wOutline.SetColor(color);
106 }
107
108 //------------------------------------------------------------------------------------------------
109 override void HandlerAttached(Widget w)
110 {
111 super.HandlerAttached(w);
112
114 return;
115
116 m_wOutline = w.FindAnyWidget(OUTLINE_NAME);
117 m_wFilter = w.FindAnyWidget(FILTER_NAME);
118
119 //~ Faction icon
120 m_wFactionIconHolder = w.FindAnyWidget(FACTION_ICON_HOLDER);
122 {
123 Print("SCR_LocalPerceivedFactionWidgetComponent is missing Icon holder!", LogLevel.ERROR);
124 return;
125 }
126
128 if (!m_wFactionIcon)
129 {
130 Print("SCR_LocalPerceivedFactionWidgetComponent is missing faction icon widget!", LogLevel.ERROR);
131 return;
132 }
133
135 if (!m_wEyeIcon)
136 Print("SCR_LocalPerceivedFactionWidgetComponent is missing Eye Icon", LogLevel.WARNING);
137
139 if (!perceivedManager || perceivedManager.GetCharacterPerceivedFactionOutfitType() == SCR_EPerceivedFactionOutfitType.DISABLED)
140 {
141 w.SetVisible(false);
142 return;
143 }
144
146 if (!player)
147 {
148 w.SetVisible(false);
150 return;
151 }
152
153 m_CharFactionAffiliation = SCR_CharacterFactionAffiliationComponent.Cast(player.FindComponent(SCR_CharacterFactionAffiliationComponent));
154 if (!m_CharFactionAffiliation || !m_CharFactionAffiliation.HasPerceivedFaction())
155 {
156 w.SetVisible(false);
158 return;
159 }
160
161 m_CharFactionAffiliation.GetOnOnPerceivedFactionChanged().Insert(OnOnPerceivedFactionChanged);
163 }
164
165 //------------------------------------------------------------------------------------------------
166 override void HandlerDeattached(Widget w)
167 {
168 super.HandlerDeattached(w);
169
171 m_CharFactionAffiliation.GetOnOnPerceivedFactionChanged().Remove(OnOnPerceivedFactionChanged);
172 }
173}
void SCR_PerceivedFactionManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition Color.c:13
proto external Managed FindComponent(typename typeName)
static bool IsEditMode()
Definition Functions.c:1566
SCR_CharacterFactionAffiliationComponent m_CharFactionAffiliation
static IEntity GetLocalControlledEntity()
static Faction GetLocalMainEntityFaction()
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute