Example #1
0
        /// <summary>
        /// 外部设置延迟多少秒时间的任务 方法由外部指定
        /// </summary>
        /// <param name="id"></param>
        /// <param name="delaytime"></param>
        public void AddTimerEvent(long delaytime, TimerDG td)
        {
            long       time       = DateTime.Now.Ticks + delaytime;
            TimerModle timerModle = new TimerModle(concurrentID.Add_Get(), time, td);

            idTimerDic.TryAdd(timerModle.ID, timerModle);
        }
Example #2
0
    }//CheckFrameTask_End

    #region FrameTask

    /// <summary>
    /// 添加帧定时任务
    /// </summary>
    /// <param name="taskCall"></param>
    /// <param name="delay"></param>
    /// <param name="executeCount"></param>
    /// <param name="timerUnit"></param>
    /// <returns></returns>
    public int AddFrameTask(Action <int> taskCall, int delay, int executeCount = 1, bool isExeInMain = false)
    {
        //生成taskModel
        int taskId;

        //防止id重复
        while (true)
        {
            taskId = id.Add_Get();
            if (!taskIdList.Contains(taskId))
            {
                break;
            }
        }
        lock (lockFrame)
        {
            tempFrameTaskList.Add(new TaskFrameModel(taskId, delay + frameCounter, delay, executeCount, taskCall, isExeInMain));
        }

        lock (lockId)
        {
            taskIdList.Add(taskId);
        }
        return(taskId);
    }
Example #3
0
        public FightRoom Create(List <int> uidList)
        {
            FightRoom room = null;

            //先检测有没有可重用的房间
            if (roomQueue.Count > 0)
            {
                room = roomQueue.Dequeue();
                room.Init(uidList);
            }

            else //没有就直接创建
            {
                room = new FightRoom(id.Add_Get(), uidList);
            }


            //绑定映射关系
            foreach (int uid in uidList)
            {
                uidRoomIDict.Add(uid, room.Id);
                uidFightingList.Add(uid);
            }

            idRoomDict.Add(room.Id, room);
            return(room);
        }
Example #4
0
        /// <summary>
        /// 创建战斗房间
        /// </summary>
        /// <param name="uidList"></param>
        /// <returns></returns>
        public FightRoom Create(List <int> uidList)
        {
            FightRoom room = null;

            //先检测是否有可以重用的房间
            if (roomQueue.Count > 0)
            {
                room = roomQueue.Dequeue();
                room.Init(uidList);
            }

            else
            {
                room = new FightRoom(id.Add_Get(), uidList);
            }

            //绑定映射关系
            foreach (int uid in uidList)
            {
                uidRoomIDict.Add(uid, room.Id);
                ClientPeer client = userCache.GetClientPeer(uid);
                room.StartFight(uid, client);
            }
            idRoomDict.Add(room.Id, room);
            return(room);
        }
Example #5
0
        public FightRoom Create(List <int> uidList)
        {
            if (fightRoomQueue.Count > 0)
            {
                //如果重用队列中有可用房间
                FightRoom fightRoom = fightRoomQueue.Dequeue();
                foreach (var item in uidList)
                {
                    uidRoomidDic.Add(item, fightRoom.ID);

                    PlayerDto playerDto = new PlayerDto(item);
                    fightRoom.playerDtos.Add(playerDto);
                }

                return(fightRoom);
            }
            else
            {
                //如果重用队列没有可用房间,则创建战斗房间
                FightRoom fightRoom = new FightRoom(roomID.Add_Get(), uidList);


                foreach (var item in uidList)
                {
                    if (!uidRoomidDic.ContainsKey(item))
                    {
                        uidRoomidDic.Add(item, roomID.Get());
                    }
                }
                roomidModleDic.Add(roomID.Get(), fightRoom);


                return(fightRoom);
            }
        }
