Пример #1
0
        private void grabLandlord(ClientPeer client, bool result)
        {
            SingleExecute.Instance.Execute(() =>
            {
                if (!userCache.IsOnline(client))
                {
                    return;
                }
                int userId          = userCache.GetId(client);
                FightRoom fightRoom = fightCache.GetRoomByUId(userId);

                if (result == true)
                {
                    fightRoom.SetLandlord(userId);
                    //send message to all client who was landlord
                    GrabDto dto = new GrabDto(userId, fightRoom.TableCardList, fightRoom.getUserCards(userId));
                    Broadcast(fightRoom, OpCode.FIGHT, FightCode.GRAB_LANDLORD_BROADCAST, dto);

                    //enter deal phase
                    Broadcast(fightRoom, OpCode.FIGHT, FightCode.TURN_DEAL_BROADCAST, userId);
                }
                else
                {
                    //don't grab
                    int nextUserId = fightRoom.GetNextUserId(userId);
                    Broadcast(fightRoom, OpCode.FIGHT, FightCode.TURN_GRAB_BROADCAST, nextUserId);
                }
            });
        }