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_ScenarioPanelEditorUIComponent.c
Go to the documentation of this file.
1
class
SCR_ScenarioPanelEditorUIComponent
:
ScriptedWidgetComponent
2
{
3
[
Attribute
(
"ToolbarBackgroundOverlay"
)]
4
protected
string
m_sFullWindowName
;
5
6
[
Attribute
(
"ConfigureScenarioButton"
)]
7
protected
string
m_sButtonOnlyName
;
8
9
protected
Widget
m_wRoot
;
10
11
protected
bool
m_bListeningToEvents
;
12
13
//------------------------------------------------------------------------------------------------
14
//Show/hide full UI
15
protected
void
ShowButtonOrFullWindow
(
bool
showFullWindow)
16
{
17
Widget
fullWindow =
m_wRoot
.FindAnyWidget(
m_sFullWindowName
);
18
Widget
buttonOnly =
m_wRoot
.FindAnyWidget(
m_sButtonOnlyName
);
19
20
if
(!fullWindow || !buttonOnly)
21
return
;
22
23
fullWindow.SetVisible(showFullWindow);
24
buttonOnly.SetVisible(!showFullWindow);
25
}
26
27
//------------------------------------------------------------------------------------------------
28
//When an attribute has been changed
29
protected
void
OnAttributeChanges
()
30
{
31
StopListeningToEvents
();
32
ShowButtonOrFullWindow
(
true
);
33
}
34
35
//------------------------------------------------------------------------------------------------
36
protected
void
OnPlayerSpawned
(
int
playerID,
SCR_EditableEntityComponent
entity,
SCR_EditableEntityComponent
prevEntity)
37
{
38
SCR_PlayersManagerEditorComponent
editorPlayerManager =
SCR_PlayersManagerEditorComponent
.Cast(
SCR_PlayersManagerEditorComponent
.GetInstance(
SCR_PlayersManagerEditorComponent
));
39
if
(!editorPlayerManager || !editorPlayerManager.
HasLocalPlayerSpawnedOnce
())
40
return
;
41
42
StopListeningToEvents
();
43
ShowButtonOrFullWindow
(
true
);
44
}
45
46
//------------------------------------------------------------------------------------------------
47
//When faction is set playable
48
protected
void
OnFactionSetPlayable
(
SCR_Faction
faction,
bool
playable)
49
{
50
if
(!playable)
51
return
;
52
53
StopListeningToEvents
();
54
ShowButtonOrFullWindow
(
true
);
55
}
56
57
//------------------------------------------------------------------------------------------------
58
//Remove all event listeners
59
protected
void
StopListeningToEvents
()
60
{
61
if
(!
m_bListeningToEvents
)
62
return
;
63
64
m_bListeningToEvents
=
false
;
65
66
//Remove on faction set playable listener
67
SCR_DelegateFactionManagerComponent
delegateFactionManager =
SCR_DelegateFactionManagerComponent
.
GetInstance
();
68
if
(delegateFactionManager)
69
{
70
map<Faction, SCR_EditableFactionComponent>
delegates =
new
map<Faction, SCR_EditableFactionComponent>
();
71
delegateFactionManager.
GetFactionDelegates
(delegates);
72
SCR_Faction
scrFaction;
73
74
foreach
(
Faction
f, SCR_EditableFactionComponent d : delegates)
75
{
76
scrFaction =
SCR_Faction
.Cast(f);
77
78
if
(!scrFaction)
79
continue
;
80
81
scrFaction.
GetOnFactionPlayableChanged
().Remove(
OnFactionSetPlayable
);
82
}
83
}
84
85
//Remove on attribute changes listener
86
SCR_AttributesManagerEditorComponent attributeManager = SCR_AttributesManagerEditorComponent.Cast(SCR_AttributesManagerEditorComponent.GetInstance(SCR_AttributesManagerEditorComponent));
87
if
(attributeManager)
88
attributeManager.GetOnAttributeChangesApplied().Remove(
OnAttributeChanges
);
89
90
//Remove on local player spawned listener
91
SCR_PlayersManagerEditorComponent
editorPlayerManager =
SCR_PlayersManagerEditorComponent
.Cast(
SCR_PlayersManagerEditorComponent
.GetInstance(
SCR_PlayersManagerEditorComponent
));
92
if
(editorPlayerManager)
93
editorPlayerManager.
GetOnSpawn
().Remove(
OnPlayerSpawned
);
94
}
95
96
//------------------------------------------------------------------------------------------------
97
override
void
HandlerAttached
(
Widget
w)
98
{
99
//Are there any playable factions
100
SCR_DelegateFactionManagerComponent
delegateFactionManager =
SCR_DelegateFactionManagerComponent
.
GetInstance
();
101
if
(!delegateFactionManager|| delegateFactionManager.
GetPlayableFactionDelegateCount
() > 0)
102
return
;
103
104
//Has attribute been changed yet
105
SCR_AttributesManagerEditorComponent attributeManager = SCR_AttributesManagerEditorComponent.Cast(SCR_AttributesManagerEditorComponent.GetInstance(SCR_AttributesManagerEditorComponent,
true
));
106
if
(!attributeManager || attributeManager.GetChangedAttributesOnce())
107
return
;
108
109
//Local player has spawned yet
110
SCR_PlayersManagerEditorComponent
editorPlayerManager =
SCR_PlayersManagerEditorComponent
.Cast(
SCR_PlayersManagerEditorComponent
.GetInstance(
SCR_PlayersManagerEditorComponent
));
111
if
(!editorPlayerManager || editorPlayerManager.
HasLocalPlayerSpawnedOnce
())
112
return
;
113
114
m_wRoot
= w;
115
116
//Show button only
117
ShowButtonOrFullWindow
(
false
);
118
119
//Listen to events
120
m_bListeningToEvents
=
true
;
121
122
//On faction set playable listener
123
map<Faction, SCR_EditableFactionComponent>
delegates =
new
map<Faction, SCR_EditableFactionComponent>
();
124
delegateFactionManager.
GetFactionDelegates
(delegates);
125
SCR_Faction
scrFaction;
126
127
foreach
(
Faction
f, SCR_EditableFactionComponent d : delegates)
128
{
129
scrFaction =
SCR_Faction
.Cast(f);
130
131
if
(!scrFaction)
132
continue
;
133
134
scrFaction.
GetOnFactionPlayableChanged
().Insert(
OnFactionSetPlayable
);
135
}
136
137
//On attribute changes listener
138
attributeManager.GetOnAttributeChangesApplied().Insert(
OnAttributeChanges
);
139
140
//On local player spawned listener
141
if
(editorPlayerManager)
142
editorPlayerManager.
GetOnSpawn
().Insert(
OnPlayerSpawned
);
143
}
144
145
//------------------------------------------------------------------------------------------------
146
override
void
HandlerDeattached
(
Widget
w)
147
{
148
StopListeningToEvents
();
149
}
150
}
Faction
Definition
Faction.c:13
SCR_DelegateFactionManagerComponent
Definition
SCR_DelegateFactionManagerComponent.c:16
SCR_DelegateFactionManagerComponent::GetFactionDelegates
int GetFactionDelegates(notnull out map< Faction, SCR_EditableFactionComponent > outDelegates)
Definition
SCR_DelegateFactionManagerComponent.c:40
SCR_DelegateFactionManagerComponent::GetInstance
static SCR_DelegateFactionManagerComponent GetInstance()
Definition
SCR_DelegateFactionManagerComponent.c:27
SCR_DelegateFactionManagerComponent::GetPlayableFactionDelegateCount
int GetPlayableFactionDelegateCount()
Definition
SCR_DelegateFactionManagerComponent.c:100
SCR_EditableEntityComponent
Definition
SCR_EditableEntityComponent.c:14
SCR_Faction
Definition
SCR_Faction.c:6
SCR_Faction::GetOnFactionPlayableChanged
ScriptInvoker_FactionPlayableChanged GetOnFactionPlayableChanged()
Definition
SCR_Faction.c:490
SCR_PlayersManagerEditorComponent
Definition
SCR_PlayersManagerEditorComponent.c:10
SCR_PlayersManagerEditorComponent::HasLocalPlayerSpawnedOnce
bool HasLocalPlayerSpawnedOnce()
Definition
SCR_PlayersManagerEditorComponent.c:155
SCR_PlayersManagerEditorComponent::GetOnSpawn
ScriptInvoker GetOnSpawn()
Definition
SCR_PlayersManagerEditorComponent.c:172
SCR_ScenarioPanelEditorUIComponent
Definition
SCR_ScenarioPanelEditorUIComponent.c:2
SCR_ScenarioPanelEditorUIComponent::StopListeningToEvents
void StopListeningToEvents()
Definition
SCR_ScenarioPanelEditorUIComponent.c:59
SCR_ScenarioPanelEditorUIComponent::m_bListeningToEvents
bool m_bListeningToEvents
Definition
SCR_ScenarioPanelEditorUIComponent.c:11
SCR_ScenarioPanelEditorUIComponent::m_sButtonOnlyName
string m_sButtonOnlyName
Definition
SCR_ScenarioPanelEditorUIComponent.c:7
SCR_ScenarioPanelEditorUIComponent::OnPlayerSpawned
void OnPlayerSpawned(int playerID, SCR_EditableEntityComponent entity, SCR_EditableEntityComponent prevEntity)
Definition
SCR_ScenarioPanelEditorUIComponent.c:36
SCR_ScenarioPanelEditorUIComponent::ShowButtonOrFullWindow
void ShowButtonOrFullWindow(bool showFullWindow)
Definition
SCR_ScenarioPanelEditorUIComponent.c:15
SCR_ScenarioPanelEditorUIComponent::OnAttributeChanges
void OnAttributeChanges()
Definition
SCR_ScenarioPanelEditorUIComponent.c:29
SCR_ScenarioPanelEditorUIComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_ScenarioPanelEditorUIComponent.c:97
SCR_ScenarioPanelEditorUIComponent::m_wRoot
Widget m_wRoot
Definition
SCR_ScenarioPanelEditorUIComponent.c:9
SCR_ScenarioPanelEditorUIComponent::m_sFullWindowName
string m_sFullWindowName
Definition
SCR_ScenarioPanelEditorUIComponent.c:4
SCR_ScenarioPanelEditorUIComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_ScenarioPanelEditorUIComponent.c:146
SCR_ScenarioPanelEditorUIComponent::OnFactionSetPlayable
void OnFactionSetPlayable(SCR_Faction faction, bool playable)
Definition
SCR_ScenarioPanelEditorUIComponent.c:48
ScriptedWidgetComponent
Definition
ScriptedWidgetComponent.c:13
Widget
Definition
Widget.c:13
map
Definition
Types.c:486
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
Editor
UI
Components
Common
SCR_ScenarioPanelEditorUIComponent.c
Generated by
1.17.0