Example #6
0
        public void Create(string name, int accountId)
        {
            UserModel model = new UserModel(id.Add_Get(), name, accountId);

            idModelDict.Add(model.ID, model);
            accIdUserIdDict.Add(model.AccountModel, model.ID);
        }
        /// <summary>
        /// 添加定时任务 (指定延时的时间)
        /// </summary>
        /// <param name="delayTime">延时时间(ms)</param>
        /// <param name="timeDele"></param>
        public void AddTimeEvent(long delayTime, TimeDelegate timeDele)
        {
            //                             先赋值,再++ ,  当前时间     +   延时时间
            TimerModel model = new TimerModel(Id.Add_Get(), DateTime.Now.Ticks + delayTime, timeDele); //

            idDic.TryAdd(model.Id, model);
        }
Example #8
0
        /// <summary>
        /// 创建房间
        /// </summary>
        /// <param name="uidList"></param>
        /// <returns></returns>
        public FightRoom Create(List <int> uidList)
        {
            FightRoom room = null;

            if (roomQueue.Count > 0)
            {
                room = roomQueue.Dequeue();
            }
            else
            {
                room = new FightRoom(id.Add_Get(), uidList);
            }
            foreach (var item in uidList)
            {
                uidRoomDict.Add(item, room.Id);
                //上一次销毁后的房间数据信息不完整这里补充完整重用销毁的房间
                if (room.playerList.Count < 3)
                {
                    PlayerDto player = new PlayerDto(item);
                    room.playerList.Add(player);
                }
            }
            idRomDict.Add(room.Id, room);
            return(room);
        }
Example #9
0
        /// <summary>
        /// 进入匹配队列
        /// </summary>
        /// <returns></returns>
        public MatchRoom Enter(int userId, ClientPeer client)
        {
            foreach (MatchRoom mr in idModelDict.Values)
            {
                if (mr.IsFull())
                {
                    continue;
                }
                mr.Enter(userId, client);
                uidRoomIdDict.Add(userId, mr.Id);
                return(mr);
            }
            //自己开房间
            MatchRoom room = null;

            if (roomQueue.Count > 0)
            {
                room = roomQueue.Dequeue();
            }
            else
            {
                room = new MatchRoom(id.Add_Get());
            }

            room.Enter(userId, client);
            idModelDict.Add(room.Id, room);
            uidRoomIdDict.Add(userId, room.Id);
            return(room);
        }
Example #10
0
        /// <summary>
        /// 进入匹配队列 进入匹配房间
        /// </summary>
        /// <returns></returns>
        public MatchRoom Enter(int userId, ClientPeer client)
        {
            //遍历一下等待的房间 看一下 有没有正在等待的 如果有 我们就把这个玩家加进去
            foreach (MatchRoom mr in idModelDict.Values)
            {
                //房间满了 继续
                if (mr.IsFull())
                {
                    continue;
                }
                //没满的话
                mr.Enter(userId, client);

                uidRoomIdDict.Add(userId, mr.Id);
                return(mr);
            }

            //如果调用到这里代表没进去 为什么?因为没有等待的房间了
            //自己开个房
            MatchRoom room = null;

            if (roomQueue.Count > 0)
            {
                room = roomQueue.Dequeue();
            }
            else
            {
                room = new MatchRoom(id.Add_Get());
            }

            room.Enter(userId, client);
            idModelDict.Add(room.Id, room);
            uidRoomIdDict.Add(userId, room.Id);
            return(room);
        }
Example #11
0
        //添加定时任务 XX时间后执行
        public void AddTimeEvent(long delayTime, int userId, TimeOutDelegate timeOutDelegate)
        {
            Console.WriteLine("add timeout event   " + userId);
            TimeOutModel model = new TimeOutModel(id.Add_Get(), userId, DateTime.Now.Ticks + delayTime, timeOutDelegate);

            idModelDict.TryAdd(model.Id, model);
        }
        /// <summary>
        /// 进入房间
        /// </summary>
        /// <param name="uid"></param>
        public RoomModel EnterRoom(int uid, ClientPeer clientPeer)
        {
            foreach (var room in ridRoomModelDict.Values)
            {
                if (!room.IsFull())
                {
                    room.Enter(uid, clientPeer);
                    uidRidDict.Add(uid, room.Id);
                    return(room);
                }
            }
            RoomModel newRoom = null;

            if (roomQueue.Count > 0)
            {
                newRoom = roomQueue.Dequeue();
            }
            else
            {
                newRoom = new RoomModel(concurrentInt.Add_Get());
            }
            ridRoomModelDict.Add(newRoom.Id, newRoom);
            uidRidDict.Add(uid, newRoom.Id);
            newRoom.Enter(uid, clientPeer);
            return(newRoom);
        }
