示例#1
0
        public static JY_POKER decode(byte[] data)
        {
            JY_POKER 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.hasPour())
            {
                this.pour = buf.getInt();
            }

            if (this.hasPoker())
            {
                byte[] bytes = new byte[buf.getInt()];
                buf.get(ref bytes, 0, bytes.Length);
                this.poker = JY_POKER.decode(bytes);
            }

            if (this.hasPos())
            {
                this.pos = buf.getInt();
            }
        }
示例#3
0
 public void addHistoryPokerList(JY_POKER value)
 {
     if (!this.hasHistoryPokerList())
     {
         this.__flag[1] = (byte)(this.__flag[1] | 16);
     }
     this.historyPokerList.Add(value);
 }
示例#4
0
 public void addPokerList(JY_POKER value)
 {
     if (!this.hasPokerList())
     {
         this.__flag[0] = (byte)(this.__flag[0] | 64);
     }
     this.pokerList.Add(value);
 }
示例#5
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.hasPos())
            {
                this.pos = buf.getInt();
            }

            if (this.hasPlayerId())
            {
                this.playerId = buf.getInt();
            }

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

            if (this.hasPour())
            {
                this.pour = 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.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(JY_POKER.decode(bytes));
                }
            }

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

            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.hasEarnings())
            {
                this.earnings = 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(JY_POKER.decode(bytes));
                }
            }

            if (this.hasIsReady())
            {
                if (buf.get() == 1)
                {
                    this.isReady = true;
                }
                else
                {
                    this.isReady = false;
                }
            }

            if (this.hasIsJoinGame())
            {
                if (buf.get() == 1)
                {
                    this.isJoinGame = true;
                }
                else
                {
                    this.isJoinGame = false;
                }
            }

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

            if (this.hasIsOnLine())
            {
                if (buf.get() == 1)
                {
                    this.isOnLine = true;
                }
                else
                {
                    this.isOnLine = false;
                }
            }
        }