Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioPanelEditorUIComponent.c
Go to the documentation of this file.
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 {
33 }
34
35 //------------------------------------------------------------------------------------------------
36 protected void OnPlayerSpawned(int playerID, SCR_EditableEntityComponent entity, SCR_EditableEntityComponent prevEntity)
37 {
39 if (!editorPlayerManager || !editorPlayerManager.HasLocalPlayerSpawnedOnce())
40 return;
41
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
55 }
56
57 //------------------------------------------------------------------------------------------------
58 //Remove all event listeners
59 protected void StopListeningToEvents()
60 {
62 return;
63
65
66 //Remove on faction set playable listener
68 if (delegateFactionManager)
69 {
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
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
92 if (editorPlayerManager)
93 editorPlayerManager.GetOnSpawn().Remove(OnPlayerSpawned);
94 }
95
96 //------------------------------------------------------------------------------------------------
97 override void HandlerAttached(Widget w)
98 {
99 //Are there any playable factions
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
111 if (!editorPlayerManager || editorPlayerManager.HasLocalPlayerSpawnedOnce())
112 return;
113
114 m_wRoot = w;
115
116 //Show button only
118
119 //Listen to events
121
122 //On faction set playable listener
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
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 {
149 }
150}
int GetFactionDelegates(notnull out map< Faction, SCR_EditableFactionComponent > outDelegates)
static SCR_DelegateFactionManagerComponent GetInstance()
ScriptInvoker_FactionPlayableChanged GetOnFactionPlayableChanged()
void OnPlayerSpawned(int playerID, SCR_EditableEntityComponent entity, SCR_EditableEntityComponent prevEntity)
void OnFactionSetPlayable(SCR_Faction faction, bool playable)
Definition Types.c:486
SCR_FieldOfViewSettings Attribute