public void CloseInGameMenu() { PanelUtilities.DeactivatePanel(GetComponent <CanvasGroup>()); if (PlayerScript.MyPlayer) { PlayerScript.MyPlayer.OpenUI = null; } }
public void CloseShop() { PlayerScript.MyPlayer.OpenUI = null; PanelUtilities.DeactivatePanel(GetComponent <CanvasGroup>()); CollectGoldButton.gameObject.SetActive(false); ClearPortManager(); }
public void SwitchTo(RectTransform new_panel) { if (!ActivePanel || ActivePanel == new_panel || !new_panel.GetComponent <CanvasGroup>()) { return; } PanelUtilities.DeactivatePanel(ActivePanel.GetComponent <CanvasGroup>()); ActivePanel = new_panel; PanelUtilities.ActivatePanel(ActivePanel.GetComponent <CanvasGroup>()); }
/// <summary> /// Retracts console into bottom of screen /// </summary> /// <returns></returns> IEnumerator CloseConsole() { PlayerScript.MyPlayer.OpenUI = GetComponent <CanvasGroup>(); RectTransform console_rect = GetComponent <RectTransform>(); while (console_rect.sizeDelta.y > 0) { console_rect.sizeDelta = new Vector2(console_rect.sizeDelta.x, console_rect.sizeDelta.y - 20); yield return(null); } PanelUtilities.DeactivatePanel(GetComponent <CanvasGroup>()); }
/// <summary> /// Enables / Disables the tooltip /// </summary> /// <param name="enable">true enables, false disables</param> public void EnableTooltip(bool enable) { if (enable) { PanelUtilities.ActivatePanel(Instance.GetComponent <CanvasGroup>()); } else { PanelUtilities.DeactivatePanel(Instance.GetComponent <CanvasGroup>()); } active = enable; }
public override void OnClientSceneChanged(NetworkConnection conn) { base.OnClientSceneChanged(conn); if (networkSceneName == "main") { PanelUtilities.DeactivatePanel(GetComponent <CanvasGroup>()); } else if (networkSceneName == "menu") { PanelUtilities.DeactivatePanel(LobbyBasePanel); PanelUtilities.ActivatePanel(MainMenuBasePanel); PanelUtilities.ActivatePanel(GetComponent <CanvasGroup>()); } }
void Update() { if (!isLocalPlayer) { return; } if (Input.GetKeyDown(KeyCode.Escape)) { if (ActiveShip != null) { ActiveShip = null; } else if (OpenUI) { PanelUtilities.DeactivatePanel(OpenUI); OpenUI = null; } else { OpenUI = InGameMenuController.Instance.GetComponent <CanvasGroup>(); PanelUtilities.ActivatePanel(OpenUI); } } if (OpenUI) { return; } if (Input.GetKeyDown(KeyCode.I)) { Port[] AllPorts = GameObject.FindObjectsOfType <Port>(); SpawnPort = AllPorts[Random.Range(0, AllPorts.Length)]; CmdSpawnShip(string.Format("{0}Ship{1}", Name, ++NewShipID), SpawnPort.SpawnTile.HexCoord.Q, SpawnPort.SpawnTile.HexCoord.R, 1000); } if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.F)) { FeedbackManager.Instance.OpenFeedback(); } if (Input.GetKeyDown(KeyCode.T)) { OpenUI = TechTree.Instance.GetComponent <CanvasGroup>(); PanelUtilities.ActivatePanel(OpenUI); } }
public override void OnLobbyClientDisconnect(NetworkConnection conn) { base.OnLobbyClientDisconnect(conn); if (SceneManager.GetActiveScene().name == "menu") { PanelUtilities.DeactivatePanel(LobbyBasePanel); PanelUtilities.ActivatePanel(MainMenuBasePanel); PanelUtilities.ActivatePanel(GetComponent <CanvasGroup>()); } else { dontDestroyOnLoad = false; SceneManager.LoadScene("menu"); } }
public override void OnLobbyClientConnect(NetworkConnection conn) { base.OnLobbyClientConnect(conn); if (SceneManager.GetActiveScene().name == "menu") { PanelUtilities.DeactivatePanel(MainMenuBasePanel); PanelUtilities.ActivatePanel(LobbyBasePanel); } else { SceneManager.LoadScene("menu"); PanelUtilities.DeactivatePanel(MainMenuBasePanel); PanelUtilities.ActivatePanel(LobbyBasePanel); } }
/// <summary> /// Close dialogue box /// </summary> public void CloseDialogue() { DialogueOpen = false; PanelUtilities.DeactivatePanel(GetComponent <CanvasGroup>()); foreach (Button b in options) { Destroy(b.gameObject); } foreach (RectTransform rt in panels) { Destroy(rt.gameObject); } options.Clear(); panels.Clear(); }
public void CloseCombatPanel() { PlayerScript.MyPlayer.OpenUI = null; PanelUtilities.DeactivatePanel(GetComponent <CanvasGroup>()); }