Example #1
0
        public void ShowLeader(ArrayList cardList, Transform targetGrid, bool buttonEnabled, EventDelegate.Callback returnCallBack)
        {
            OKButton.gameObject.SetActive(false);
            returnButton.onClick.Clear();
            EventDelegate.Add(returnButton.onClick, returnCallBack);
            grid.DestroyChildren();
            totalGrid = targetGrid;

            if (LeaderController.GetInstance().obj[0].GetComponent <PlayerLeaderBehavior>().GetType() == typeof(MonsterBehavior3))
            {
                if (replaceInt < 2)
                {
                    label.text = string.Format("请选择要丢弃的卡牌 {0}/2", replaceInt);
                }
                else
                {
                    label.text = "请从牌组中选取卡牌";
                }
            }

            for (int i = 0; i < cardList.Count; i++)
            {
                GameObject cardObject = cardList[i] as GameObject;
                cardObject.transform.SetTarget(grid);
                UISprite sprite = cardObject.GetComponent <UISprite>();
                sprite.width  = 250;
                sprite.height = 450;
                cardObject.GetComponent <UIButton>().enabled            = buttonEnabled;
                cardObject.GetComponent <UIDragScrollView>().scrollView = scrollView;
                cardObject.GetComponent <BoxCollider>().size            = new Vector3(250, 450, 1);
            }

            grid.GetComponent <UIGrid>().Reposition();
        }
Example #2
0
        IEnumerator PlayOver(Transform card)
        {
            StartCoroutine(LeaderController.GetInstance().EnemyTurnIndicator());
            yield return(TweenCard.GetInstance().Play(card));

            Number();
            PowerController.GetInstance().Number();
            if (TurnController.GetInstance().isTurned[0])
            {
                yield return(Play(grids[1]));
            }
        }
Example #3
0
        public void StartGame()
        {
            if (PlayerController.GetInstance().group == Global.Group.scoiatael)
            {
                CoroutineManager.GetInstance().AddTask(TweenMessage.GetInstance().Play("领导牌技能发动\r\n可选择先手后手"));
            }
            else
            {
                int random = Random.Range(0, 2);
                if (random == 0)
                {
                    offensive = true;
                }
                else
                {
                    offensive = false;
                }
            }

            if (LeaderController.GetInstance().obj[0].GetComponent <PlayerLeaderBehavior>().GetType() == typeof(NilfgaardianBehavior3))
            {
                LeaderController.GetInstance().obj[0].GetComponent <PlayerLeaderBehavior>().Play();
                CoroutineManager.GetInstance().AddTask(TweenMessage.GetInstance().Play("领导牌技能发动\r\n取消对手领导牌能力"));
            }
            if (LeaderController.GetInstance().obj[0].GetComponent <PlayerLeaderBehavior>().GetType() == typeof(ScoiataelBehavior2))
            {
                LeaderController.GetInstance().obj[0].GetComponent <PlayerLeaderBehavior>().Play();
                CoroutineManager.GetInstance().AddTask(TweenMessage.GetInstance().Play("领导牌技能发动\r\n战斗开始时多摸一张牌"));
            }
            if (LeaderController.GetInstance().obj[1].GetComponent <EnemyLeaderBehavior>().GetType() == typeof(EnemyNilfgaardianBehavior3))
            {
                LeaderController.GetInstance().obj[1].GetComponent <EnemyLeaderBehavior>().Play();
                CoroutineManager.GetInstance().AddTask(TweenMessage.GetInstance().Play("敌方领导牌技能发动\r\n取消我方领导牌能力"));
            }
            if (LeaderController.GetInstance().obj[1].GetComponent <EnemyLeaderBehavior>().GetType() == typeof(EnemyScoiataelBehavior2))
            {
                LeaderController.GetInstance().obj[1].GetComponent <EnemyLeaderBehavior>().Play();
                CoroutineManager.GetInstance().AddTask(TweenMessage.GetInstance().Play("敌方领导牌技能发动\r\n战斗开始时多摸一张牌"));
            }

            if (offensive)
            {
                CoroutineManager.GetInstance().AddTask(TweenMessage.GetInstance().Play("你先手"));
                LeaderController.GetInstance().PlayerTurnIndicator();
            }
            else
            {
                CoroutineManager.GetInstance().AddTask(TweenMessage.GetInstance().Play("对方先手"));
                CoroutineManager.GetInstance().AddTask(EnemyController.GetInstance().Play(EnemyController.GetInstance().grids[1]));
            }
        }
