コード例 #1
0
    public void OnServerRobBanker(PAIGOW_ROOM_GRABBANKER proto)
    {
        if (proto.hasPos())
        {
            Seat seat = GetSeatBySeatId(proto.pos);

            if (proto.hasIsGrabBanker())
            {
                //某玩家抢庄
                if (seat != null)
                {
                    //seat //是否抢庄
                    seat.isGrabBanker = proto.isGrabBanker;
                }
            }
            else
            {
                //抢庄结束
                //说明选庄成功
                //CurrentRoom.roomStatus = ROOM_STATUS.IDLE;

                Debug.Log("抢到庄的是pos:" + seat.Pos);

                seat.IsBanker = true;
                BankerSeat    = seat;
                for (int i = 0; i < CurrentRoom.SeatList.Count; i++)
                {
                    CurrentRoom.SeatList[i].isGrabBanker = 0;
                }

                //设置骰子数据
                CurrentRoom.SetDiceEntity(proto.pos, proto.diceFirst, proto.secondDice);
            }
        }
        else
        {
            if (!proto.hasIsGrabBanker())
            {
                //通知抢庄
                BankerSeat = null;

                for (int i = 0; i < CurrentRoom.SeatList.Count; i++)
                {
                    CurrentRoom.SeatList[i].IsBanker     = false;
                    CurrentRoom.SeatList[i].isGrabBanker = 3;

                    //显示庄
                    TransferData data = new TransferData();
                    data.SetValue("seat", CurrentRoom.SeatList[i]);
                    ModelDispatcher.Instance.Dispatch(ConstDefine_PaiJiu.ObKey_SetBankerAni, data);
                }

                CurrentRoom.roomStatus = ROOM_STATUS.GRABBANKER;
            }
        }


        SendRoomInfoChangeNotify();
    }
コード例 #2
0
    /// <summary>
    /// 服务器广播切牌
    /// </summary>
    /// <param name="obj"></param>
    private void OnServerRobBanker(byte[] obj)
    {
        Debug.Log("服务器广播抢庄:" + obj.Length);
        PAIGOW_ROOM_GRABBANKER proto = PAIGOW_ROOM_GRABBANKER.decode(obj);

        RoomPaiJiuProxy.Instance.OnServerRobBanker(proto);

        //抢庄结束
        if (proto.hasPos() && !proto.hasIsGrabBanker())
        {
            PaiJiuSceneCtrl.Instance.RobEnd(RoomPaiJiuProxy.Instance.GetSeatBySeatId(proto.pos));
        }
    }