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_SuppliesTransportSystemUI.c
Go to the documentation of this file.
1
class
SCR_SuppliesTransportSystemUI
:
SCR_ScriptedWidgetComponent
2
{
3
[
Attribute
(
"{4093FEFCBC51D74A}UI/layouts/Campaign/TransportUnit.layout"
,
desc
:
"Trasnport unit layout path."
)]
4
protected
ResourceName
m_sTransportUnitLayoutResource
;
5
6
[
Attribute
(
"Labels"
)]
7
protected
string
m_sLabelsWidgetName
;
8
9
[
Attribute
(
"TransportUnitsContainer"
)]
10
protected
string
m_sTransportUnitsContainerWidgetName
;
11
12
[
Attribute
(
"NoTransportUnitInfo"
)]
13
protected
string
m_sNoTransportUnitInfoWidgetName
;
14
15
protected
Widget
m_wLabels
;
16
protected
Widget
m_wTransportUnitsContainer
;
17
protected
Widget
m_wNoTransportUnitInfo
;
18
19
protected
SCR_SuppliesTransportSystem
m_SuppliesTransportSystem
;
20
21
protected
ref
map<SCR_TransportUnitComponent, SCR_TransportUnitUI>
m_mTransportUnits
=
new
map<SCR_TransportUnitComponent, SCR_TransportUnitUI>
();
22
23
//------------------------------------------------------------------------------------------------
24
void
Init
()
25
{
26
if
(!
m_SuppliesTransportSystem
)
27
return
;
28
29
m_SuppliesTransportSystem
.GetOnTransportUnitAdded().Insert(
CreateTransportUnit
);
30
m_SuppliesTransportSystem
.GetOnTransportUnitRemoved().Insert(
RemoveTransportUnit
);
31
32
array<SCR_TransportUnitComponent> transportUnits = {};
33
m_SuppliesTransportSystem
.GetTransportUnits(transportUnits,
SCR_FactionManager
.SGetLocalPlayerFaction());
34
35
bool
isTransportUnitsEmpty = transportUnits.IsEmpty();
36
if
(
m_wNoTransportUnitInfo
)
37
m_wNoTransportUnitInfo
.SetVisible(isTransportUnitsEmpty);
38
39
if
(
m_wLabels
)
40
m_wLabels
.SetVisible(!isTransportUnitsEmpty);
41
42
foreach
(
SCR_TransportUnitComponent
theTransportUnit : transportUnits)
43
{
44
CreateTransportUnit
(theTransportUnit);
45
}
46
}
47
48
//------------------------------------------------------------------------------------------------
49
void
Deinit
()
50
{
51
if
(!
m_SuppliesTransportSystem
)
52
return
;
53
54
array<SCR_TransportUnitComponent> transportUnits = {};
55
m_SuppliesTransportSystem
.GetTransportUnits(transportUnits,
SCR_FactionManager
.SGetLocalPlayerFaction());
56
for
(
int
i = transportUnits.Count() - 1; i >= 0; i--)
57
{
58
RemoveTransportUnit
(transportUnits[i]);
59
}
60
61
m_SuppliesTransportSystem
.GetOnTransportUnitAdded().Remove(
CreateTransportUnit
);
62
m_SuppliesTransportSystem
.GetOnTransportUnitRemoved().Remove(
RemoveTransportUnit
);
63
}
64
65
//------------------------------------------------------------------------------------------------
66
void
ToggleVisibility
(
bool
isVisible)
67
{
68
if
(isVisible && !
m_mTransportUnits
.IsEmpty())
69
m_mTransportUnits
.GetElement(0).FocusButton();
70
}
71
72
//------------------------------------------------------------------------------------------------
73
protected
void
CreateTransportUnit
(notnull
SCR_TransportUnitComponent
transportUnit)
74
{
75
if
(!
m_wTransportUnitsContainer
)
76
return
;
77
78
if
(transportUnit.GetFaction() !=
SCR_FactionManager
.SGetLocalPlayerFaction())
79
return
;
80
81
Widget
transportUnitWidget =
GetGame
().GetWorkspace().CreateWidgets(
m_sTransportUnitLayoutResource
,
m_wTransportUnitsContainer
);
82
if
(!transportUnitWidget)
83
return
;
84
85
SCR_TransportUnitUI
transportUnitUI =
SCR_TransportUnitUI
.Cast(transportUnitWidget.FindHandler(
SCR_TransportUnitUI
));
86
transportUnitUI.
Init
(transportUnit);
87
m_mTransportUnits
.Insert(transportUnit, transportUnitUI);
88
}
89
90
//------------------------------------------------------------------------------------------------
91
protected
void
RemoveTransportUnit
(
SCR_TransportUnitComponent
transportUnit)
92
{
93
SCR_TransportUnitUI
transportUnitUI =
m_mTransportUnits
.Get(transportUnit);
94
if
(!transportUnitUI)
95
return
;
96
97
transportUnitUI.
Deinit
();
98
transportUnitUI.GetRootWidget().RemoveFromHierarchy();
99
m_mTransportUnits
.Remove(transportUnit);
100
}
101
102
//------------------------------------------------------------------------------------------------
103
override
void
HandlerAttached
(
Widget
w)
104
{
105
if
(!
GetGame
().InPlayMode())
106
return
;
107
108
super.HandlerAttached(w);
109
110
m_wLabels
= w.FindAnyWidget(
m_sLabelsWidgetName
);
111
112
m_wTransportUnitsContainer
= w.FindAnyWidget(
m_sTransportUnitsContainerWidgetName
);
113
if
(!
m_wTransportUnitsContainer
)
114
return
;
115
116
SCR_WidgetHelper
.RemoveAllChildren(
m_wTransportUnitsContainer
);
117
118
m_wNoTransportUnitInfo
= w.FindAnyWidget(
m_sNoTransportUnitInfoWidgetName
);
119
120
m_SuppliesTransportSystem
=
SCR_SuppliesTransportSystem
.
GetInstance
();
121
}
122
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition
SCR_FactionManager.c:498
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
ResourceName
Definition
ResourceName.c:13
SCR_ScriptedWidgetComponent
Definition
SCR_ScriptedWidgetComponent.c:8
SCR_SuppliesTransportSystem
Definition
SCR_SuppliesTransportSystem.c:6
SCR_SuppliesTransportSystem::GetInstance
static SCR_SuppliesTransportSystem GetInstance()
Definition
SCR_SuppliesTransportSystem.c:29
SCR_SuppliesTransportSystemUI
Definition
SCR_SuppliesTransportSystemUI.c:2
SCR_SuppliesTransportSystemUI::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_SuppliesTransportSystemUI.c:103
SCR_SuppliesTransportSystemUI::m_wNoTransportUnitInfo
Widget m_wNoTransportUnitInfo
Definition
SCR_SuppliesTransportSystemUI.c:17
SCR_SuppliesTransportSystemUI::m_mTransportUnits
ref map< SCR_TransportUnitComponent, SCR_TransportUnitUI > m_mTransportUnits
Definition
SCR_SuppliesTransportSystemUI.c:21
SCR_SuppliesTransportSystemUI::m_wLabels
Widget m_wLabels
Definition
SCR_SuppliesTransportSystemUI.c:15
SCR_SuppliesTransportSystemUI::m_wTransportUnitsContainer
Widget m_wTransportUnitsContainer
Definition
SCR_SuppliesTransportSystemUI.c:16
SCR_SuppliesTransportSystemUI::Init
void Init()
Definition
SCR_SuppliesTransportSystemUI.c:24
SCR_SuppliesTransportSystemUI::m_SuppliesTransportSystem
SCR_SuppliesTransportSystem m_SuppliesTransportSystem
Definition
SCR_SuppliesTransportSystemUI.c:19
SCR_SuppliesTransportSystemUI::m_sTransportUnitsContainerWidgetName
string m_sTransportUnitsContainerWidgetName
Definition
SCR_SuppliesTransportSystemUI.c:10
SCR_SuppliesTransportSystemUI::m_sTransportUnitLayoutResource
ResourceName m_sTransportUnitLayoutResource
Definition
SCR_SuppliesTransportSystemUI.c:4
SCR_SuppliesTransportSystemUI::CreateTransportUnit
void CreateTransportUnit(notnull SCR_TransportUnitComponent transportUnit)
Definition
SCR_SuppliesTransportSystemUI.c:73
SCR_SuppliesTransportSystemUI::ToggleVisibility
void ToggleVisibility(bool isVisible)
Definition
SCR_SuppliesTransportSystemUI.c:66
SCR_SuppliesTransportSystemUI::m_sLabelsWidgetName
string m_sLabelsWidgetName
Definition
SCR_SuppliesTransportSystemUI.c:7
SCR_SuppliesTransportSystemUI::RemoveTransportUnit
void RemoveTransportUnit(SCR_TransportUnitComponent transportUnit)
Definition
SCR_SuppliesTransportSystemUI.c:91
SCR_SuppliesTransportSystemUI::Deinit
void Deinit()
Definition
SCR_SuppliesTransportSystemUI.c:49
SCR_SuppliesTransportSystemUI::m_sNoTransportUnitInfoWidgetName
string m_sNoTransportUnitInfoWidgetName
Definition
SCR_SuppliesTransportSystemUI.c:13
SCR_TransportUnitComponent
Definition
SCR_TransportUnitComponent.c:11
SCR_TransportUnitUI
Definition
SCR_TransportUnitUI.c:2
SCR_TransportUnitUI::Deinit
void Deinit()
Definition
SCR_TransportUnitUI.c:81
SCR_TransportUnitUI::Init
void Init(SCR_TransportUnitComponent transportUnit)
Definition
SCR_TransportUnitUI.c:58
SCR_WidgetHelper
Definition
SCR_WidgetHelper.c:2
Widget
Definition
Widget.c:13
map
Definition
Types.c:486
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
Conflict
SCR_SuppliesTransportSystemUI.c
Generated by
1.17.0