Example #13
0
        /// <summary>
        /// 进入匹配房间
        /// </summary>
        /// <returns></returns>
        public MatchRoom Enter(int userId, ClientPeer client)
        {
            foreach (var mr in matchRoom.Values)
            {
                if (mr.IsFull())
                {
                    continue;
                }
                mr.Enter(userId, client);
                uIdRoomIdDict.Add(userId, mr.Id);
                return(mr);
            }
            //没有等待中的房间 开启新的房间
            MatchRoom room = null;

            if (roomQueue.Count > 0)
            {
                room = roomQueue.Dequeue();
            }
            else
            {
                room = new MatchRoom(id.Add_Get());
            }
            room.Enter(userId, client);
            //正在匹配的用户
            uIdRoomIdDict.Add(userId, room.Id);
            //房间信息
            matchRoom.Add(room.Id, room);
            return(room);
        }
Example #14
0
        /// <summary>
        /// 创建角色
        /// </summary>
        /// <param name="name"></param>
        /// <param name="accountId"></param>
        public void Creat(string name, int accountId)
        {
            UserModel model = new UserModel(id.Add_Get(), name, accountId);

            //保存到字典里
            idModelDic.Add(model.id, model);
            accountIdUidDic.Add(model.id, model.id);
        }
Example #15
0
        /// <summary>
        /// 创建角色
        /// </summary>
        /// <param name="name">角色名</param>
        /// <param name="accountID">账号id</param>
        public void Create(string name, int accountID)
        {
            UserModel model = new UserModel(id.Add_Get(), name, accountID);

            //保存到字典里
            idModelDict.Add(model.Id, model);
            accIdUIdDic.Add(model.AccountId, model.Id);
        }
Example #16
0
        /// <summary>
        /// 创建角色
        /// </summary>
        /// <param name="name">角色名</param>
        /// <param name="accountId">账号id</param>

        /*public void Create(string name, int accountId)
         * {
         *  UserModel model = new UserModel(id.Add_Get(), name, accountId);
         *  //保存到字典里
         *  idModelDict.Add(model.Id, model);
         *  accIdUIdDict.Add(model.AccountId, model.Id);
         * }*/

        public void Create(string name, int accountId, string account)
        {
            if (!MysqlPeer.Instance.IsUserExist(account))
            {
                UserModel model = new UserModel(ID.Add_Get(), name, accountId, account);
                //保存到字典里
                idModelDict.Add(model.Id, model);
                accIdUIdDict.Add(model.AccountId, model.Id);

                MysqlPeer.Instance.AddUser(model);
            }
        }
Example #17
0
 public MatchCache()
 {
     id         = new ConcurrentInt(-1);
     uIdRidDic  = new Dictionary <int, int>();
     rIdRoomDic = new Dictionary <int, MatchRoom>();
     //默认保存10个房间
     roomPool = new Queue <MatchRoom>(roomCapacity);
     for (int i = 0; i < roomCapacity; i++)
     {
         roomPool.Enqueue(new MatchRoom(id.Add_Get()));
     }
 }
Example #18
0
        private void createRoom(out MatchRoom room)
        {
            //如果有可复用的房间
            if(matchRooms.Count > 0)
            {
                room = matchRooms.Dequeue();
                ridModleDic.Add(room.ID, room);
                return;
            }
            int rid = roomid.Add_Get();

            room = new MatchRoom(rid, 2);//两人房间
            //matchRooms.Enqueue(room);
            ridModleDic.Add(rid, room);
        }
Example #19
0
        /// <summary>
        /// 创建战斗房间
        /// </summary>
        /// <returns></returns>
        public SingleRoom Create(int uid)
        {
            SingleRoom room = null;

            //先检测有没有可重用的房间
            if (roomQueue.Count > 0)
            {
                room = roomQueue.Dequeue();
                //fixbug923
                room.Init(uid);
            }
            else//没有就直接创建
            {
                room = new SingleRoom(id.Add_Get(), uid);
            }

            //绑定映射关系
            uidRoomIDict.Add(uid, room.Id);
            idRoomDict.Add(room.Id, room);
            return(room);
        }
