Exemple #1
0
    /// <summary>
    /// 开始发空牌
    /// </summary>
    /// <param name="proto"></param>
    internal void BeginProxy(GP_ROOM_BEGIN proto)
    {
        CurrentRoom.roomStatus = ROOM_STATUS.DEAL;
        CurrentRoom.dealSecond++;
        CurrentRoom.FirstGivePos = proto.room.firstGivePos; //首发牌座位号
        CurrentRoom.FirstDice    = proto.room.firstDice;    //第一个筛子
        CurrentRoom.SecondDice   = proto.room.secondDice;   //第二个筛子
        for (int i = 0; i < proto.room.seatListCount(); i++)
        {
            SeatEntity seat = GetSeatBySeatId(proto.room.getSeatList(i).pos);
            seat.seatStatus = SEAT_STATUS.EMPTYPOKER;
            if (seat.pokerList.Count != 0)
            {
                seat.pokerList.Clear();
            }
            GP_SEAT op_seat = proto.room.getSeatList(i);
            for (int j = 0; j < op_seat.pokerListCount(); ++j)
            {
                GP_POKER protoPoker = op_seat.getPokerList(j);
                seat.pokerList.Add(new Poker()
                {
                    Index = protoPoker.index, //索引
                    Type  = protoPoker.type,  //花色
                    Size  = protoPoker.size,  //大小
                });
            }
        }
        TransferData data = new TransferData();

        data.SetValue("Room", CurrentRoom);
        SendNotification("DealRollDice", data);//播放发牌摇筛子,发牌
    }
    /// <summary>
    /// 服务器广播开始发牌的消息
    /// </summary>
    /// <param name="obj"></param>
    private void OnServerBroadcastBegin(byte[] obj)
    {
        GP_ROOM_BEGIN proto = GP_ROOM_BEGIN.decode(obj);

        RoomGuPaiJiuProxy.Instance.BeginProxy(proto);
    }