Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
MenuRootBase.c
Go to the documentation of this file.
1
6
7//---- REFACTOR NOTE START: This code will need to be refactored as current implementation is not conforming to the standards ----
8// This class should be merged with ChimeraMenuBase
9
11{
12
13//---- REFACTOR NOTE END ----
14
15//---- REFACTOR NOTE START: This code will need to be refactored as current implementation is not conforming to the standards ----
16// This gives components access to their menu's events (they will register to the MenuRootComponent) through tight couplings: it is debatable if this is the right approach
17
19
20//---- REFACTOR NOTE END ----
21
31
32//---- REFACTOR NOTE START: This code will need to be refactored as current implementation is not conforming to the standards ----
33// Old implementation, now we have HUD manager for this stuff
34
36
37//---- REFACTOR NOTE END ----
38
40
41 //------------------------------------------------------------------------------------------------
90
91 //------------------------------------------------------------------------------------------------
98
99 //------------------------------------------------------------------------------------------------
101 {
103 if (chatManager)
104 GetGame().GetCallqueue().CallLater(chatManager.OnMenuClosed, 1);
105 }
106
107 //------------------------------------------------------------------------------------------------
108 void InitChat()
109 {
110 // Check if this menu has chat
111 Widget chatPanelWidget = GetRootWidget().FindAnyWidget("ChatPanel");
112 if (!chatPanelWidget)
113 return;
114
115 m_ChatPanel = SCR_ChatPanel.Cast(chatPanelWidget.FindHandler(SCR_ChatPanel));
116 }
117
118 //------------------------------------------------------------------------------------------------
119 // Chat related methods are here, as we assume any menu can have it's chat panel and therefore needs to implement these.
120 void ShowChat()
121 {
123 if (!chatManager)
124 return;
125
126 // Check if this menu has chat
127 Widget chatPanelWidget = GetRootWidget().FindAnyWidget("ChatPanel");
128 if (!chatPanelWidget)
129 return;
130
131 SCR_ChatPanel chatPanel = SCR_ChatPanel.Cast(chatPanelWidget.FindHandler(SCR_ChatPanel));
132 chatManager.HideAllChatPanels();
133 chatManager.ShowChatPanel(chatPanel);
134 }
135
136 //------------------------------------------------------------------------------------------------
141
142 //------------------------------------------------------------------------------------------------
147
148 //------------------------------------------------------------------------------------------------
149 override void OnMenuFocusGained()
150 {
151 super.OnMenuFocusGained();
152 ShowChat(); // If chat is part of this menu, it will be shown
155 }
156
157 //------------------------------------------------------------------------------------------------
158 override void OnMenuFocusLost()
159 {
160 super.OnMenuFocusLost();
162 m_EventOnMenuFocusLost.Invoke();
163 }
164
165 //------------------------------------------------------------------------------------------------
166 override void OnMenuShow()
167 {
168 super.OnMenuShow();
170 m_EventOnMenuShow.Invoke();
171 }
172
173 //------------------------------------------------------------------------------------------------
174 override void OnMenuHide()
175 {
176 super.OnMenuHide();
178 m_EventOnMenuHide.Invoke();
179 }
180
181 //------------------------------------------------------------------------------------------------
182 override void OnMenuItem(string menuItemName, bool changed, bool finished)
183 {
184 super.OnMenuItem(menuItemName, changed, finished);
186 m_EventOnMenuItem.Invoke(menuItemName, changed, finished);
187 }
188
189 //------------------------------------------------------------------------------------------------
190 override void OnMenuUpdate(float tDelta)
191 {
192 super.OnMenuUpdate(tDelta);
193
194 if (m_ChatPanel)
195 m_ChatPanel.OnUpdateChat(tDelta);
196
198 m_EventOnMenuUpdate.Invoke(tDelta);
199 }
200
201 //------------------------------------------------------------------------------------------------
202 override void OnMenuOpen()
203 {
204 super.OnMenuOpen();
205 InitChat();
206 ShowChat(); // If chat is part of this menu, it will be shown
208 m_EventOnMenuOpen.Invoke();
209 }
210
211 //------------------------------------------------------------------------------------------------
212 override void OnMenuInit()
213 {
214 super.OnMenuInit();
216 m_DynamicFooter = SCR_DynamicFooterComponent.FindComponentInHierarchy(GetRootWidget());
218 m_MenuRootComponent.Init(this);
220 m_EventOnMenuInit.Invoke();
221 }
222
223 //------------------------------------------------------------------------------------------------
224 override void OnMenuClose()
225 {
226 super.OnMenuClose();
227 OnMenuClosed();
229 m_EventOnMenuClose.Invoke();
230 }
231};
ArmaReforgerScripted GetGame()
Definition game.c:1398
bool IsFocused()
Widget GetRootWidget()
Constant variables used in various menus.
ref ScriptInvoker m_EventOnMenuHide
ScriptInvoker GetOnMenuClose()
ref ScriptInvoker m_EventOnMenuClose
override void OnMenuInit()
override void OnMenuShow()
ScriptInvoker GetOnMenuInit()
ScriptInvoker GetOnMenuOpen()
override void OnMenuUpdate(float tDelta)
SCR_DynamicFooterComponent m_DynamicFooter
ref ScriptInvoker m_EventOnMenuFocusLost
SCR_ChatPanel m_ChatPanel
ScriptInvoker GetOnMenuFocusGained()
SCR_DynamicFooterComponent GetFooterComponent()
ScriptInvoker GetOnMenuUpdate()
ref ScriptInvoker m_EventOnMenuOpen
ScriptInvoker GetOnMenuFocusLost()
ref ScriptInvoker m_EventOnMenuUpdate
ref ScriptInvoker m_EventOnMenuFocusGained
ref ScriptInvoker m_EventOnMenuShow
MenuRootComponent m_MenuRootComponent
ref ScriptInvoker m_EventOnMenuInit
override void OnMenuOpen()
ScriptInvoker GetOnMenuItem()
ScriptInvoker GetOnMenuShow()
void OnMenuClosed()
override void OnMenuHide()
override void OnMenuFocusLost()
ref ScriptInvoker m_EventOnMenuItem
MenuRootComponent GetRootComponent()
ScriptInvoker GetOnMenuHide()
override void OnMenuFocusGained()
override void OnMenuItem(string menuItemName, bool changed, bool finished)
override void OnMenuClose()
static MenuRootComponent GetRootOf(Widget widget)
void ShowChatPanel(notnull SCR_ChatPanel panel)
static SCR_ChatPanelManager GetInstance()
Returns SCR_ChatPanelManager instance.
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134