示例#1
0
        public void SwapDelay(ResourcePanelType panelType, Action extraCallBack = null)
        {
            if (TransitionManager.GetInstance.currentSceneManager.sceneType == SceneType.Battlefield)
            {
                return;
            }
            switch (panelType)
            {
            case ResourcePanelType.overhead:
                overheadPanel.gameObject.SetActive(true);
                sidePanel.gameObject.SetActive(false);
                bottomPanel.gameObject.SetActive(false);
                overheadPanel.InitializeData();
                overheadPanel.myPanel.PlayOpenAnimation();
                currentPanel = overheadPanel;
                break;

            case ResourcePanelType.side:
                sidePanel.gameObject.SetActive(true);
                overheadPanel.gameObject.SetActive(false);
                bottomPanel.gameObject.SetActive(false);
                sidePanel.InitializeData();
                sidePanel.myPanel.PlayOpenAnimation();
                currentPanel = sidePanel;
                break;

            case ResourcePanelType.bottom:
                bottomPanel.gameObject.SetActive(true);
                sidePanel.gameObject.SetActive(false);
                overheadPanel.gameObject.SetActive(false);
                bottomPanel.InitializeData();
                bottomPanel.myPanel.PlayOpenAnimation();
                currentPanel = bottomPanel;
                break;

            default:
                break;
            }

            currentPanel.isShowing = true;

            currentPanel.foodControl.ShowWarning();
            currentPanel.coinControl.ShowWarning();
            currentPanel.troopControl.ShowWarning();
            currentPanel.villagerControl.ShowWarning();
            currentPanel.HidePotentialResourceChanges();
            if (extraCallBack != null)
            {
                extraCallBack();
            }

            UpdateCurrentPanel();
        }
示例#2
0
        public void HideCurrentPanel(Parameters p = null)
        {
            if (currentPanel != null && currentPanel.isShowing)
            {
                currentPanel.foodControl.HideWarning();
                currentPanel.coinControl.HideWarning();
                currentPanel.troopControl.HideWarning();
                currentPanel.villagerControl.HideWarning();

                currentPanel.isShowing = false;
                currentPanel.myPanel.PlayCloseAnimation();
                currentPanel = null;
            }
        }
示例#3
0
        public void ShowResourcePanel(ResourcePanelType panelType, Action extraCallBack = null)
        {
            if (currentPanel != null)
            {
                currentPanel.gameObject.SetActive(true);
                currentPanel.isShowing = false;

                if (currentPanel.resourcePanelType != panelType)
                {
                    StartCoroutine(currentPanel.myPanel.WaitAnimationForAction(currentPanel.myPanel.closeAnimationName, () => SwapDelay(panelType, extraCallBack)));
                }
                else
                {
                    switch (panelType)
                    {
                    case ResourcePanelType.overhead:
                        overheadPanel.gameObject.SetActive(true);
                        sidePanel.gameObject.SetActive(false);
                        overheadPanel.InitializeData();
                        currentPanel = overheadPanel;
                        break;

                    case ResourcePanelType.side:
                        sidePanel.gameObject.SetActive(true);
                        overheadPanel.gameObject.SetActive(false);
                        sidePanel.InitializeData();
                        currentPanel = sidePanel;
                        break;

                    case ResourcePanelType.bottom:
                        bottomPanel.gameObject.SetActive(true);
                        sidePanel.gameObject.SetActive(false);
                        overheadPanel.gameObject.SetActive(false);
                        bottomPanel.InitializeData();
                        currentPanel = bottomPanel;
                        break;

                    default:
                        break;
                    }
                    currentPanel.isShowing = true;
                    StartCoroutine(currentPanel.myPanel.WaitAnimationForAction(currentPanel.myPanel.openAnimationName, extraCallBack));
                }
            }
            else
            {
                switch (panelType)
                {
                case ResourcePanelType.overhead:
                    overheadPanel.gameObject.SetActive(true);
                    overheadPanel.InitializeData();
                    currentPanel = overheadPanel;
                    currentPanel.weekController.UpdateWeekCountText();
                    break;

                case ResourcePanelType.side:
                    sidePanel.gameObject.SetActive(true);
                    sidePanel.InitializeData();
                    currentPanel = sidePanel;
                    break;

                case ResourcePanelType.bottom:
                    bottomPanel.gameObject.SetActive(true);
                    bottomPanel.InitializeData();
                    currentPanel = bottomPanel;
                    break;

                default:
                    break;
                }
                currentPanel.isShowing = true;
                StartCoroutine(currentPanel.myPanel.WaitAnimationForAction(currentPanel.myPanel.openAnimationName, extraCallBack));
            }
            UpdateCurrentPanel();
        }