Beispiel #1
0
        private void StartFight(int roomId)
        {
            //房间设置为开始
            fightCache.SetRoomPlayByRoomId(roomId);
            _21MutiFightRoom room = fightCache.GetRoomByRoomId(roomId);
            //初始发牌
            InitCardDto initCardDto = room.InitPlayerCards();

            brocast(room, OpCode._21Multi, _21MultiCode.INIT_CARD_BRO, initCardDto, null);

            //发送开始HIT或STAND的响应
            int firstUserId = room.GetFirstUId();

            room.SetPlayingUId(firstUserId);
            if (room.is21ByUserId(firstUserId))//21点 直接赢了
            {
                //记录一下这组牌
                room.SaveListByUserId(firstUserId, 1, false);
                int         position = room.getPosition(firstUserId);
                OverHandDto ohdto    = new OverHandDto(firstUserId, position, 1);
                brocast(room, OpCode._21Multi, _21MultiCode.OVER_HAND_BRO, ohdto, null);
                //该下一个玩家了
                turnPlayer(firstUserId, position, room);
            }
            else
            {
                if (room.isCanSplitByUserId(firstUserId))//能够分牌
                {
                    TurnHandDto thdto = new TurnHandDto(true, firstUserId);
                    //client.Send(OpCode._21Multi, _21MultiCode.TURN_HS_BRO, thdto);
                    brocast(room, OpCode._21Multi, _21MultiCode.TURN_HS_BRO, thdto, null);
                }
                else
                {
                    TurnHandDto thdto = new TurnHandDto(false, firstUserId);
                    //client.Send(OpCode._21Multi, _21MultiCode.TURN_HS_BRO, thdto);
                    brocast(room, OpCode._21Multi, _21MultiCode.TURN_HS_BRO, thdto, null);
                }
            }
        }