Example #4
0
        public void Initialize()
        {
            obj.SetActive(true);
            int     random     = Random.Range(0, 4);
            UIAtlas totalAtlas = new UIAtlas();

            switch (random)
            {
            case 0:
                group = Global.Group.northern;
                avatar_group.spriteName = "player_faction_northern_realms";
                group_label.text        = "北方领域";
                deck_realms.spriteName  = "board_deck_northern_realms";
                totalAtlas = GameController.GetInstance().atlas[0];
                break;

            case 1:
                group = Global.Group.nilfgaardian;
                avatar_group.spriteName = "player_faction_northern_nilfgaard";
                group_label.text        = "尼弗迦德";
                deck_realms.spriteName  = "board_deck_nilfgaard";
                totalAtlas = GameController.GetInstance().atlas[1];
                break;

            case 2:
                group = Global.Group.monster;
                avatar_group.spriteName = "player_faction_northern_no_mans_land";
                group_label.text        = "怪兽";
                deck_realms.spriteName  = "board_deck_no_mans_land";
                totalAtlas = GameController.GetInstance().atlas[2];
                break;

            case 3:
                group = Global.Group.scoiatael;
                avatar_group.spriteName = "player_faction_scoiatael";
                group_label.text        = "松鼠党";
                deck_realms.spriteName  = "board_deck_scoiatael";
                totalAtlas = GameController.GetInstance().atlas[3];
                break;
            }

            XmlDocument xml = new XmlDocument();

            xml.Load(Global.enemyPath);
            XmlElement root    = xml.DocumentElement;
            XmlNode    xmlNode = root.SelectSingleNode(string.Format("/root/{0}", group));

            int name = 0;

            XmlNodeList leaderList   = xmlNode.SelectSingleNode("leader").ChildNodes;
            XmlNode     leaderNode   = leaderList[Random.Range(0, leaderList.Count)];
            GameObject  leaderObject = LeaderController.GetInstance().obj[1];
            UISprite    leaderSprite = leaderObject.GetComponent <UISprite>();

            leaderSprite.atlas      = totalAtlas;
            leaderSprite.spriteName = leaderNode.Attributes["sprite"].Value;
            leaderObject.AddComponent(System.Type.GetType(leaderNode.Attributes["behavior"].Value));

            XmlNodeList special = xmlNode.SelectSingleNode("special").ChildNodes;

            foreach (XmlNode cardNode in special)
            {
                for (int i = 0; i < int.Parse(cardNode.Attributes["max"].Value); i++)
                {
                    GameObject cardObject = Instantiate(GameController.GetInstance().cardPerfab, grids[0]);
                    cardObject.name = name.ToString();
                    name++;
                    UISprite cardSprite = cardObject.GetComponent <UISprite>();
                    cardSprite.atlas      = GameController.GetInstance().atlas[4];
                    cardSprite.spriteName = cardNode.Attributes["sprite"].Value;
                    CardProperty cardProperty = cardObject.GetComponent <CardProperty>();
                    cardProperty.line   = (Global.Line)System.Enum.Parse(typeof(Global.Line), cardNode.Attributes["line"].Value);
                    cardProperty.effect = (Global.Effect)System.Enum.Parse(typeof(Global.Effect), cardNode.Attributes["effect"].Value);
                    cardProperty.gold   = bool.Parse(cardNode.Attributes["gold"].Value);
                    cardProperty.power  = int.Parse(cardNode.Attributes["power"].Value);
                }
            }

            XmlNodeList monster = xmlNode.SelectSingleNode("monster").ChildNodes;

            foreach (XmlNode cardNode in monster)
            {
                for (int i = 0; i < int.Parse(cardNode.Attributes["max"].Value); i++)
                {
                    GameObject cardObject = Instantiate(GameController.GetInstance().cardPerfab, grids[0]);
                    cardObject.name = name.ToString();
                    name++;
                    UISprite cardSprite = cardObject.GetComponent <UISprite>();
                    cardSprite.atlas      = totalAtlas;
                    cardSprite.spriteName = cardNode.Attributes["sprite"].Value;
                    CardProperty cardProperty = cardObject.GetComponent <CardProperty>();
                    cardProperty.line   = (Global.Line)System.Enum.Parse(typeof(Global.Line), cardNode.Attributes["line"].Value);
                    cardProperty.effect = (Global.Effect)System.Enum.Parse(typeof(Global.Effect), cardNode.Attributes["effect"].Value);
                    cardProperty.gold   = bool.Parse(cardNode.Attributes["gold"].Value);
                    cardProperty.power  = int.Parse(cardNode.Attributes["power"].Value);
                }
            }

            XmlNodeList neutral = xmlNode.SelectSingleNode("neutral").ChildNodes;

            foreach (XmlNode cardNode in neutral)
            {
                for (int i = 0; i < int.Parse(cardNode.Attributes["max"].Value); i++)
                {
                    GameObject cardObject = Instantiate(GameController.GetInstance().cardPerfab, grids[0]);
                    cardObject.name = name.ToString();
                    name++;
                    UISprite cardSprite = cardObject.GetComponent <UISprite>();
                    cardSprite.atlas      = GameController.GetInstance().atlas[4];
                    cardSprite.spriteName = cardNode.Attributes["sprite"].Value;
                    CardProperty cardProperty = cardObject.GetComponent <CardProperty>();
                    cardProperty.line   = (Global.Line)System.Enum.Parse(typeof(Global.Line), cardNode.Attributes["line"].Value);
                    cardProperty.effect = (Global.Effect)System.Enum.Parse(typeof(Global.Effect), cardNode.Attributes["effect"].Value);
                    cardProperty.gold   = bool.Parse(cardNode.Attributes["gold"].Value);
                    cardProperty.power  = int.Parse(cardNode.Attributes["power"].Value);
                }
            }

            DrawCards(10);
            Number();
        }
