21 protected Widget m_wPersistentFaction;
22 protected TextWidget m_wScenarioTimeElapsed;
23 protected TextWidget m_wPlayerCount;
24 protected TextWidget m_wServerName;
26 protected int m_iMaxPlayerCount;
27 protected float m_fTimer = 0;
29 protected int m_iLastFocusedEntryPlayerId;
32 override void OnMenuOpen()
41 m_wPersistentFaction =
GetRootWidget().FindAnyWidget(
"PermanentFaction");
42 if (m_wPersistentFaction)
43 m_wPersistentFaction.SetVisible(!SCR_RespawnSystemComponent.GetInstance().IsFactionChangeAllowed());
45 m_wScenarioTimeElapsed = TextWidget.Cast(
GetRootWidget().FindAnyWidget(
"TimeElapsed"));
46 m_wServerName = TextWidget.Cast(
GetRootWidget().FindAnyWidget(
"ServerName"));
51 m_wServerName.SetText(header.m_sName);
53 m_iMaxPlayerCount = header.m_iPlayerCount;
58 Print(
"SCR_DeployMenuHandler is missing on root widget of " +
this, LogLevel.ERROR);
62 PlayerController pc =
GetGame().GetPlayerController();
64 if (!m_PlyFactionAffilComp)
66 Print(
"Cannot find player faction affiliation component!", LogLevel.ERROR);
70 if (!m_PlyLoadoutComp)
72 Print(
"Cannot find player loadout component!", LogLevel.ERROR);
75 m_wPlayerCount = TextWidget.Cast(
GetRootWidget().FindAnyWidget(
"PlayerCount"));
81 FindRequestHandlers();
87 m_ContinueButton.m_OnActivated.Insert(Close);
88 m_ContinueButton.SetEnabled(CanContinue());
92 if (m_GroupOpenButton)
99 if (m_ViewProfileButton)
101 UpdateViewProfileButton(
true);
102 m_ViewProfileButton.m_OnActivated.Insert(OnViewProfile);
111 m_ChatButton.m_OnActivated.Insert(OnChatToggle);
115 m_PauseButton.m_OnActivated.Insert(OnPauseMenu);
119 override void OnMenuOpened()
121 super.OnMenuOpened();
123 if (m_FactionRequestUIHandler)
131 override void OnMenuUpdate(
float tDelta)
133 super.OnMenuUpdate(tDelta);
135 GetGame().GetInputManager().ActivateContext(
"DeployMenuContext");
138 m_ChatPanel.OnUpdateChat(tDelta);
145 override void OnMenuFocusGained()
149 editorManager.AutoInit();
151 GetGame().GetInputManager().AddActionListener(
"ShowScoreboard", EActionTrigger.DOWN, OpenPlayerList);
153 super.OnMenuFocusGained();
156 override void OnMenuFocusLost()
158 GetGame().GetInputManager().RemoveActionListener(
"ShowScoreboard", EActionTrigger.DOWN, OpenPlayerList);
160 super.OnMenuFocusLost();
164 protected void FindRequestHandlers()
166 m_FactionRequestUIHandler =
m_MenuHandler.GetFactionRequestHandler();
172 protected void HookEvents()
177 m_PlyLoadoutComp.GetOnPlayerLoadoutRequestInvoker_O().Insert(OnPlayerLoadoutRequest);
178 m_PlyLoadoutComp.GetOnPlayerLoadoutResponseInvoker_O().Insert(OnPlayerLoadoutResponse);
180 m_FactionRequestUIHandler.GetOnButtonFocused().Insert(ShowFactionPlayerList);
181 m_FactionRequestUIHandler.GetOnFactionRequested().Insert(OnPlayerFactionResponse);
196 protected void UpdateElapsedTime()
201 if (m_wScenarioTimeElapsed)
202 m_wScenarioTimeElapsed.SetText(timeElapsed);
208 protected void InitMapPlain()
210 ResourceName
conf =
"{A786DD4868598F15}Configs/Map/MapPlain.conf";
218 protected void OnMouseLeft()
221 bool hasGroup =
true;
226 ShowFactionPlayerList(btn.GetFaction());
234 protected void ShowFactionPlayerList(
Faction faction =
null)
236 if (m_FactionPlayerList)
238 m_FactionPlayerList.SetFaction(faction);
239 m_FactionPlayerList.ShowPlayerList(
true);
246 protected void ShowLoadoutList()
248 if (m_FactionPlayerList)
249 m_FactionPlayerList.ShowPlayerList(
false);
255 protected void UpdatePlayerCount()
257 if (m_iMaxPlayerCount > 0)
258 m_wPlayerCount.SetTextFormat(
"%1/%2",
GetGame().GetPlayerManager().
GetPlayerCount().ToString(), m_iMaxPlayerCount);
264 protected bool CanContinue()
266 if (!m_PlyFactionAffilComp || !m_PlyLoadoutComp)
279 protected bool CanOpenGroupMenu()
284 protected void OpenGroupMenu()
299 m_FactionRequestUIHandler.OnPlayerFactionAssigned(component.GetAffiliatedFaction());
300 if (factionIndex == -1)
303 m_FactionRequestUIHandler.SetExpanded(
false);
310 Widget list = m_FactionRequestUIHandler.GetFactionButton(factionIndex).GetList();;
317 Widget list = m_FactionRequestUIHandler.GetFactionButton(factionIndex).GetGridList();
321 array<int> players = {};
322 GetGame().GetPlayerManager().GetPlayers(players);
323 foreach (
int pid : players)
326 players.RemoveItem(pid);
334 m_ContinueButton.SetEnabled(CanContinue());
335 if (m_wPersistentFaction)
336 m_wPersistentFaction.SetVisible(
false);
339 m_FactionRequestUIHandler.Unlock();
343 protected void OnPlayerGroupJoined(
SCR_AIGroup group,
int pid = -1)
353 array<int> players = group.GetPlayerIDs();
360 protected void OnLocalGroupJoined(
SCR_AIGroup group)
368 OnPlayerGroupJoined(group);
370 m_ContinueButton.SetEnabled(CanContinue());
387 m_ContinueButton.SetEnabled(CanContinue());
391 protected void OnChatToggle()
400 if (!m_ChatPanel || m_ChatPanel.IsOpen())
406 protected void OnPauseMenu()
408 UpdateViewProfileButton(
true);
409 GetGame().OpenPauseMenu(
false,
true);
412 override void OnMenuClose()
421 protected void OnPlayerEntryFocused(
int id)
423 m_iLastFocusedEntryPlayerId = id;
424 UpdateViewProfileButton();
428 protected void OnPlayerEntryFocusLost(Widget w)
430 UpdateViewProfileButton(
true);
434 protected void OnViewProfile()
436 GetGame().GetPlayerManager().ShowUserProfile(m_iLastFocusedEntryPlayerId);
440 protected void UpdateViewProfileButton(
bool forceHidden =
false)
442 if (!m_ViewProfileButton)
445 m_ViewProfileButton.SetVisible(!forceHidden &&
GetGame().GetPlayerManager().IsUserProfileAvailable(m_iLastFocusedEntryPlayerId),
false);
455 if (!GetRoleSelectionMenu())
458 return GetRoleSelectionMenu();
462 static void CloseRoleSelectionMenu()