Example #1
0
        public static GP_POKER decode(byte[] data)
        {
            GP_POKER proto = newBuilder();

            proto.build(data);
            return(proto);
        }
        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.hasDrawPokerList())
            {
                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.drawPokerList.Add(GP_POKER.decode(bytes));
                }
            }

            if (this.hasPos())
            {
                this.pos = buf.getInt();
            }

            if (this.hasIndex())
            {
                this.index = buf.getInt();
            }
        }
Example #3
0
 public void addHistoryPokerList(GP_POKER value)
 {
     if (!this.hasHistoryPokerList())
     {
         this.__flag[1] = (byte)(this.__flag[1] | 64);
     }
     this.historyPokerList.Add(value);
 }
Example #4
0
 public void addMaxPokerList(GP_POKER value)
 {
     if (!this.hasMaxPokerList())
     {
         this.__flag[2] = (byte)(this.__flag[2] | 64);
     }
     this.maxPokerList.Add(value);
 }
Example #5
0
 public void addPokerList(GP_POKER value)
 {
     if (!this.hasPokerList())
     {
         this.__flag[0] = (byte)(this.__flag[0] | 64);
     }
     this.pokerList.Add(value);
 }
 public void addDrawPokerList(GP_POKER value)
 {
     if (!this.hasDrawPokerList())
     {
         this.__flag[0] = (byte)(this.__flag[0] | 1);
     }
     this.drawPokerList.Add(value);
 }
Example #7
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();
            }
        }
Example #8
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.hasPlayerId())
            {
                this.playerId = buf.getInt();
            }

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

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

            if (this.hasGender())
            {
                this.gender = buf.get();
            }

            if (this.hasGold())
            {
                this.gold = buf.getInt();
            }

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

            if (this.hasPokerList())
            {
                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.pokerList.Add(GP_POKER.decode(bytes));
                }
            }

            if (this.hasPos())
            {
                this.pos = buf.getInt();
            }

            if (this.hasIsBanker())
            {
                if (buf.get() == 1)
                {
                    this.isBanker = true;
                }
                else
                {
                    this.isBanker = false;
                }
            }

            if (this.hasIsDismiss())
            {
                if (buf.get() == 1)
                {
                    this.isDismiss = true;
                }
                else
                {
                    this.isDismiss = false;
                }
            }

            if (this.hasIsWin())
            {
                if (buf.get() == 1)
                {
                    this.isWin = true;
                }
                else
                {
                    this.isWin = false;
                }
            }

            if (this.hasEarnings())
            {
                this.earnings = buf.getInt();
            }

            if (this.hasLoopEarnings())
            {
                this.loopEarnings = buf.getInt();
            }

            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.hasPourList())
            {
                int size = buf.getShort();
                for (int i = 0; i < size; i++)
                {
                    this.pourList.Add(buf.getInt());
                }
            }

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

            if (this.hasLongitude())
            {
                this.longitude = buf.getFloat();
            }

            if (this.hasLatitude())
            {
                this.latitude = buf.getFloat();
            }

            if (this.hasIsAfk())
            {
                if (buf.get() == 1)
                {
                    this.isAfk = true;
                }
                else
                {
                    this.isAfk = false;
                }
            }

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

            if (this.hasIsGrabBanker())
            {
                this.isGrabBanker = buf.getInt();
            }

            if (this.hasIsCuoPai())
            {
                this.isCuoPai = buf.getInt();
            }

            if (this.hasMaxPokerList())
            {
                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.maxPokerList.Add(GP_POKER.decode(bytes));
                }
            }
        }