Example #5
0
        public IEnumerator Play(Transform grid)
        {
            bool isTurn = AIController.GetInstance().AITurn();
            int  index  = AIController.GetInstance().AICard(grid);

            if (LeaderController.GetInstance().obj[1].GetComponent <EnemyLeaderBehavior>().IsEnabled)
            {
                LeaderController.GetInstance().obj[1].GetComponent <EnemyLeaderBehavior>().Play();
                yield return(PlayOver(LeaderController.GetInstance().obj[1].transform));

                CoroutineManager.GetInstance().Finish();
                yield break;
            }

            if (isTurn || index == -1)
            {
                yield return(TurnController.GetInstance().EnemyTurn());

                CoroutineManager.GetInstance().Finish();
                yield break;
            }

            Transform card;

            try
            {
                card = grid.GetChild(index);
            }
            catch
            {
                card = grid.GetChild(Random.Range(0, grid.childCount));
            }
            CardProperty cardProperty = card.GetComponent <CardProperty>();

            switch (cardProperty.effect)
            {
            case Global.Effect.spy:
                card.SetTarget(PlayerController.GetInstance().grids[(int)cardProperty.line + 2]);
                DrawCards(2);
                break;

            case Global.Effect.clear_sky:
                WeatherController.GetInstance().ClearSky();
                card.SetTarget(grids[5]);
                break;

            case Global.Effect.frost:
                if (!WeatherController.GetInstance().weather[0])
                {
                    WeatherController.GetInstance().Frost();
                    card.SetTarget(WeatherController.GetInstance().grid);
                    break;
                }
                else
                {
                    goto default;
                }

            case Global.Effect.fog:
                if (!WeatherController.GetInstance().weather[1])
                {
                    WeatherController.GetInstance().Fog();
                    card.SetTarget(WeatherController.GetInstance().grid);
                    break;
                }
                else
                {
                    goto default;
                }

            case Global.Effect.rain:
                if (!WeatherController.GetInstance().weather[2])
                {
                    WeatherController.GetInstance().Rain();
                    card.SetTarget(WeatherController.GetInstance().grid);
                    break;
                }
                else
                {
                    goto default;
                }

            case Global.Effect.nurse:
                if (grids[5].childCount != 0)
                {
                    card.SetTarget(grids[(int)cardProperty.line + 2]);
                    yield return(TweenCard.GetInstance().Play(card));

                    yield return(Play(grids[5]));

                    PlayerController.GetInstance().obj.SetActive(false);
                    obj.SetActive(false);
                    PlayerController.GetInstance().obj.SetActive(true);
                    obj.SetActive(true);
                    yield break;
                }
                else
                {
                    goto default;
                }

            case Global.Effect.scorch:
                int maxPower = 0;
                for (int i = 2; i < 5; i++)
                {
                    for (int ii = 0; ii < PlayerController.GetInstance().grids[i].childCount; ii++)
                    {
                        int power = PlayerController.GetInstance().grids[i].GetChild(ii).GetComponent <CardBehavior>().totalPower;
                        if (power > maxPower)
                        {
                            maxPower = power;
                        }
                    }
                }
                for (int i = 2; i < 5; i++)
                {
                    for (int ii = 0; ii < grids[i].childCount; ii++)
                    {
                        int power = grids[i].GetChild(ii).GetComponent <CardBehavior>().totalPower;
                        if (power > maxPower)
                        {
                            maxPower = power;
                        }
                    }
                }

                for (int i = 2; i < 5; i++)
                {
                    for (int ii = PlayerController.GetInstance().grids[i].childCount - 1; ii >= 0; ii--)
                    {
                        Transform scorchCard = PlayerController.GetInstance().grids[i].GetChild(ii);
                        if (scorchCard.GetComponent <CardBehavior>().totalPower == maxPower && !scorchCard.GetComponent <CardProperty>().gold)
                        {
                            scorchCard.SetTarget(PlayerController.GetInstance().grids[5]);
                        }
                    }
                }
                for (int i = 2; i < 5; i++)
                {
                    for (int ii = grids[i].childCount - 1; ii >= 0; ii--)
                    {
                        Transform scorchCard = grids[i].GetChild(ii);
                        if (scorchCard.GetComponent <CardBehavior>().totalPower == maxPower && !scorchCard.GetComponent <CardProperty>().gold)
                        {
                            scorchCard.SetTarget(grids[5]);
                        }
                    }
                }
                goto default;

            case Global.Effect.dummy:
                if (grids[2].childCount == 0 &&
                    grids[3].childCount == 0 &&
                    grids[4].childCount == 0)
                {
                    card.SetTarget(grids[5]);
                    break;
                }

                int dummyGrid  = 0;
                int dummyIndex = 0;
                for (int i = 2; i < 5; i++)
                {
                    for (int ii = 0; ii < grids[i].childCount; ii++)
                    {
                        if (grids[i].GetChild(ii).GetComponent <CardProperty>().effect == Global.Effect.spy ||
                            grids[i].GetChild(ii).GetComponent <CardProperty>().effect == Global.Effect.nurse ||
                            grids[i].GetChild(ii).GetComponent <CardProperty>().effect == Global.Effect.scorch ||
                            grids[i].GetChild(ii).GetComponent <CardProperty>().effect == Global.Effect.warhorn)
                        {
                            dummyGrid  = i;
                            dummyIndex = ii;
                        }
                    }
                }
                card.SetTarget(grids[dummyGrid]);
                grids[dummyGrid].GetChild(dummyIndex).SetTarget(grid);
                break;

            case Global.Effect.warhorn:
                if (cardProperty.line == Global.Line.empty)
                {
                    if (grids[2].childCount == 0 &&
                        grids[3].childCount == 0 &&
                        grids[4].childCount == 0)
                    {
                        card.SetTarget(grids[5]);
                        break;
                    }

                    int line     = 0;
                    int maxCount = 0;
                    for (int i = 2; i < 5; i++)
                    {
                        if (grids[i].childCount >= maxCount &&
                            !WarhornController.GetInstance().enemyWarhorn[i - 2])
                        {
                            line     = i - 2;
                            maxCount = grids[i].childCount;
                        }
                    }

                    WarhornController.GetInstance().enemyWarhorn[line] = true;
                    card.SetTarget(WarhornController.GetInstance().enemyGrids[line]);
                    break;
                }
                else
                {
                    WarhornController.GetInstance().enemyWarhorn[(int)cardProperty.line] = true;
                    goto default;
                }

            case Global.Effect.muster:
                int musterIndex = 0;
                for (int i = 0; i < MusterController.GetInstance().musterCards.Length; i++)
                {
                    for (int ii = 0; ii < MusterController.GetInstance().musterCards[i].Length; ii++)
                    {
                        if (grid.GetChild(index).GetComponent <UISprite>().spriteName == MusterController.GetInstance().musterCards[i][ii])
                        {
                            musterIndex = i;
                        }
                    }
                }

                for (int i = 0; i < MusterController.GetInstance().musterCards[musterIndex].Length; i++)
                {
                    for (int ii = grids[0].childCount - 1; ii >= 0; ii--)
                    {
                        Transform musterCard = grids[0].GetChild(ii);
                        if (musterCard.GetComponent <UISprite>().spriteName == MusterController.GetInstance().musterCards[musterIndex][i])
                        {
                            musterCard.SetTarget(grids[(int)musterCard.GetComponent <CardProperty>().line + 2]);
                        }
                    }
                }

                goto default;

            case Global.Effect.agile:
                int agileIndex = 0;
                for (int i = 0; i < 2; i++)
                {
                    if (!WeatherController.GetInstance().weather[i])
                    {
                        agileIndex = i;
                    }
                }
                card.SetTarget(grids[agileIndex + 2]);
                break;

            default:
                card.SetTarget(grids[(int)cardProperty.line + 2]);
                break;
            }

            yield return(PlayOver(card));

            CoroutineManager.GetInstance().Finish();
        }
