Пример #1
0
        public static GP_SEAT decode(byte[] data)
        {
            GP_SEAT proto = newBuilder();

            proto.build(data);
            return(proto);
        }
Пример #2
0
        public void build(byte[] data)
        {
            ByteBuffer buf = ByteBuffer.wrap(data);

            for (int i = 0; i < this.__flag.Length; i++)
            {
                this.__flag[i] = buf.get();
            }

            if (this.hasSeatList())
            {
                int size = buf.getShort();
                for (int i = 0; i < size; i++)
                {
                    byte[] bytes = new byte[buf.getInt()];
                    buf.get(ref bytes, 0, bytes.Length);
                    this.seatList.Add(GP_SEAT.decode(bytes));
                }
            }

            if (this.hasUnixtime())
            {
                this.unixtime = buf.getLong();
            }
        }
Пример #3
0
 public void addSeatList(GP_SEAT value)
 {
     if (!this.hasSeatList())
     {
         this.__flag[0] = (byte)(this.__flag[0] | 128);
     }
     this.seatList.Add(value);
 }
Пример #4
0
        public void build(byte[] data)
        {
            ByteBuffer buf = ByteBuffer.wrap(data);

            for (int i = 0; i < this.__flag.Length; i++)
            {
                this.__flag[i] = buf.get();
            }

            if (this.hasSettingId())
            {
                int size = buf.getShort();
                for (int i = 0; i < size; i++)
                {
                    this.settingId.Add(buf.getInt());
                }
            }

            if (this.hasRoomId())
            {
                this.roomId = buf.getInt();
            }

            if (this.hasLoop())
            {
                this.loop = buf.getInt();
            }

            if (this.hasMaxLoop())
            {
                this.maxLoop = buf.getInt();
            }

            if (this.hasFirstDice())
            {
                this.firstDice = buf.getInt();
            }

            if (this.hasSecondDice())
            {
                this.secondDice = buf.getInt();
            }

            if (this.hasStatus())
            {
                this.status = (ROOM_STATUS)buf.get();
            }

            if (this.hasSeatList())
            {
                int size = buf.getShort();
                for (int i = 0; i < size; i++)
                {
                    byte[] bytes = new byte[buf.getInt()];
                    buf.get(ref bytes, 0, bytes.Length);
                    this.seatList.Add(GP_SEAT.decode(bytes));
                }
            }

            if (this.hasFirstGivePos())
            {
                this.firstGivePos = buf.getInt();
            }

            if (this.hasTotalPokerNum())
            {
                this.totalPokerNum = buf.getInt();
            }

            if (this.hasRemainPokerNum())
            {
                this.remainPokerNum = buf.getInt();
            }

            if (this.hasPanBase())
            {
                this.panBase = buf.getInt();
            }

            if (this.hasIsAddPanBase())
            {
                if (buf.get() == 1)
                {
                    this.isAddPanBase = true;
                }
                else
                {
                    this.isAddPanBase = false;
                }
            }

            if (this.hasGroupPokerTime())
            {
                this.groupPokerTime = buf.getLong();
            }

            if (this.hasHistoryPokerList())
            {
                int size = buf.getShort();
                for (int i = 0; i < size; i++)
                {
                    byte[] bytes = new byte[buf.getInt()];
                    buf.get(ref bytes, 0, bytes.Length);
                    this.historyPokerList.Add(GP_POKER.decode(bytes));
                }
            }

            if (this.hasLoopEnd())
            {
                if (buf.get() == 1)
                {
                    this.loopEnd = true;
                }
                else
                {
                    this.loopEnd = false;
                }
            }

            if (this.hasDealTime())
            {
                this.dealTime = buf.getInt();
            }

            if (this.hasOwnerId())
            {
                this.ownerId = buf.getInt();
            }

            if (this.hasOwnerNickName())
            {
                byte[] bytes = new byte[buf.getShort()];
                buf.get(ref bytes, 0, bytes.Length);
                this.ownerNickName = System.Text.Encoding.UTF8.GetString(bytes);
            }

            if (this.hasUnixtime())
            {
                this.unixtime = buf.getLong();
            }
        }