Example #20
0
        /// <summary>
        /// 创建房间
        /// </summary>
        /// <param name="userIds"></param>
        /// <returns></returns>
        public FightRoom Creat(List <int> userIds)
        {
            FightRoom room = null;

            //if (roomQueue.Count > 0)
            //{
            //    room = roomQueue.Dequeue();
            //}
            //else
            //{
            //    room = new FightRoom(id.Add_Get(),userIds);
            //}
            room = new FightRoom(id.Add_Get(), userIds);
            room.Init(userIds);
            //存储
            foreach (var id in userIds)
            {
                uIdRidDic.Add(id, room.id);
            }

            rIdRoomDic.Add(room.id, room);
            return(room);
        }
Example #21
0
        /// <summary>
        /// 创建账号数据模型信息
        /// </summary>
        /// <param name="accout">账号</param>
        /// <param name="password">密码</param>
        public void Create(string account, string password)
        {
            AccountModel model = new AccountModel(id.Add_Get(), account, password);

            accModelDict.Add(model.Account, model);
        }
Example #22
0
        /// <summary>
        /// 进入匹配队列 进入匹配房间
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public MatchRoom Enter(int userId, ClientPeer client)
        {
            int roomId;

            //遍历一下等待的房间 看一下有没有正在等待的 如果有 我们就把这玩家加进去
            foreach (MatchRoom mr in idModelDict.Values)
            {
                //房间满了 继续
                if (mr.IsFull())
                {
                    continue;
                }
                //没满的话
                mr.Enter(userId, client);
                uidRoomIdDict.Add(userId, mr.Id);
                return(mr);
            }
            //如果调用到这里 代表没进去 ,因为没有等待的房间了
            //自己开个房
            MatchRoom room = null;

            //判断一下是否有重用的房间
            if (roomQueue.Count > 0)
            {
                room = roomQueue.Dequeue();
                room.Enter(userId, client);
                idModelDict.Add(room.Id, room);
                uidRoomIdDict.Add(userId, room.Id);
                //1.给房间添加计时    2.计时到时前10秒的警告
                timer.AddTimeEvent(500000000,
                                   delegate
                {
                    room.Brocast(OpCode.MATCH, MatchCode.MESSAGE_BRO, null);
                });
                timer.AddTimeEvent(600000000,
                                   delegate
                {
                    if (room == null)
                    {
                        return;
                    }
                    room.Brocast(OpCode.MATCH, MatchCode.BACK_BRO, null);
                    Destroy(room);
                }
                                   );
            }
            else
            {
                room   = new MatchRoom(id.Add_Get());
                roomId = room.Id;
                room.Enter(userId, client);
                idModelDict.Add(room.Id, room);
                uidRoomIdDict.Add(userId, room.Id);
                //1.给房间添加计时    2.计时到时前10秒的警告
                timer.AddTimeEvent(500000000,
                                   delegate
                {
                    room.Brocast(OpCode.MATCH, MatchCode.MESSAGE_BRO, null);
                });
                timer.AddTimeEvent(600000000,
                                   delegate
                {
                    if (room == null)
                    {
                        return;
                    }
                    room.Brocast(OpCode.MATCH, MatchCode.BACK_BRO, null);
                    Destroy(room);
                }
                                   );
            }

            return(room);
        }
        public void Creat(string acc, string pwd)
        {
            AccountModel model = new AccountModel(id.Add_Get(), acc, pwd);

            accModelDic.Add(model.account, model);
        }
