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_CampaignMapInfoDisplay.c
Go to the documentation of this file.
1
class
SCR_CampaignMapInfoDisplay
:
SCR_CampaignInfoDisplay
2
{
3
protected
bool
m_bMapOpen
;
4
protected
bool
m_bCommanderRoleEnabled
;
5
protected
bool
m_bIsPlayerCommander
;
6
7
protected
Widget
m_wCommanderNameWrapper
;
8
protected
ImageWidget
m_wPlatformIcon
;
9
protected
RichTextWidget
m_wCommanderName
;
10
protected
Widget
m_wPlatformScale
;
11
12
protected
MapConfiguration
m_MapConfig
;
13
14
protected
BaseContainer
m_GameplaySettings
;
15
16
protected
const
string
CURRENT_COMMANDER_AI_TEXT
=
"#AR-FactionCommander_CurrentCommander_AI"
;
17
protected
const
string
CURRENT_COMMANDER_PLAYER_TEXT
=
"#AR-FactionCommander_CurrentCommander"
;
18
19
//------------------------------------------------------------------------------------------------
20
override
bool
DisplayStartDrawInit
(
IEntity
owner)
21
{
22
super.DisplayStartDrawInit(owner);
23
24
m_GameplaySettings
=
GetGame
().GetGameUserSettings().GetModule(
"SCR_GameplaySettings"
);
25
26
SCR_FactionCommanderHandlerComponent comp = SCR_FactionCommanderHandlerComponent.GetInstance();
27
28
if
(!comp)
29
return
true
;
30
31
SCR_GameModeCampaign
campaign =
SCR_GameModeCampaign
.GetInstance();
32
if
(campaign)
33
m_bCommanderRoleEnabled
= campaign.GetCommanderRoleEnabled();
34
35
comp.GetOnFactionCommanderChanged().Insert(
OnFactionCommanderChanged
);
36
37
return
true
;
38
}
39
40
//------------------------------------------------------------------------------------------------
41
override
void
DisplayStartDraw
(
IEntity
owner)
42
{
43
super.DisplayStartDraw(owner);
44
45
m_wCommanderNameWrapper
=
m_wRoot
.FindAnyWidget(
"CommanderNameWrapper"
);
46
m_wCommanderName
=
RichTextWidget
.Cast(
m_wRoot
.FindAnyWidget(
"CurrentCommanderPlayers"
));
47
m_wPlatformScale
=
m_wRoot
.FindAnyWidget(
"ScalePlatform"
);
48
m_wPlatformIcon
=
ImageWidget
.Cast(
m_wRoot
.FindAnyWidget(
"PlatformIcon"
));
49
50
SCR_MapEntity
.
GetOnMapOpen
().Insert(
OnMapOpen
);
51
SCR_MapEntity
.
GetOnMapClose
().Insert(
OnMapClose
);
52
}
53
54
//------------------------------------------------------------------------------------------------
55
override
void
DisplayStopDraw
(
IEntity
owner)
56
{
57
super.DisplayStopDraw(owner);
58
59
SCR_MapEntity
.
GetOnMapOpen
().Remove(
OnMapOpen
);
60
SCR_MapEntity
.
GetOnMapClose
().Remove(
OnMapClose
);
61
62
SCR_FactionCommanderHandlerComponent commanderHandler = SCR_FactionCommanderHandlerComponent.GetInstance();
63
if
(!commanderHandler)
64
return
;
65
66
commanderHandler.GetOnFactionCommanderChanged().Remove(
OnFactionCommanderChanged
);
67
}
68
69
//------------------------------------------------------------------------------------------------
70
override
void
UpdateHUD
()
71
{
72
m_bPeriodicRefresh
=
false
;
73
74
if
(!
m_wRoot
|| !
m_bInitDone
)
75
return
;
76
77
if
(
m_Campaign
.IsTutorial() ||
m_Campaign
.GetIsMatchOver())
78
{
79
Show
(
false
);
80
return
;
81
}
82
83
if
(
m_bMapOpen
)
84
Show
(
true
);
85
86
UpdateHUDValues
();
87
}
88
89
//------------------------------------------------------------------------------------------------
90
override
void
UpdateHUDValues
()
91
{
92
super.UpdateHUDValues();
93
string
name;
94
95
SCR_Faction
faction =
SCR_Faction
.Cast(
SCR_FactionManager
.SGetLocalPlayerFaction());
96
if
(!faction)
97
return
;
98
99
int
commanderId = faction.
GetCommanderId
();
100
101
SCR_PlayerController
playerController =
SCR_PlayerController
.Cast(
GetGame
().
GetPlayerController
());
102
if
(!playerController)
103
return
;
104
105
if
(!
m_wCommanderNameWrapper
|| !
m_wCommanderName
)
106
return
;
107
108
m_bIsPlayerCommander
= playerController.
GetLocalPlayerId
() == commanderId;
109
110
bool
isSupportStationMapMode;
111
112
if
(
m_MapConfig
)
113
{
114
EMapEntityMode
currentMapEntityMode =
m_MapConfig
.MapEntityMode;
115
isSupportStationMapMode = currentMapEntityMode ==
EMapEntityMode
.LOGISTICS_STATION ||
116
currentMapEntityMode ==
EMapEntityMode
.OPERATIONS_STATION ||
117
currentMapEntityMode ==
EMapEntityMode
.COMBAT_SUPPORT_STATION;
118
}
119
120
if
(!
m_bCommanderRoleEnabled
|| isSupportStationMapMode || !faction.
IsCommanderAvailable
())
121
{
122
m_wCommanderNameWrapper
.SetVisible(
false
);
123
return
;
124
}
125
126
m_wCommanderNameWrapper
.SetVisible(
true
);
127
128
if
(!faction.
IsAICommander
())
129
name =
SCR_PlayerNamesFilterCache
.GetInstance().GetPlayerDisplayName(commanderId);
130
else
131
name =
CURRENT_COMMANDER_AI_TEXT
;
132
133
m_wCommanderName
.SetTextFormat(
CURRENT_COMMANDER_PLAYER_TEXT
, name);
134
135
SetPlatformImage
(!faction.
IsAICommander
(), commanderId, playerController);
136
}
137
138
//------------------------------------------------------------------------------------------------
139
void
OnMapOpen
(
MapConfiguration
config)
140
{
141
m_MapConfig
= config;
142
143
if
(
m_Campaign
.IsTutorial())
144
return
;
145
146
m_bMapOpen
=
true
;
147
148
if
(SCR_DeployMenuMain.GetDeployMenu() == null)
149
{
150
Show
(
true
);
151
UpdateHUD
();
152
}
153
else
154
{
155
Show
(
false
);
156
}
157
}
158
159
//------------------------------------------------------------------------------------------------
160
void
OnMapClose
(
MapConfiguration
config)
161
{
162
m_MapConfig
= null;
163
164
if
(
m_Campaign
.IsTutorial())
165
return
;
166
167
m_bMapOpen
=
false
;
168
Show
(
false
);
169
}
170
171
//------------------------------------------------------------------------------------------------
172
protected
void
SetPlatformImage
(
bool
setVisible,
int
commanderId, notnull
SCR_PlayerController
playerController)
173
{
174
if
(!
m_wPlatformIcon
|| !
m_wPlatformScale
)
175
return
;
176
177
if
(!setVisible)
178
{
179
m_wPlatformScale
.SetVisible(
false
);
180
return
;
181
}
182
183
bool
showOnPC;
184
if
(
m_GameplaySettings
)
185
m_GameplaySettings
.Get(
"m_bPlatformIconNametag"
, showOnPC);
186
187
bool
res = playerController.SetPlatformImageTo(commanderId,
m_wPlatformIcon
, showOnPC: showOnPC);
188
m_wPlatformScale
.SetVisible(res);
189
}
190
191
//------------------------------------------------------------------------------------------------
192
protected
void
OnFactionCommanderChanged
(
SCR_Faction
faction,
int
commanderPlayerId)
193
{
194
if
(faction && faction ==
SCR_Faction
.Cast(
SCR_FactionManager
.SGetLocalPlayerFaction()))
195
UpdateHUDValues
();
196
}
197
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition
SCR_FactionManager.c:498
SCR_GameModeCampaign
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
Definition
SCR_GameModeCampaign.c:1812
m_wRoot
Widget m_wRoot
Definition
SCR_GameModeCleanSweep.c:25
EMapEntityMode
EMapEntityMode
Mode of the map.
Definition
SCR_MapConstants.c:29
BaseContainer
Definition
BaseContainer.c:13
IEntity
Definition
IEntity.c:13
ImageWidget
Definition
ImageWidget.c:13
MapConfiguration
Definition
MapConfiguration.c:3
RichTextWidget
Definition
RichTextWidget.c:13
SCR_CampaignInfoDisplay
Definition
SCR_CampaignInfoDisplay.c:3
SCR_CampaignInfoDisplay::m_bPeriodicRefresh
bool m_bPeriodicRefresh
Definition
SCR_CampaignInfoDisplay.c:9
SCR_CampaignInfoDisplay::m_bInitDone
bool m_bInitDone
Definition
SCR_CampaignInfoDisplay.c:8
SCR_CampaignInfoDisplay::m_Campaign
SCR_GameModeCampaign m_Campaign
Definition
SCR_CampaignInfoDisplay.c:11
SCR_CampaignMapInfoDisplay
Definition
SCR_CampaignMapInfoDisplay.c:2
SCR_CampaignMapInfoDisplay::OnMapOpen
void OnMapOpen(MapConfiguration config)
Definition
SCR_CampaignMapInfoDisplay.c:139
SCR_CampaignMapInfoDisplay::m_bMapOpen
bool m_bMapOpen
Definition
SCR_CampaignMapInfoDisplay.c:3
SCR_CampaignMapInfoDisplay::DisplayStartDrawInit
override bool DisplayStartDrawInit(IEntity owner)
Definition
SCR_CampaignMapInfoDisplay.c:20
SCR_CampaignMapInfoDisplay::UpdateHUDValues
override void UpdateHUDValues()
Definition
SCR_CampaignMapInfoDisplay.c:90
SCR_CampaignMapInfoDisplay::SetPlatformImage
void SetPlatformImage(bool setVisible, int commanderId, notnull SCR_PlayerController playerController)
Definition
SCR_CampaignMapInfoDisplay.c:172
SCR_CampaignMapInfoDisplay::CURRENT_COMMANDER_PLAYER_TEXT
const string CURRENT_COMMANDER_PLAYER_TEXT
Definition
SCR_CampaignMapInfoDisplay.c:17
SCR_CampaignMapInfoDisplay::m_GameplaySettings
BaseContainer m_GameplaySettings
Definition
SCR_CampaignMapInfoDisplay.c:14
SCR_CampaignMapInfoDisplay::m_wPlatformScale
Widget m_wPlatformScale
Definition
SCR_CampaignMapInfoDisplay.c:10
SCR_CampaignMapInfoDisplay::m_bIsPlayerCommander
bool m_bIsPlayerCommander
Definition
SCR_CampaignMapInfoDisplay.c:5
SCR_CampaignMapInfoDisplay::OnFactionCommanderChanged
void OnFactionCommanderChanged(SCR_Faction faction, int commanderPlayerId)
Definition
SCR_CampaignMapInfoDisplay.c:192
SCR_CampaignMapInfoDisplay::OnMapClose
void OnMapClose(MapConfiguration config)
Definition
SCR_CampaignMapInfoDisplay.c:160
SCR_CampaignMapInfoDisplay::UpdateHUD
override void UpdateHUD()
Definition
SCR_CampaignMapInfoDisplay.c:70
SCR_CampaignMapInfoDisplay::CURRENT_COMMANDER_AI_TEXT
const string CURRENT_COMMANDER_AI_TEXT
Definition
SCR_CampaignMapInfoDisplay.c:16
SCR_CampaignMapInfoDisplay::m_wCommanderName
RichTextWidget m_wCommanderName
Definition
SCR_CampaignMapInfoDisplay.c:9
SCR_CampaignMapInfoDisplay::m_MapConfig
MapConfiguration m_MapConfig
Definition
SCR_CampaignMapInfoDisplay.c:12
SCR_CampaignMapInfoDisplay::m_bCommanderRoleEnabled
bool m_bCommanderRoleEnabled
Definition
SCR_CampaignMapInfoDisplay.c:4
SCR_CampaignMapInfoDisplay::m_wPlatformIcon
ImageWidget m_wPlatformIcon
Definition
SCR_CampaignMapInfoDisplay.c:8
SCR_CampaignMapInfoDisplay::DisplayStartDraw
override void DisplayStartDraw(IEntity owner)
Definition
SCR_CampaignMapInfoDisplay.c:41
SCR_CampaignMapInfoDisplay::DisplayStopDraw
override void DisplayStopDraw(IEntity owner)
Definition
SCR_CampaignMapInfoDisplay.c:55
SCR_CampaignMapInfoDisplay::m_wCommanderNameWrapper
Widget m_wCommanderNameWrapper
Definition
SCR_CampaignMapInfoDisplay.c:7
SCR_Faction
Definition
SCR_Faction.c:6
SCR_Faction::IsAICommander
bool IsAICommander()
Definition
SCR_Faction.c:887
SCR_Faction::GetCommanderId
int GetCommanderId()
Definition
SCR_Faction.c:899
SCR_Faction::IsCommanderAvailable
bool IsCommanderAvailable()
Definition
SCR_Faction.c:347
SCR_MapEntity
Definition
SCR_MapEntity.c:18
SCR_MapEntity::GetOnMapClose
static ScriptInvokerBase< MapConfigurationInvoker > GetOnMapClose()
Get on map close invoker.
Definition
SCR_MapEntity.c:92
SCR_MapEntity::GetOnMapOpen
static ScriptInvokerBase< MapConfigurationInvoker > GetOnMapOpen()
Get on map open invoker.
Definition
SCR_MapEntity.c:88
SCR_PlayerController
Definition
SCR_PlayerController.c:31
SCR_PlayerController::GetLocalPlayerId
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
Definition
SCR_PlayerController.c:481
SCR_PlayerNamesFilterCache
Definition
SCR_PlayerNamesFilterCache.c:3
Widget
Definition
Widget.c:13
Show
override void Show()
Definition
gameLib.c:262
GetPlayerController
proto external PlayerController GetPlayerController()
Definition
SCR_PlayerDeployMenuHandlerComponent.c:307
scripts
Game
UI
HUD
SCR_CampaignMapInfoDisplay.c
Generated by
1.17.0