Пример #1
0
    public void OpenShop(Ship ship_to_dock)
    {
        if (ship_to_dock == null)
        {
            return;
        }

        PlayerScript.MyPlayer.OpenUI = GetComponent <CanvasGroup>();

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

        DockedShip = ship_to_dock;

        if (CurrentPort.GoldForPlayer > 0)
        {
            CollectGoldButton.gameObject.SetActive(true);
            CollectGoldButton.GetComponentInChildren <Text>().text = string.Format("Collect {0} Gold", CurrentPort.GoldForPlayer);
        }

        PopulatePortMarket();
        PopulateShipResources();
        PopulateResourcePrices();
        PopulateShipyard();
        PopulateResourceList();
        UpdateGoldText();
    }
Пример #2
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>());
    }
Пример #3
0
    /// <summary>
    /// Opens console from bottom of screen
    /// </summary>
    /// <returns></returns>
    IEnumerator OpenConsole()
    {
        PlayerScript.MyPlayer.OpenUI = GetComponent <CanvasGroup>();
        RectTransform console_rect = GetComponent <RectTransform>();

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

        while (console_rect.sizeDelta.y < 600)
        {
            console_rect.sizeDelta = new Vector2(console_rect.sizeDelta.x, console_rect.sizeDelta.y + 20);
            yield return(null);
        }
    }
Пример #4
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;
    }
Пример #5
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>());
        }
    }
Пример #6
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);
        }
    }
Пример #7
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");
        }
    }
Пример #8
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);
        }
    }
Пример #9
0
    public void OpenCombatPanel()
    {
        PlayerScript.MyPlayer.OpenUI = GetComponent <CanvasGroup>();

        PanelUtilities.ActivatePanel(GetComponent <CanvasGroup>());
    }
Пример #10
0
    /// <summary>
    /// Open dialogue box
    /// </summary>
    public void OpenDialogue()
    {
        DialogueOpen = true;

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