15 override void OnMenuOpen()
18 s_OnMenuOpen.Invoke();
21 if (m_GameMasterButton)
26 m_GameMasterButton.SetVisible(!editor.IsLimitedInstance());
27 editor.GetOnLimitedChange().Insert(OnEditorLimitedChanged);
35 override void OnMenuOpened()
46 override void OnMenuClose()
56 override void OnMenuHide()
64 protected void OpenPlayerList()
70 void MuteSounds(
bool mute =
true)
75 AudioSystem.SetMasterVolume(AudioSystem.SFX, !mute);
76 AudioSystem.SetMasterVolume(AudioSystem.VoiceChat, !mute);
77 AudioSystem.SetMasterVolume(AudioSystem.Dialog, !mute);
83 protected void OnEditorLimitedChanged(
bool limited)
85 m_GameMasterButton.SetVisible(!limited);
161 SCR_EntityCatalogManagerComponent entityCatalogManager = SCR_EntityCatalogManagerComponent.GetInstance();
162 if (!entityCatalogManager)
173 ResourceName loadoutResource = playerLoadout.GetLoadoutResource();
174 if (!loadoutResource)
177 Resource resource = Resource.Load(loadoutResource);
189 cost =
data.GetSupplyCost();
221 Debug.Error(
"Map entity is missing in the world! Deploy menu won't work correctly.");
236 Widget spinnerRoot =
GetRootWidget().FindAnyWidget(
"LoadingSpinner");
244 Print(
"Cannot find faction manager, respawn menu functionality will be broken.", LogLevel.ERROR);
251 PlayerController pc =
GetGame().GetPlayerController();
257 Print(
"Cannot find player faction affiliation component!", LogLevel.ERROR);
263 Print(
"Cannot find player loadout component!", LogLevel.ERROR);
303 GetGame().GetInputManager().RemoveActionListener(
"ShowScoreboard", EActionTrigger.DOWN, OpenPlayerList);
304 GetGame().GetInputManager().RemoveActionListener(
"DeployMenuSelect", EActionTrigger.DOWN,
RequestRespawn);
306 GetGame().GetInputManager().RemoveActionListener(
"SpawnPointNext", EActionTrigger.DOWN,
NextSpawn);
307 GetGame().GetInputManager().RemoveActionListener(
"SpawnPointPrev", EActionTrigger.DOWN,
PrevSpawn);
309 super.OnMenuFocusLost();
317 editorManager.AutoInit();
319 GetGame().GetInputManager().AddActionListener(
"ShowScoreboard", EActionTrigger.DOWN, OpenPlayerList);
320 GetGame().GetInputManager().AddActionListener(
"DeployMenuSelect", EActionTrigger.DOWN,
RequestRespawn);
322 GetGame().GetInputManager().AddActionListener(
"SpawnPointNext", EActionTrigger.DOWN,
NextSpawn);
323 GetGame().GetInputManager().AddActionListener(
"SpawnPointPrev", EActionTrigger.DOWN,
PrevSpawn);
325 super.OnMenuFocusGained();
345 super.OnMenuOpened();
373 GetGame().GetInputManager().ActivateContext(
"DeployMenuContext");
374 GetGame().GetInputManager().ActivateContext(
"DeployMenuMapContext");
377 GetGame().GetInputManager().ActivateContext(
"MapContext");
386 m_ChatPanel.OnUpdateChat(tDelta);
403 int remainingTime = -1;
408 float spawnPointTime = 0;
413 if (remainingTime > 0)
477 if (!spawnPointResultInfo)
497 SCR_ResourceComponent resourceComponent = SCR_ResourceComponent.FindResourceComponent(spawnPoint);
499 if (resourceComponent)
503 IEntity parentEntity = spawnPoint.GetParent();
507 resourceComponent = SCR_ResourceComponent.FindResourceComponent(parentEntity);
509 if (resourceComponent)
521 if (remainingTime > 0)
548 Print(
"Failed to find SCR_LoadoutRequestUIComponent!", LogLevel.ERROR);
554 Print(
"Failed to find SCR_GroupRequestUIComponent!", LogLevel.ERROR);
560 Print(
"Failed to find SCR_SpawnPointRequestUIComponent!", LogLevel.ERROR);
589 Widget toolMenu =
m_wMenuFrame.FindAnyWidget(
"ToolMenuVert");
590 Widget child = toolMenu.GetChildren();
593 Widget sibling = child.GetSibling();
594 child.RemoveFromHierarchy();
620 SCR_MapConfigComponent configComp = SCR_MapConfigComponent.Cast(
m_GameMode.FindComponent(SCR_MapConfigComponent));
673 vector o = spawnPoint.GetOrigin();
678 float xScaled =
GetGame().GetWorkspace().DPIUnscale(x);
679 float yScaled =
GetGame().GetWorkspace().DPIUnscale(y);
703 Debug.Error(
"Selected SpawnPointId is invalid!");
707 ResourceName resourcePrefab = ResourceName.Empty;
712 Debug.Error(
"No player loadout assigned!");
764 if (!assignedFaction)
788 if (!m_ChatPanel || m_ChatPanel.IsOpen())
797 GetGame().OpenPauseMenu(
false,
true);
828 int remainingTime = -1;
833 bool hasGroup =
true;
846 static SCR_DeployMenuMain OpenDeployMenu()
848 if (!GetDeployMenu())
851 return GetDeployMenu();
855 static void CloseDeployMenu()
861 static SCR_DeployMenuMain GetDeployMenu()
872 protected string m_sText;
875 protected string m_sShortcutName;
878 protected string m_sTextHolderName;
880 protected TextWidget m_wText;
881 protected Widget m_wShortcut;
882 protected Widget m_wTextHolder;
885 protected string m_sLoadingSpinner;
888 protected string m_sBackground;
891 protected Widget m_wSupplies;
892 protected Widget m_wBackgroundWidget;
893 protected RichTextWidget m_wSuppliesText;
897 protected int m_iSupplyCost;
901 override void HandlerAttached(Widget w)
903 super.HandlerAttached(w);
905 m_wText = TextWidget.Cast(w.FindAnyWidget(
m_sText));
906 m_wShortcut = w.FindAnyWidget(m_sShortcutName);
907 m_wTextHolder = w.FindAnyWidget(m_sTextHolderName);
910 m_wSupplies = w.FindAnyWidget(
"w_Supplies");
913 if (m_wBackgroundWidget)
914 GetOnUpdateEnableColor().Insert(UpdateBackground);
917 m_wSuppliesText = RichTextWidget.Cast(m_wSupplies.FindAnyWidget(
"SuppliesText"));
921 void SetSuppliesEnabled(
bool enabled)
927 void SetSupplyCost(
int cost)
940 void SetText(
bool deployEnabled,
string text,
float remainingTime = -1)
948 m_wShortcut.SetVisible(deployEnabled && remainingTime <= 0);
952 if (remainingTime >= 0)
955 m_wText.SetTextFormat(text, respawnTime);
959 m_wText.SetText(text);
970 if (remainingTime >= 0)
973 m_wText.SetTextFormat(
"ERROR %1", respawnTime);
977 m_wText.SetText(
"ERROR");
982 void UpdateSpinner(
float timeSlice)
990 void ShowLoading(
bool show)
992 m_wTextHolder.SetVisible(show);
998 void UpdateBackground()
1002 color = m_ActionDisabled;
1004 color = m_ActionDefault;
1006 m_wBackgroundWidget.SetColor(color);