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_CaptureAndHoldObjectiveDisplay.c
Go to the documentation of this file.
1
3
class
SCR_CaptureAndHoldObjectiveDisplay
: SCR_InfoDisplayExtended
4
{
5
[
Attribute
(
"{56B174A06C7ECFAB}UI/Layouts/HUD/CaptureAndHold/CaptureandHoldObjectiveLayout.layout"
,
params
:
"layout"
)]
6
protected
ResourceName
m_rObjectiveHUDLayout
;
7
9
protected
ref array<ref SCR_CaptureAndHoldObjectiveDisplayObject>
m_aObjectiveElements
= {};
10
12
protected
SCR_CaptureAndHoldManager
m_AreaManager
;
14
protected
SCR_BaseGameMode
m_GameMode
;
15
16
//------------------------------------------------------------------------------------------------
18
override
bool
DisplayStartDrawInit
(
IEntity
owner)
19
{
20
// No ui can be drawn without necessary items
21
m_GameMode
=
SCR_BaseGameMode
.Cast(
GetGame
().
GetGameMode
());
22
if
(!
m_GameMode
)
23
return
false
;
24
25
m_AreaManager
= SCR_CaptureAndHoldManager.Cast(
m_GameMode
.FindComponent(SCR_CaptureAndHoldManager));
26
if
(!
m_AreaManager
)
27
return
false
;
28
29
return
true
;
30
}
31
32
//------------------------------------------------------------------------------------------------
34
override
void
DisplayStartDraw
(
IEntity
owner)
35
{
36
// Create objective icons
37
array<SCR_CaptureAndHoldArea> areas = {};
38
m_AreaManager
.GetAreas(areas);
39
CreateObjectiveDisplays
(areas);
40
}
41
42
//------------------------------------------------------------------------------------------------
44
override
void
DisplayStopDraw
(
IEntity
owner)
45
{
46
// Clear ALL hud objects
47
ClearObjectiveDisplays
(
false
);
48
}
49
50
//------------------------------------------------------------------------------------------------
52
override
void
DisplayUpdate
(
IEntity
owner,
float
timeSlice)
53
{
54
// area markers
55
array<SCR_CaptureAndHoldArea> areas = {};
56
int
count =
m_AreaManager
.GetAreas(areas);
57
World
world =
GetGame
().GetWorld();
58
IEntity
playerEntity =
GetGame
().GetPlayerController().GetControlledEntity();
59
60
// Filter out entries which do not link to area anymore
61
ClearObjectiveDisplays
(
true
);
62
// Redraw all elements
63
if
(areas.Count() !=
m_aObjectiveElements
.Count())
64
{
65
ClearObjectiveDisplays
(
false
);
66
CreateObjectiveDisplays
(areas);
67
}
68
69
for
(
int
i = 0; i < count; i++)
70
{
71
m_aObjectiveElements
[i].UpdateDynamic(playerEntity, timeSlice);
72
}
73
}
74
75
//------------------------------------------------------------------------------------------------
77
protected
void
CreateObjectiveDisplays
(array<SCR_CaptureAndHoldArea> areas)
78
{
79
Widget
objective;
80
SCR_CaptureAndHoldObjectiveDisplayObject
displayObject;
81
for
(
int
i = 0, count = areas.Count(); i < count; i++)
82
{
83
objective =
GetRootWidget
().GetWorkspace().CreateWidgets(
m_rObjectiveHUDLayout
,
GetRootWidget
());
84
if
(!objective)
85
continue
;
86
87
displayObject =
new
SCR_CaptureAndHoldObjectiveDisplayObject
(objective, areas[i]);
88
m_aObjectiveElements
.Insert(displayObject);
89
}
90
}
91
92
//------------------------------------------------------------------------------------------------
95
protected
void
ClearObjectiveDisplays
(
bool
emptyOnly)
96
{
97
// Clear previous elements
98
Widget
w;
99
for
(
int
i =
m_aObjectiveElements
.Count() - 1; i >= 0; i--)
100
{
101
if
(emptyOnly &&
m_aObjectiveElements
[i].
GetArea
())
102
continue
;
103
104
w =
m_aObjectiveElements
[i].GetRootWidget();
105
if
(w)
106
{
107
w.RemoveFromHierarchy();
108
delete
w;
109
}
110
111
m_aObjectiveElements
.Remove(i);
112
}
113
}
114
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
GetGameMode
SCR_BaseGameMode GetGameMode()
Definition
SCR_BaseGameModeComponent.c:15
GetArea
SCR_CaptureAndHoldArea GetArea(int index)
Returns an area at given index.
Definition
SCR_CaptureAndHoldManager.c:88
GetRootWidget
Widget GetRootWidget()
Definition
SCR_ModularButtonComponent.c:189
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
IEntity
Definition
IEntity.c:13
ResourceName
Definition
ResourceName.c:13
SCR_BaseGameMode
Definition
SCR_BaseGameMode.c:139
SCR_CaptureAndHoldObjectiveDisplay
Definition
SCR_CaptureAndHoldObjectiveDisplay.c:4
SCR_CaptureAndHoldObjectiveDisplay::DisplayStartDraw
override void DisplayStartDraw(IEntity owner)
Creates HUD elements for individual areas.
Definition
SCR_CaptureAndHoldObjectiveDisplay.c:34
SCR_CaptureAndHoldObjectiveDisplay::DisplayStopDraw
override void DisplayStopDraw(IEntity owner)
Destroys HUD elements of individual areas.
Definition
SCR_CaptureAndHoldObjectiveDisplay.c:44
SCR_CaptureAndHoldObjectiveDisplay::CreateObjectiveDisplays
void CreateObjectiveDisplays(array< SCR_CaptureAndHoldArea > areas)
Creates and fills the objective collection using provided areas.
Definition
SCR_CaptureAndHoldObjectiveDisplay.c:77
SCR_CaptureAndHoldObjectiveDisplay::m_GameMode
SCR_BaseGameMode m_GameMode
Game mode instance.
Definition
SCR_CaptureAndHoldObjectiveDisplay.c:14
SCR_CaptureAndHoldObjectiveDisplay::ClearObjectiveDisplays
void ClearObjectiveDisplays(bool emptyOnly)
Definition
SCR_CaptureAndHoldObjectiveDisplay.c:95
SCR_CaptureAndHoldObjectiveDisplay::DisplayUpdate
override void DisplayUpdate(IEntity owner, float timeSlice)
Updates and manages individual HUD elements.
Definition
SCR_CaptureAndHoldObjectiveDisplay.c:52
SCR_CaptureAndHoldObjectiveDisplay::m_rObjectiveHUDLayout
ResourceName m_rObjectiveHUDLayout
Definition
SCR_CaptureAndHoldObjectiveDisplay.c:6
SCR_CaptureAndHoldObjectiveDisplay::m_AreaManager
SCR_CaptureAndHoldManager m_AreaManager
Area manager provides us with necessary API.
Definition
SCR_CaptureAndHoldObjectiveDisplay.c:12
SCR_CaptureAndHoldObjectiveDisplay::m_aObjectiveElements
ref array< ref SCR_CaptureAndHoldObjectiveDisplayObject > m_aObjectiveElements
Individual element wrappers.
Definition
SCR_CaptureAndHoldObjectiveDisplay.c:9
SCR_CaptureAndHoldObjectiveDisplay::DisplayStartDrawInit
override bool DisplayStartDrawInit(IEntity owner)
Checks whether prerequisites for this InfoDisplay are met.
Definition
SCR_CaptureAndHoldObjectiveDisplay.c:18
SCR_CaptureAndHoldObjectiveDisplayObject
This object serves as a wrapper for individual HUD objective widgets.
Definition
SCR_CaptureAndHoldObjectiveDisplayObject.c:3
Widget
Definition
Widget.c:13
World
Definition
World.c:16
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
CaptureAndHold
SCR_CaptureAndHoldObjectiveDisplay.c
Generated by
1.17.0