Beispiel #1
0
    /// <summary>
    /// 战斗失败
    /// </summary>
    private void battlestateFailed()
    {
        //敌方全员播放胜利动作
        for (int i = 0; i < SpriteMgr.getInstance().EnemySoldiers.Count; i++)
        {
            GeneralSoldier soldier = SpriteMgr.getInstance().EnemySoldiers[i] as GeneralSoldier;
            soldier.setState(soldier.WinState);
        }

        //弹失败窗口
        UIManager.getInstance().openPanel(PanelConfig.FAILEDPANEL);
        Debug.Log("弹失败窗口");
    }
Beispiel #2
0
    /// <summary>
    /// 生成下一个战场的显示内容
    /// </summary>
    private void creatNextBattle(BattleData data)
    {
        int  spriteCount = 0;
        bool isBreak     = false;

        if (num == 1)
        {
            //生成自己的部队
            for (int i = 0; i < MyFormationData.formationList.Count; i++)
            {
                for (int j = 0; j < MyFormationData.formationList[i].SoldiersDict.Count; j++)
                {
                    if (MyFormationData.formationList[i].SoldiersDict[j] != null)
                    {
                        MyFormationData.formationList[i].SoldiersDict[j].Country = Defaults.Country.Me;
                        if (i == 0)
                        {
                            SpriteMgr.getInstance().addSoldier(MyFormationData.formationList[i].SoldiersDict[j], Defaults.SoldierType.Cavalryman, new Vector3(j % 3 + _mySoldierPoints[i].x, 0 + _mySoldierPoints[i].y, (int)(j / 3) + _mySoldierPoints[i].z));
                        }
                        else
                        {
                            SpriteMgr.getInstance().addSoldier(MyFormationData.formationList[i].SoldiersDict[j], Defaults.SoldierType.Armorman, new Vector3(j % 3 + _mySoldierPoints[i].x, 0 + _mySoldierPoints[i].y, (int)(j / 3) + _mySoldierPoints[i].z));
                        }

                        if (++spriteCount >= SPRITE_COUNT)
                        {
                            isBreak = true;
                            break;
                        }
                    }
                }

                if (isBreak)
                {
                    break;
                }
            }
        }

        spriteCount = 0;
        if (num == 0)
        {
            //自己部队停止动作
            for (int i = 0; i < SpriteMgr.getInstance().SelfSoldiers.Count; i++)
            {
                GeneralSoldier soldier = SpriteMgr.getInstance().SelfSoldiers[i] as GeneralSoldier;
                soldier.setState(soldier.IdleState);
                soldier.IsDebug = true;

                if (++spriteCount >= SPRITE_COUNT)
                {
                    break;
                }
            }
        }

        //生成敌人的部队
        spriteCount = 0;
        isBreak     = false;
        for (int i = 0; i < campaignData.BattleList[campaignData.battleIndex].FormationList.Count; i++)
        {
            for (int j = 0; j < campaignData.BattleList[campaignData.battleIndex].FormationList[i].SoldiersDict.Count; j++)
            {
                //Debug.Log(i + " " + j + " " + campaignData.BattleList[campaignData.battleIndex].FormationList[i].soldiersDict[j]);
                if (campaignData.BattleList[campaignData.battleIndex].FormationList[i].SoldiersDict[j] != null)
                {
                    campaignData.BattleList[campaignData.battleIndex].FormationList[i].SoldiersDict[j].Country = Defaults.Country.Enemy;
                    if (j == 0)
                    {
                        SpriteMgr.getInstance().addSoldier(campaignData.BattleList[campaignData.battleIndex].FormationList[i].SoldiersDict[j], Defaults.SoldierType.Masterman, new Vector3(j % 3 + _enemySoldierPoints[i].x, 0 + _enemySoldierPoints[i].y, (int)(j / 3) + _enemySoldierPoints[i].z));
                    }
                    else
                    {
                        SpriteMgr.getInstance().addSoldier(campaignData.BattleList[campaignData.battleIndex].FormationList[i].SoldiersDict[j], Defaults.SoldierType.Axeman, new Vector3(j % 3 + _enemySoldierPoints[i].x, 0 + _enemySoldierPoints[i].y, (int)(j / 3) + _enemySoldierPoints[i].z));
                    }
                }

                if (++spriteCount >= SPRITE_COUNT)
                {
                    isBreak = true;
                    break;
                }
            }

            if (isBreak)
            {
                break;
            }
        }
    }