Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_LocalPerceivedFactionWidgetComponent.c
Go to the documentation of this file.
1
class
SCR_LocalPerceivedFactionWidgetComponent
:
SCR_ScriptedWidgetComponent
2
{
3
[
Attribute
()]
4
protected
ref
Color
m_DefaultColor
;
5
6
[
Attribute
()]
7
protected
ref
Color
m_LightWarningColor
;
8
9
[
Attribute
()]
10
protected
ref
Color
m_WarningColor
;
11
12
[
Attribute
(
"1"
)]
13
protected
bool
m_bShowIcon
;
14
15
[
Attribute
(
"1"
)]
16
protected
bool
m_bShowIfDefaultFaction
;
17
18
[
Attribute
(
"0"
)]
19
protected
bool
m_bColorOutline
;
20
21
[
Attribute
(
"{0B03F611D52043AE}UI/Textures/placeholder.edds"
,
desc
:
"Icon if perceived faction is unknown"
)]
22
protected
ResourceName
m_sUnknownFactionIcon
;
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
30
protected
Widget
m_wFactionIconHolder
;
31
protected
ImageWidget
m_wFactionIcon
;
32
protected
ImageWidget
m_wEyeIcon
;
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
49
SCR_PerceivedFactionManagerComponent
perceivedFactionManager =
SCR_PerceivedFactionManagerComponent
.GetInstance();
50
if
(perceivedFactionManager && perceivedFactionManager.GetPunishmentKillingWhileDisguisedFlags() == 0)
51
SetWidgetColor
(
m_LightWarningColor
);
52
else
53
SetWidgetColor
(
m_WarningColor
);
54
55
//~ Get player faction
56
Faction
playerFaction =
SCR_PlayerController
.
GetLocalMainEntityFaction
();
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
78
if
(!
m_bShowIfDefaultFaction
)
79
{
80
GetRootWidget
().SetVisible(
false
);
81
return
;
82
}
83
//~ Show default faction
84
else
85
{
86
GetRootWidget
().SetVisible(
true
);
87
SetWidgetColor
(
m_DefaultColor
);
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
104
if
(
m_bColorOutline
&&
m_wOutline
)
105
m_wOutline
.SetColor(color);
106
}
107
108
//------------------------------------------------------------------------------------------------
109
override
void
HandlerAttached
(
Widget
w)
110
{
111
super.HandlerAttached(w);
112
113
if
(
SCR_Global
.
IsEditMode
())
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
);
121
if
(!
m_wFactionIconHolder
)
122
{
123
Print
(
"SCR_LocalPerceivedFactionWidgetComponent is missing Icon holder!"
,
LogLevel
.ERROR);
124
return
;
125
}
126
127
m_wFactionIcon
=
ImageWidget
.Cast(
m_wFactionIconHolder
.FindAnyWidget(
FACTION_ICON_NAME
));
128
if
(!
m_wFactionIcon
)
129
{
130
Print
(
"SCR_LocalPerceivedFactionWidgetComponent is missing faction icon widget!"
,
LogLevel
.ERROR);
131
return
;
132
}
133
134
m_wEyeIcon
=
ImageWidget
.Cast(
m_wFactionIconHolder
.FindAnyWidget(
EYE_ICON_NAME
));
135
if
(!
m_wEyeIcon
)
136
Print
(
"SCR_LocalPerceivedFactionWidgetComponent is missing Eye Icon"
,
LogLevel
.WARNING);
137
138
SCR_PerceivedFactionManagerComponent
perceivedManager =
SCR_PerceivedFactionManagerComponent
.GetInstance();
139
if
(!perceivedManager || perceivedManager.GetCharacterPerceivedFactionOutfitType() ==
SCR_EPerceivedFactionOutfitType
.DISABLED)
140
{
141
w.SetVisible(
false
);
142
return
;
143
}
144
145
IEntity
player =
SCR_PlayerController
.
GetLocalControlledEntity
();
146
if
(!player)
147
{
148
w.SetVisible(
false
);
149
m_CharFactionAffiliation
= null;
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
);
157
m_CharFactionAffiliation
= null;
158
return
;
159
}
160
161
m_CharFactionAffiliation
.GetOnOnPerceivedFactionChanged().Insert(
OnOnPerceivedFactionChanged
);
162
OnOnPerceivedFactionChanged
(
m_CharFactionAffiliation
.GetPerceivedFaction());
163
}
164
165
//------------------------------------------------------------------------------------------------
166
override
void
HandlerDeattached
(
Widget
w)
167
{
168
super.HandlerDeattached(w);
169
170
if
(
m_CharFactionAffiliation
)
171
m_CharFactionAffiliation
.GetOnOnPerceivedFactionChanged().Remove(
OnOnPerceivedFactionChanged
);
172
}
173
}
SCR_EPerceivedFactionOutfitType
SCR_EPerceivedFactionOutfitType
Definition
SCR_PerceivedFactionManagerComponent.c:445
SCR_PerceivedFactionManagerComponent
void SCR_PerceivedFactionManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_PerceivedFactionManagerComponent.c:269
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
Color
Definition
Color.c:13
Faction
Definition
Faction.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
ImageWidget
Definition
ImageWidget.c:13
ResourceName
Definition
ResourceName.c:13
SCR_Global
Definition
Functions.c:7
SCR_Global::IsEditMode
static bool IsEditMode()
Definition
Functions.c:1566
SCR_LocalPerceivedFactionWidgetComponent
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:2
SCR_LocalPerceivedFactionWidgetComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:109
SCR_LocalPerceivedFactionWidgetComponent::m_wFactionIcon
ImageWidget m_wFactionIcon
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:31
SCR_LocalPerceivedFactionWidgetComponent::m_LightWarningColor
ref Color m_LightWarningColor
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:7
SCR_LocalPerceivedFactionWidgetComponent::SetWidgetColor
void SetWidgetColor(Color color)
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:96
SCR_LocalPerceivedFactionWidgetComponent::m_DefaultColor
ref Color m_DefaultColor
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:4
SCR_LocalPerceivedFactionWidgetComponent::m_bColorOutline
bool m_bColorOutline
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:19
SCR_LocalPerceivedFactionWidgetComponent::OUTLINE_NAME
const string OUTLINE_NAME
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:27
SCR_LocalPerceivedFactionWidgetComponent::OnOnPerceivedFactionChanged
void OnOnPerceivedFactionChanged(Faction faction)
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:39
SCR_LocalPerceivedFactionWidgetComponent::FILTER_NAME
const string FILTER_NAME
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:28
SCR_LocalPerceivedFactionWidgetComponent::m_wFilter
Widget m_wFilter
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:34
SCR_LocalPerceivedFactionWidgetComponent::m_wOutline
Widget m_wOutline
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:33
SCR_LocalPerceivedFactionWidgetComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:166
SCR_LocalPerceivedFactionWidgetComponent::FACTION_ICON_HOLDER
const string FACTION_ICON_HOLDER
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:24
SCR_LocalPerceivedFactionWidgetComponent::m_wFactionIconHolder
Widget m_wFactionIconHolder
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:30
SCR_LocalPerceivedFactionWidgetComponent::m_WarningColor
ref Color m_WarningColor
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:10
SCR_LocalPerceivedFactionWidgetComponent::EYE_ICON_NAME
const string EYE_ICON_NAME
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:26
SCR_LocalPerceivedFactionWidgetComponent::m_CharFactionAffiliation
SCR_CharacterFactionAffiliationComponent m_CharFactionAffiliation
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:36
SCR_LocalPerceivedFactionWidgetComponent::m_sUnknownFactionIcon
ResourceName m_sUnknownFactionIcon
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:22
SCR_LocalPerceivedFactionWidgetComponent::m_bShowIfDefaultFaction
bool m_bShowIfDefaultFaction
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:16
SCR_LocalPerceivedFactionWidgetComponent::m_bShowIcon
bool m_bShowIcon
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:13
SCR_LocalPerceivedFactionWidgetComponent::m_wEyeIcon
ImageWidget m_wEyeIcon
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:32
SCR_LocalPerceivedFactionWidgetComponent::FACTION_ICON_NAME
const string FACTION_ICON_NAME
Definition
SCR_LocalPerceivedFactionWidgetComponent.c:25
SCR_PlayerController
Definition
SCR_PlayerController.c:31
SCR_PlayerController::GetLocalControlledEntity
static IEntity GetLocalControlledEntity()
Definition
SCR_PlayerController.c:495
SCR_PlayerController::GetLocalMainEntityFaction
static Faction GetLocalMainEntityFaction()
Definition
SCR_PlayerController.c:551
SCR_ScriptedWidgetComponent
Definition
SCR_ScriptedWidgetComponent.c:8
SCR_ScriptedWidgetComponent::GetRootWidget
Widget GetRootWidget()
Definition
SCR_ScriptedWidgetComponent.c:51
Widget
Definition
Widget.c:13
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
Inventory
SCR_LocalPerceivedFactionWidgetComponent.c
Generated by
1.17.0