コード例 #1
0
ファイル: PAIGOW_SEAT.cs プロジェクト: guochaolinDLKF/LaiJu
        public static PAIGOW_SEAT decode(byte[] data)
        {
            PAIGOW_SEAT proto = newBuilder();

            proto.build(data);
            return(proto);
        }
コード例 #2
0
 public void addPaigowSeat(PAIGOW_SEAT value)
 {
     if (!this.hasPaigowSeat())
     {
         this.__flag[0] = (byte)(this.__flag[0] | 2);
     }
     this.paigow_seat.Add(value);
 }
コード例 #3
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.hasUnixtime())
            {
                this.unixtime = buf.getLong();
            }

            if (this.hasPaigowSeat())
            {
                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.paigow_seat.Add(PAIGOW_SEAT.decode(bytes));
                }
            }

            if (this.hasIsOwner())
            {
                if (buf.get() == 1)
                {
                    this.isOwner = true;
                }
                else
                {
                    this.isOwner = false;
                }
            }

            if (this.hasDiceFirst())
            {
                this.diceFirst = buf.getInt();
            }

            if (this.hasDiceSecond())
            {
                this.diceSecond = buf.getInt();
            }

            if (this.hasRemainMahjong())
            {
                this.remainMahjong = buf.getInt();
            }

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

            if (this.hasMahjongs_remain())
            {
                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.mahjongs_remain.Add(PAIGOW_MAHJONG.decode(bytes));
                }
            }
        }
コード例 #4
0
ファイル: PAIGOW_ROOM.cs プロジェクト: guochaolinDLKF/LaiJu
        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.hasUnixtime())
            {
                this.unixtime = buf.getLong();
            }

            if (this.hasPaigowSeat())
            {
                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.paigow_seat.Add(PAIGOW_SEAT.decode(bytes));
                }
            }

            if (this.hasRoomStatus())
            {
                this.room_status = (ROOM_STATUS)buf.get();
            }

            if (this.hasRoomModel())
            {
                this.room_model = (ROOM_MODEL)buf.get();
            }

            if (this.hasRemainMahjong())
            {
                this.remainMahjong = buf.getInt();
            }

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

            if (this.hasChooseBankerPos())
            {
                this.chooseBankerPos = buf.getInt();
            }

            if (this.hasMahJongSum())
            {
                this.mahJongSum = buf.getInt();
            }

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

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

            if (this.hasIsCutPan())
            {
                if (buf.get() == 1)
                {
                    this.isCutPan = true;
                }
                else
                {
                    this.isCutPan = false;
                }
            }

            if (this.hasIsBombPan())
            {
                if (buf.get() == 1)
                {
                    this.isBombPan = true;
                }
                else
                {
                    this.isBombPan = false;
                }
            }

            if (this.hasMahjongs_remain())
            {
                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.mahjongs_remain.Add(PAIGOW_MAHJONG.decode(bytes));
                }
            }
        }