Ejemplo n.º 1
0
 public void CloseInGameMenu()
 {
     PanelUtilities.DeactivatePanel(GetComponent <CanvasGroup>());
     if (PlayerScript.MyPlayer)
     {
         PlayerScript.MyPlayer.OpenUI = null;
     }
 }
Ejemplo n.º 2
0
    public void CloseShop()
    {
        PlayerScript.MyPlayer.OpenUI = null;

        PanelUtilities.DeactivatePanel(GetComponent <CanvasGroup>());

        CollectGoldButton.gameObject.SetActive(false);

        ClearPortManager();
    }
Ejemplo n.º 3
0
    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>());
    }
Ejemplo n.º 4
0
    /// <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>());
    }
Ejemplo n.º 5
0
    /// <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;
    }
Ejemplo n.º 6
0
    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>());
        }
    }
Ejemplo n.º 7
0
    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);
        }
    }
Ejemplo n.º 8
0
    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");
        }
    }
Ejemplo n.º 9
0
    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);
        }
    }
Ejemplo n.º 10
0
    /// <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();
    }
Ejemplo n.º 11
0
    public void CloseCombatPanel()
    {
        PlayerScript.MyPlayer.OpenUI = null;

        PanelUtilities.DeactivatePanel(GetComponent <CanvasGroup>());
    }