Ejemplo n.º 1
0
        public IEnumerator Show(bool isWin)
        {
            BlackShow.GetInstance().Show(true);
            PlayerController.GetInstance().obj.SetActive(false);
            EnemyController.GetInstance().obj.SetActive(false);
            obj.SetActive(true);

            if (isWin)
            {
                label.text = "游戏结束,你赢了!";
            }
            else
            {
                label.text = "游戏结束,你输了";
            }

            for (int i = 0; i < playerPowerList.Count; i++)
            {
                player_labels[i].text = playerPowerList[i].ToString();
            }
            for (int i = 0; i < enemyPowerList.Count; i++)
            {
                enemy_labels[i].text = enemyPowerList[i].ToString();
            }

            CoroutineManager.GetInstance().Finish();
            yield return(null);
        }
Ejemplo n.º 2
0
 public void Return()
 {
     BlackShow.GetInstance().Show(false);
     obj.SetActive(false);
     PlayerController.GetInstance().obj.SetActive(true);
     EnemyController.GetInstance().obj.SetActive(true);
 }
Ejemplo n.º 3
0
 public void Hide()
 {
     totalGrid = null;
     grid.DestroyChildren();
     BlackShow.GetInstance().Show(false);
     PlayerController.GetInstance().obj.SetActive(true);
     EnemyController.GetInstance().obj.SetActive(true);
     obj.SetActive(false);
 }
Ejemplo n.º 4
0
        public void Show(ShowBehavior behavior, Transform showGrid, bool repeat)
        {
            showBehavior = behavior;
            popupList.items.Clear();
            popupList.AddItem("近战");
            popupList.AddItem("远程");
            popupList.AddItem("攻城");
            OKButton.onClick.Clear();
            returnButton.onClick.Clear();
            EventDelegate.Add(returnButton.onClick, () => Hide());

            if (!repeat)
            {
                BlackShow.GetInstance().Show(true);
                PlayerController.GetInstance().obj.SetActive(false);
                EnemyController.GetInstance().obj.SetActive(false);
                obj.SetActive(true);
            }

            switch (showBehavior)
            {
            case ShowBehavior.draw:
                label.text = "请选择要打出的牌";
                goto default;

            case ShowBehavior.show:
                label.text = "显示卡牌";
                goto default;

            case ShowBehavior.leader:
                label.text = "领导牌";
                PlayerLeaderBehavior leaderBehavior = LeaderController.GetInstance().obj[0].GetComponent <PlayerLeaderBehavior>();
                messageLabel.text = leaderBehavior.message;
                messageLabel.gameObject.SetActive(true);
                popupList.gameObject.SetActive(false);
                OKButton.gameObject.SetActive(true);
                OKButton.GetComponent <UIButton>().isEnabled = leaderBehavior.IsEnabled;
                EventDelegate.Add(OKButton.onClick, () => leaderBehavior.Play());
                break;

            case ShowBehavior.replace:
                label.text = string.Format("请选择要替换的牌 {0}/2", replaceInt);
                EventDelegate.Add(returnButton.onClick, () => GameController.GetInstance().StartGame());
                goto default;

            case ShowBehavior.nurse:
                label.text = "从墓地中打出卡牌";
                totalGrid  = showGrid;
                messageLabel.gameObject.SetActive(false);
                popupList.gameObject.SetActive(false);
                OKButton.gameObject.SetActive(false);
                EventDelegate.Add(returnButton.onClick, () => CoroutineManager.GetInstance().AddTask(EnemyController.GetInstance().Play(EnemyController.GetInstance().grids[1])));
                break;

            case ShowBehavior.dummy:
                label.text = "请选择要替换的牌";
                messageLabel.gameObject.SetActive(false);
                popupList.gameObject.SetActive(true);
                OKButton.gameObject.SetActive(false);
                break;

            case ShowBehavior.warhorn:
                label.text = "战争号角";
                messageLabel.gameObject.SetActive(false);
                popupList.gameObject.SetActive(true);
                OKButton.gameObject.SetActive(true);
                OKButton.GetComponent <UIButton>().isEnabled = true;
                EventDelegate.Add(OKButton.onClick, () => WarhornController.GetInstance().Warhorn());
                break;

            case ShowBehavior.agile:
                label.text = "请选择出牌的排";
                messageLabel.gameObject.SetActive(false);
                popupList.gameObject.SetActive(true);
                popupList.items.Remove("攻城");
                OKButton.gameObject.SetActive(true);
                OKButton.GetComponent <UIButton>().isEnabled = true;
                EventDelegate.Add(OKButton.onClick, () => AgileController.GetInstance().Agile());
                break;

            default:
                totalGrid = showGrid;
                messageLabel.gameObject.SetActive(false);
                popupList.gameObject.SetActive(false);
                OKButton.gameObject.SetActive(false);
                break;
            }

            if (repeat)
            {
                grid.DestroyChildren();
            }

            for (int i = 0; i < showGrid.childCount; i++)
            {
                GameObject cardObject = Instantiate(showGrid.GetChild(i).gameObject, grid);
                UISprite   sprite     = cardObject.GetComponent <UISprite>();
                sprite.width  = 250;
                sprite.height = 450;
                UIButton cardButton = cardObject.GetComponent <UIButton>();
                switch (showBehavior)
                {
                case ShowBehavior.draw:
                    EventDelegate.Add(cardButton.onClick, () => cardObject.GetComponent <CardBehavior>().Play());
                    cardButton.enabled = true;
                    break;

                case ShowBehavior.show:
                    cardButton.enabled = false;
                    break;

                case ShowBehavior.replace:
                    EventDelegate.Add(cardButton.onClick, () => cardObject.GetComponent <CardBehavior>().Replace());
                    cardButton.enabled = true;
                    break;

                case ShowBehavior.nurse:
                    EventDelegate.Add(cardButton.onClick, () => cardObject.GetComponent <CardBehavior>().Play());
                    cardButton.enabled = true;
                    break;

                case ShowBehavior.dummy:
                    EventDelegate.Add(cardButton.onClick, () => cardObject.GetComponent <CardBehavior>().Dummy());
                    cardButton.enabled = true;
                    break;

                case ShowBehavior.warhorn:
                    cardButton.enabled = false;
                    break;

                case ShowBehavior.agile:
                    cardButton.enabled = false;
                    break;
                }
                cardObject.GetComponent <UIDragScrollView>().scrollView = scrollView;
                cardObject.GetComponent <BoxCollider>().size            = new Vector3(250, 450, 1);
            }

            grid.GetComponent <UIGrid>().Reposition();
        }