Example #1
0
 override public void Encode(WriteBuffer wb)
 {
     Eproto.PackArray(wb, 11);
     Eproto.PackInteger(wb, this.game_id);
     Eproto.PackString(wb, this.game_name);
     Eproto.PackInteger(wb, this.showtag);
     Eproto.PackInteger(wb, this.play_countdown);
     Eproto.PackInteger(wb, this.operate_countdown);
     if (this.showtag2_version == null)
     {
         Eproto.PackNil(wb);
     }
     else
     {
         Eproto.PackArray(wb, this.showtag2_version.Length);
         for (int i = 0; i < this.showtag2_version.Length; ++i)
         {
             string v = this.showtag2_version[i];
             Eproto.PackString(wb, v);
         }
     }
     Eproto.PackString(wb, this.game_info);
     Eproto.PackInteger(wb, this.player_number);
     Eproto.PackInteger(wb, this.is_new);
     Eproto.PackInteger(wb, this.sort_id);
     if (this.price == null)
     {
         Eproto.PackNil(wb);
     }
     else
     {
         Eproto.PackArray(wb, this.price.Length);
         for (int i = 0; i < this.price.Length; ++i)
         {
             match_price v = this.price[i];
             if (v == null)
             {
                 Eproto.PackNil(wb);
             }
             else
             {
                 v.Encode(wb);
             }
         }
     }
 }
Example #2
0
        override public void Decode(ReadBuffer rb)
        {
            long c = Eproto.UnpackArray(rb);

            if (c <= 0)
            {
                return;
            }
            Eproto.UnpackInteger(rb, ref this.game_id);
            if (--c <= 0)
            {
                return;
            }
            Eproto.UnpackString(rb, ref this.game_name);
            if (--c <= 0)
            {
                return;
            }
            Eproto.UnpackInteger(rb, ref this.showtag);
            if (--c <= 0)
            {
                return;
            }
            Eproto.UnpackInteger(rb, ref this.play_countdown);
            if (--c <= 0)
            {
                return;
            }
            Eproto.UnpackInteger(rb, ref this.operate_countdown);
            if (--c <= 0)
            {
                return;
            }
            {
                long n = Eproto.UnpackArray(rb);
                if (n < 0)
                {
                    this.showtag2_version = null;
                }
                else
                {
                    this.showtag2_version = new string[n];
                    for (int i = 0; i < n; ++i)
                    {
                        string v = null;
                        Eproto.UnpackString(rb, ref v);
                        this.showtag2_version[i] = v;
                    }
                }
            }
            if (--c <= 0)
            {
                return;
            }
            Eproto.UnpackString(rb, ref this.game_info);
            if (--c <= 0)
            {
                return;
            }
            Eproto.UnpackInteger(rb, ref this.player_number);
            if (--c <= 0)
            {
                return;
            }
            Eproto.UnpackInteger(rb, ref this.is_new);
            if (--c <= 0)
            {
                return;
            }
            Eproto.UnpackInteger(rb, ref this.sort_id);
            if (--c <= 0)
            {
                return;
            }
            {
                long n = Eproto.UnpackArray(rb);
                if (n < 0)
                {
                    this.price = null;
                }
                else
                {
                    this.price = new match_price[n];
                    for (int i = 0; i < n; ++i)
                    {
                        match_price v = null;
                        if (rb.NextIsNil())
                        {
                            rb.MoveNext();
                        }
                        else
                        {
                            v = new match_price(); v.Decode(rb);
                        }
                        this.price[i] = v;
                    }
                }
            }
            if (--c <= 0)
            {
                return;
            }
            Eproto.UnpackDiscard(rb, c);
        }