Ejemplo n.º 1
0
        /// <summary>
        /// 处理单轮
        /// </summary>
        private void DoSingle(List <EmbattleQueue> queueList)
        {
            int index = 0;

            while (true)
            {
                if (index >= queueList.Count)
                {
                    index = 0;
                }
                EmbattleQueue item          = queueList[index];
                EmbattleQueue tagetEmbattle = queueList[(index == 0 ? 1 : 0)];

                if (!item.HasGeneral && !tagetEmbattle.HasGeneral)
                {
                    //当前轮双方阵列都打完才结束
                    break;
                }
                if (!tagetEmbattle.HasCombat())
                {
                    //对方阵列是否可战斗,原因:目标为空时,佣兵被跳过
                    break;
                }
                var general = (CombatGeneral)item.NextGeneral();

                if (general != null)
                {
                    CombatCenter combatCenter = new CombatCenter(item.Role, general, tagetEmbattle.Role, targerHandle);
                    if (combatCenter.HasDoing())
                    {
                        var combatLog = combatCenter.GetProcess();
                        if (combatLog != null)
                        {
                            processContainer.ProcessList.Add(combatLog);
                        }
                    }
                    else
                    {
                        TraceLog.ReleaseWriteFatal("General:{0}-{1}佣兵被跳过", general.GeneralName, general.GeneralID);
                        //是否结束
                        break;
                    }
                }
                index++;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 处理单轮
        /// </summary>
        private void DoSingle(TList<EmbattleQueue> queueList)
        {
            int index = 0;
            while (true)
            {
                if (index >= queueList.Count) index = 0;
                EmbattleQueue item = queueList[index];
                EmbattleQueue tagetEmbattle = queueList[(index == 0 ? 1 : 0)];

                if (!item.HasGeneral && !tagetEmbattle.HasGeneral)
                {
                    //当前轮双方阵列都打完才结束
                    break;
                }
                if (!tagetEmbattle.HasCombat())
                {
                    //对方阵列是否可战斗,原因:目标为空时,佣兵被跳过
                    break;
                }
                var general = (CombatGeneral)item.NextGeneral();

                if (general != null)
                {
                    CombatCenter combatCenter = new CombatCenter(item.Role, general, tagetEmbattle.Role, targerHandle);
                    if (combatCenter.HasDoing())
                    {
                        var combatLog = combatCenter.GetProcess();
                        if (combatLog != null)
                        {
                            processContainer.ProcessList.Add(combatLog);
                        }
                    }
                    else
                    {
                        TraceLog.ReleaseWriteFatal("General:{0}-{1}佣兵被跳过", general.GeneralName, general.GeneralID);
                        //是否结束
                        break;
                    }

                }
                index++;
            }
        }