Example #6
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();
        }
Example #7
0
        public IEnumerator Turn()
        {
            TurnController.GetInstance().Clear();
            GameOver.GetInstance().AddPower(PowerController.GetInstance().player_total, PowerController.GetInstance().enemy_total);
            int          power        = PowerController.GetInstance().player_total - PowerController.GetInstance().enemy_total;
            GameBehavior gameBehavior = new GameBehavior();

            if (power > 0)
            {
                enemy_life_gem[enemy_fail].PlayForward();
                enemy_fail++;
                gameBehavior = GameBehavior.win;
            }
            else if (power < 0)
            {
                player_life_gem[player_fail].PlayForward();
                player_fail++;
                gameBehavior = GameBehavior.lose;
            }
            else if (power == 0)
            {
                if (PlayerController.GetInstance().group == Global.Group.nilfgaardian && EnemyController.GetInstance().group == Global.Group.nilfgaardian)
                {
                    player_life_gem[player_fail].PlayForward();
                    enemy_life_gem[enemy_fail].PlayForward();
                    player_fail++;
                    enemy_fail++;
                    gameBehavior = GameBehavior.dogfall;
                }
                else if (PlayerController.GetInstance().group == Global.Group.nilfgaardian)
                {
                    enemy_life_gem[enemy_fail].PlayForward();
                    enemy_fail++;
                    gameBehavior = GameBehavior.win;
                    yield return(TweenMessage.GetInstance().Play("领导牌技能发动\r\n平手时获胜"));
                }
                else if (EnemyController.GetInstance().group == Global.Group.nilfgaardian)
                {
                    player_life_gem[player_fail].PlayForward();
                    player_fail++;
                    gameBehavior = GameBehavior.lose;
                }
                else
                {
                    player_life_gem[player_fail].PlayForward();
                    enemy_life_gem[enemy_fail].PlayForward();
                    player_fail++;
                    enemy_fail++;
                    gameBehavior = GameBehavior.dogfall;
                }
            }

            if (player_fail == 2)
            {
                yield return(GameOver.GetInstance().Show(false));

                CoroutineManager.GetInstance().Finish();
                yield break;
            }
            else if (enemy_fail == 2)
            {
                yield return(GameOver.GetInstance().Show(true));

                CoroutineManager.GetInstance().Finish();
                yield break;
            }

            WeatherController.GetInstance().ClearSky();

            Transform playerMonsterCard = null;

            if (PlayerController.GetInstance().group == Global.Group.monster)
            {
                ArrayList line = new ArrayList();
                for (int i = 0; i < 3; i++)
                {
                    if (PlayerController.GetInstance().grids[i + 2].childCount != 0)
                    {
                        line.Add(i);
                    }
                }
                if (line.Count != 0)
                {
                    int randomLine  = (int)line[Random.Range(0, line.Count)];
                    int randomIndex = Random.Range(0, PlayerController.GetInstance().grids[randomLine + 2].childCount);
                    playerMonsterCard = PlayerController.GetInstance().grids[randomLine + 2].GetChild(randomIndex);
                }
            }
            Transform enemyMonsterCard = null;

            if (EnemyController.GetInstance().group == Global.Group.monster)
            {
                ArrayList line = new ArrayList();
                for (int i = 0; i < 3; i++)
                {
                    if (EnemyController.GetInstance().grids[i + 2].childCount != 0)
                    {
                        line.Add(i);
                    }
                }
                if (line.Count != 0)
                {
                    int randomLine  = (int)line[Random.Range(0, line.Count)];
                    int randomIndex = Random.Range(0, EnemyController.GetInstance().grids[randomLine + 2].childCount);
                    enemyMonsterCard = EnemyController.GetInstance().grids[randomLine + 2].GetChild(randomIndex);
                }
            }

            for (int i = 2; i < 5; i++)
            {
                for (int ii = PlayerController.GetInstance().grids[i].childCount - 1; ii >= 0; ii--)
                {
                    PlayerController.GetInstance().grids[i].GetChild(ii).SetTarget(PlayerController.GetInstance().grids[5]);
                }
            }
            for (int i = 2; i < 5; i++)
            {
                for (int ii = EnemyController.GetInstance().grids[i].childCount - 1; ii >= 0; ii--)
                {
                    EnemyController.GetInstance().grids[i].GetChild(ii).SetTarget(EnemyController.GetInstance().grids[5]);
                }
            }
            for (int i = 0; i < 3; i++)
            {
                if (WarhornController.GetInstance().playerWarhorn[i])
                {
                    if (WarhornController.GetInstance().playerGrids[i].childCount == 1)
                    {
                        WarhornController.GetInstance().playerGrids[i].GetChild(0).SetTarget(PlayerController.GetInstance().grids[5]);
                    }
                    WarhornController.GetInstance().playerWarhorn[i] = false;
                }
                if (WarhornController.GetInstance().enemyWarhorn[i])
                {
                    if (WarhornController.GetInstance().enemyGrids[i].childCount == 1)
                    {
                        WarhornController.GetInstance().enemyGrids[i].GetChild(0).SetTarget(EnemyController.GetInstance().grids[5]);
                    }
                    WarhornController.GetInstance().enemyWarhorn[i] = false;
                }
            }

            switch (gameBehavior)
            {
            case GameBehavior.win:
                yield return(TweenMessage.GetInstance().Play("此局获胜"));

                break;

            case GameBehavior.lose:
                yield return(TweenMessage.GetInstance().Play("此局失败"));

                break;

            case GameBehavior.dogfall:
                yield return(TweenMessage.GetInstance().Play("此局平手"));

                break;
            }

            if (PlayerController.GetInstance().group == Global.Group.northern && gameBehavior == GameBehavior.win)
            {
                PlayerController.GetInstance().DrawCards(1);
                yield return(TweenMessage.GetInstance().Play("领导牌技能发动\r\n摸一张牌"));
            }
            if (EnemyController.GetInstance().group == Global.Group.northern && gameBehavior == GameBehavior.lose)
            {
                EnemyController.GetInstance().DrawCards(1);
            }
            if (PlayerController.GetInstance().group == Global.Group.monster && playerMonsterCard != null)
            {
                playerMonsterCard.SetTarget(PlayerController.GetInstance().grids[(int)playerMonsterCard.GetComponent <CardProperty>().line + 2]);
                if (playerMonsterCard.GetComponent <CardProperty>().effect == Global.Effect.warhorn)
                {
                    WarhornController.GetInstance().playerWarhorn[0] = true;
                }
                yield return(TweenMessage.GetInstance().Play("领导牌技能发动\r\n保留一张牌再战场上"));
            }
            if (EnemyController.GetInstance().group == Global.Group.monster && enemyMonsterCard != null)
            {
                enemyMonsterCard.SetTarget(EnemyController.GetInstance().grids[(int)enemyMonsterCard.GetComponent <CardProperty>().line + 2]);
                if (enemyMonsterCard.GetComponent <CardProperty>().effect == Global.Effect.warhorn)
                {
                    WarhornController.GetInstance().enemyWarhorn[0] = true;
                }
            }

            PlayerController.GetInstance().grids[5].gameObject.SetActive(false);
            PlayerController.GetInstance().grids[5].gameObject.SetActive(true);
            EnemyController.GetInstance().grids[5].gameObject.SetActive(false);
            EnemyController.GetInstance().grids[5].gameObject.SetActive(true);

            PowerController.GetInstance().Number();

            offensive = !offensive;
            if (offensive)
            {
                yield return(TweenMessage.GetInstance().Play("你先手"));

                LeaderController.GetInstance().PlayerTurnIndicator();
            }
            else
            {
                yield return(TweenMessage.GetInstance().Play("对方先手"));

                yield return(EnemyController.GetInstance().Play(EnemyController.GetInstance().grids[1]));
            }

            CoroutineManager.GetInstance().Finish();
        }