Example #24
0
        /// <summary>
        /// 创建兽族牌库
        /// </summary>
        /// <param name="playerIndex">玩家索引</param>
        private void CreateOrc(int playerIndex)
        {
            //List<IArmyCardBase> armycardList = ArmyCards[playerIndex];
            //List<IOrderCardBase> orderCardList = OrderCards[playerIndex];
            //List<IOtherCardBase> otherCardList = OtherCards[playerIndex];

            //List<ICardBase> Cards = playerCards[playerIndex];
            playercardDtos[playerIndex] = new List <CardDto>();
            List <CardDto> cardDtos = playercardDtos[playerIndex];

            Random random = new Random();
            //17张兵种牌

            /*int ordinaryCount = random.Next(7, 12);//普通兵种7-11张
             * int middleCount = random.Next(0, 6);//中级0-5
             * int HeroCount = 1;//英雄一张*/
            int ordinaryCount = 7;
            int middleCount   = 5;
            int HeroCount     = 1;//英雄一张
            //剩余为髙阶
            int highCount = 4;

            int infantryCount    = 4; //兽族步兵
            int eagleCount       = 3; //鹰骑士
            int blackRatsCount   = 0; //黑鼠爆破手
            int FrogCount        = 3; //巨口蛙
            int ForestCount      = 2; //射手
            int PangolinCount    = 2; //穿山甲
            int RavenShamanCount = 2; //乌鸦萨满

            for (int i = 0; i < HeroCount; i++)
            {
                //OrcHero orcHero = new OrcHero();
                //armycardList.Add(orcHero);
                //cardDtos.Add(new CardDto(CardId.Add_Get(), RaceType.ORC, OrcArmyCardType.Hero,false,ArmyClassType.Hero));
                cardDtos.Add(new CardDto(CardId.Add_Get(), RaceType.ORC, OrcArmyCardType.Hero, ArmyMoveType.LAND, ArmyClassType.Hero));
            }

            for (int i = 0; i < infantryCount; i++)
            {
                //OrcInfantry orcInfantry = new OrcInfantry();
                //armycardList.Add(orcInfantry);
                cardDtos.Add(new CardDto(CardId.Add_Get(), RaceType.ORC, OrcArmyCardType.Infantry, ArmyMoveType.LAND, ArmyClassType.Ordinary));
            }

            for (int i = 0; i < eagleCount; i++)
            {
                //OrcEagleRiders orcEagleRiders = new OrcEagleRiders();
                //armycardList.Add(orcEagleRiders);
                cardDtos.Add(new CardDto(CardId.Add_Get(), RaceType.ORC, OrcArmyCardType.Eagle_Riders, ArmyMoveType.SKY, ArmyClassType.Ordinary));
            }

            for (int i = 0; i < blackRatsCount; i++)
            {
                //OrcBlackRatsBoomer orcBlackRatsBoomer = new OrcBlackRatsBoomer();
                //armycardList.Add(orcBlackRatsBoomer);
                cardDtos.Add(new CardDto(CardId.Add_Get(), RaceType.ORC, OrcArmyCardType.Black_Rats_Boomer, ArmyMoveType.UNDERGROUND, ArmyClassType.MiddleClass));
            }

            for (int i = 0; i < FrogCount; i++)
            {
                //OrcGiantmouthedFrog orcGiantmouthedFrog = new OrcGiantmouthedFrog();
                //armycardList.Add(orcGiantmouthedFrog);
                cardDtos.Add(new CardDto(CardId.Add_Get(), RaceType.ORC, OrcArmyCardType.Giant_mouthed_Frog, ArmyMoveType.LAND, ArmyClassType.MiddleClass));
            }

            for (int i = 0; i < ForestCount; i++)
            {
                //OrcForestShooter orcForestShooter = new OrcForestShooter();
                //armycardList.Add(orcForestShooter);
                cardDtos.Add(new CardDto(CardId.Add_Get(), RaceType.ORC, OrcArmyCardType.Forest_Shooter, ArmyMoveType.LAND, ArmyClassType.MiddleClass));
            }

            for (int i = 0; i < PangolinCount; i++)
            {
                //OrcPangolin orcPangolin = new OrcPangolin();
                //armycardList.Add(orcPangolin);
                cardDtos.Add(new CardDto(CardId.Add_Get(), RaceType.ORC, OrcArmyCardType.Pangolin, ArmyMoveType.LAND, ArmyClassType.HighClass));
            }

            for (int i = 0; i < RavenShamanCount; i++)
            {
                //OrcRavenShaman orcRavenShaman = new OrcRavenShaman();
                //armycardList.Add(orcRavenShaman);
                cardDtos.Add(new CardDto(CardId.Add_Get(), RaceType.ORC, OrcArmyCardType.Raven_Shaman, ArmyMoveType.LAND, ArmyClassType.HighClass));
            }


            //指令卡24-28张
            int OrderCount      = 26;
            int AttackCount     = 12;
            int DodgeCount      = 6; //闪避卡6张
            int BackAttackCount = 4; //反击卡4张
            int RestCount       = 4; //修养卡
            int ShuffleCount    = 0; //洗牌0张张
            //int TakeCount = OrderCount - AttackCount - DodgeCount - BackAttackCount - RestCount - ShuffleCount;
            int TakeCount = 0;       //抽卡0张

            //指令卡24-28张

            /*int OrderCount = 0;
             * int AttackCount = 0;//攻击卡10
             * int DodgeCount = 0;//闪避卡5张
             * int BackAttackCount = 0;//反击卡3张
             * int RestCount = OrderCount;//修养卡2张
             * int ShuffleCount = 0;//洗牌2张
             * int TakeCount = 0;//抽卡*/

            for (int i = 0; i < AttackCount; i++)
            {
                //Order_Attack order_Attack = new Order_Attack();
                //orderCardList.Add(order_Attack);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OrderCardType.ATTACK));
            }

            for (int i = 0; i < DodgeCount; i++)
            {
                //Order_Dodge order_Dodge = new Order_Dodge();
                //orderCardList.Add(order_Dodge);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OrderCardType.DODGE));
            }

            for (int i = 0; i < BackAttackCount; i++)
            {
                //Order_BackAttack order_BackAttack = new Order_BackAttack();
                //orderCardList.Add(order_BackAttack);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OrderCardType.BACKATTACK));
            }

            for (int i = 0; i < RestCount; i++)
            {
                //Order_Rest order_Rest = new Order_Rest();
                //orderCardList.Add(order_Rest);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OrderCardType.REST));
            }

            for (int i = 0; i < ShuffleCount; i++)
            {
                // Order_Shuffle order_Shuffle = new Order_Shuffle();
                //orderCardList.Add(order_Shuffle);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OrderCardType.SHUFFLE));
            }

            for (int i = 0; i < TakeCount; i++)
            {
                //Order_Take order_Take = new Order_Take();
                //orderCardList.Add(order_Take);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OrderCardType.TAKE));
            }


            //非指令卡10-15张
            int OtherCount               = 13;
            int LandLifeCount            = 1;                                                                                                               //生息之地1张
            int Recovery_siphonCount     = 1;                                                                                                               //复原虹吸1张
            int Sky_fireCount            = 1;                                                                                                               //天火一张
            int Ancestor_HelmetsCount    = 1;                                                                                                               //先祖头盔1
            int Enhanced_ExplosivesCount = 1;                                                                                                               //强化炸药1

            int restOther         = (OtherCount - LandLifeCount - Recovery_siphonCount - Sky_fireCount - Ancestor_HelmetsCount - Enhanced_ExplosivesCount); //剩余非指令卡
            int Totem_summonCount = restOther / 2;                                                                                                          //召唤图腾1张

            restOther -= Totem_summonCount;
            int Ground_fetter_netCount = Totem_summonCount / 2;//地缚网2

            restOther -= Ground_fetter_netCount;
            int Lightning_ChainCount = Ground_fetter_netCount / 2;//闪电链1

            restOther -= Lightning_ChainCount;
            int Toad_bombCount = restOther;//蟾蜍炸弹

            /*int OtherCount = 56 - 17 - OrderCount;
             * int LandLifeCount = 0;//生息之地1张
             * int Recovery_siphonCount = 0;//复原虹吸1张
             * int Lightning_ChainCount = 0;//闪电链1
             * int Sky_fireCount = 0;//天火一张
             * int Totem_summonCount = 0;//召唤图腾1张
             * int Ground_fetter_netCount = 0;//地缚网2
             * int Ancestor_HelmetsCount = OtherCount;//先祖头盔1
             * int Enhanced_ExplosivesCount = 0;//强化炸药1
             * int Toad_bombCount = 0;*/

            for (int i = 0; i < LandLifeCount; i++)
            {
                //Orc_Other_LandLife orc_Other_LandLife = new Orc_Other_LandLife();
                //otherCardList.Add(orc_Other_LandLife);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OtherCardType.ManorCard, RaceType.ORC, OrcOtherCardType.LandLife));
            }

            for (int i = 0; i < Recovery_siphonCount; i++)
            {
                //Orc_Other_Recoverysiphon orc_Other_Recoverysiphon = new Orc_Other_Recoverysiphon();
                //otherCardList.Add(orc_Other_Recoverysiphon);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OtherCardType.MagicCard, RaceType.ORC, OrcOtherCardType.Recovery_siphon));
            }

            for (int i = 0; i < Lightning_ChainCount; i++)
            {
                //Orc_Other_LightningChain orc_Other_LightningChain = new Orc_Other_LightningChain();
                //otherCardList.Add(orc_Other_LightningChain);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OtherCardType.MagicCard, RaceType.ORC, OrcOtherCardType.Lightning_Chain));
            }

            for (int i = 0; i < Sky_fireCount; i++)
            {
                //Orc_Other_Skyfire orc_Other_Skyfire = new Orc_Other_Skyfire();
                //otherCardList.Add(orc_Other_Skyfire);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OtherCardType.MagicCard, RaceType.ORC, OrcOtherCardType.Sky_fire));
            }

            for (int i = 0; i < Totem_summonCount; i++)
            {
                //Orc_Other_Totemsummon orc_Other_Totemsummon = new Orc_Other_Totemsummon();
                //otherCardList.Add(orc_Other_Totemsummon);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OtherCardType.MagicCard, RaceType.ORC, OrcOtherCardType.Totem_summon));
            }

            for (int i = 0; i < Ground_fetter_netCount; i++)
            {
                //Orc_Other_Groundfetternet orc_Other_Groundfetternet = new Orc_Other_Groundfetternet();
                //otherCardList.Add(orc_Other_Groundfetternet);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OtherCardType.TrapCard, RaceType.ORC, OrcOtherCardType.Ground_fetter_net));
            }

            for (int i = 0; i < Ancestor_HelmetsCount; i++)
            {
                //Orc_Other_AncestorHelmets orc_Other_AncestorHelmets = new Orc_Other_AncestorHelmets();
                //otherCardList.Add(orc_Other_AncestorHelmets);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OtherCardType.EquipCard, RaceType.ORC, OrcOtherCardType.Ancestor_Helmets));
            }

            for (int i = 0; i < Enhanced_ExplosivesCount; i++)
            {
                //Orc_Other_EnhancedExplosives orc_Other_EnhancedExplosives = new Orc_Other_EnhancedExplosives();
                //otherCardList.Add(orc_Other_EnhancedExplosives);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OtherCardType.EquipCard, RaceType.ORC, OrcOtherCardType.Enhanced_Explosives));
            }

            for (int i = 0; i < Toad_bombCount; i++)
            {
                //Orc_Other_Toadbomb orc_Other_Toadbomb = new Orc_Other_Toadbomb();
                //otherCardList.Add(orc_Other_Toadbomb);
                cardDtos.Add(new CardDto(CardId.Add_Get(), OtherCardType.EquipCard, RaceType.ORC, OrcOtherCardType.Toad_bomb));
            }


            /*//把所有类型的牌装入牌库
             * foreach (var item in armycardList)
             * {
             *  Cards.Add(item);
             * }
             *
             * foreach (var item in orderCardList)
             * {
             *  Cards.Add(item);
             * }
             *
             * foreach (var item in otherCardList)
             * {
             *  Cards.Add(item);
             * }*/
        }
Example #25
0
        //添加定时任务 XX时间后执行
        public void AddTimeEvent(long delayTime, TimeDelegate timeDelegate)
        {
            TimeModel model = new TimeModel(id.Add_Get(), DateTime.Now.Ticks + delayTime, timeDelegate);

            idModelDict.TryAdd(model.Id, model);
        }