From a5259cb237d2c83af8a921c164b1445a04bdd7b2 Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Tue, 24 Aug 2021 22:30:53 +0100 Subject: [PATCH] Update MenuManager.cs --- QSB/Menus/MenuManager.cs | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/QSB/Menus/MenuManager.cs b/QSB/Menus/MenuManager.cs index 5dd5a4ca..0505bb17 100644 --- a/QSB/Menus/MenuManager.cs +++ b/QSB/Menus/MenuManager.cs @@ -7,7 +7,8 @@ namespace QSB.Menus { private IMenuAPI MenuApi => QSBCore.MenuApi; private PopupMenu PopupMenu; - private GameObject MultiplayerButton; + private Button HostButton; + private GameObject ClientButton; private Button DisconnectButton; public void Start() @@ -17,28 +18,36 @@ namespace QSB.Menus private void MakeTitleMenus() { - PopupMenu = MenuApi.MakeInputFieldPopup("IP Address", "IP Address", "Host a server", "Connect to server"); - PopupMenu.OnPopupConfirm += Host; - PopupMenu.OnPopupCancel += Connect; + PopupMenu = MenuApi.MakeInputFieldPopup("IP Address", "IP Address", "Connect", "Cancel"); + PopupMenu.OnPopupConfirm += Connect; + + HostButton = MenuApi.TitleScreen_MakeSimpleButton("MULTIPLAYER (HOST)"); + HostButton.onClick.AddListener(Host); + + ClientButton = MenuApi.TitleScreen_MakeMenuOpenButton("MULTIPLAYER (CONNECT)", PopupMenu); - MultiplayerButton = MenuApi.TitleScreen_MakeMenuOpenButton("MULTIPLAYER", PopupMenu); DisconnectButton = MenuApi.TitleScreen_MakeSimpleButton("DISCONNECT"); - DisconnectButton.gameObject.SetActive(false); DisconnectButton.onClick.AddListener(Disconnect); + + DisconnectButton.gameObject.SetActive(false); + DisconnectButton.GetComponent().alpha = 1f; } private void Disconnect() { QSBNetworkManager.Instance.StopHost(); DisconnectButton.gameObject.SetActive(false); - MultiplayerButton.SetActive(true); + ClientButton.SetActive(true); + HostButton.gameObject.SetActive(true); } private void Host() { QSBNetworkManager.Instance.StartHost(); DisconnectButton.gameObject.SetActive(true); - MultiplayerButton.SetActive(false); + DisconnectButton.GetComponent().alpha = 1f; + ClientButton.SetActive(false); + HostButton.gameObject.SetActive(false); } private void Connect() @@ -46,7 +55,9 @@ namespace QSB.Menus QSBNetworkManager.Instance.networkAddress = (PopupMenu as PopupInputMenu).GetInputText(); QSBNetworkManager.Instance.StartClient(); DisconnectButton.gameObject.SetActive(true); - MultiplayerButton.SetActive(false); + DisconnectButton.GetComponent().alpha = 1f; + ClientButton.SetActive(false); + HostButton.gameObject.SetActive(false); } } } \ No newline at end of file