Ejemplo n.º 1
0
        /// <summary>
        /// 开始战斗
        /// </summary>
        /// <param name="uidList"></param>
        public void StartFight(List <int> uidList)
        {
            //创建战斗房间
            FightRoomModel fightRoom = fightRoomCache.Create(uidList);

            //发牌
            fightRoom.Licensing();
            //排序
            fightRoom.Sort();
            //给每个客户端发送牌的数据
            foreach (var player in fightRoom.PlayerDtos)
            {
                UserModel    userModel    = userModelCache.GetModelByUid(player.Uid);
                AccountModel accountModel = accountCache.GetModel(userModel.Aid);
                ClientPeer   clientPeer   = accountCache.GetClientPeerByAcc(accountModel.acc);
                clientPeer.Send(OpCode.FIGHT, FightCode.GET_CARD_SRES, player.CardDtos);
            }
            //发送抢地主消息
            int first = fightRoom.GetFirstUid();

            Brocast(fightRoom, OpCode.FIGHT, FightCode.TURN_GRAB_BRO, first, null);
        }