示例#1
0
 override public void Encode(WriteBuffer wb)
 {
     Eproto.PackArray(wb, 3);
     Eproto.PackInteger(wb, this.result);
     Eproto.PackInteger(wb, this.region_code);
     if (this.games == null)
     {
         Eproto.PackNil(wb);
     }
     else
     {
         Eproto.PackArray(wb, this.games.Length);
         for (int i = 0; i < this.games.Length; ++i)
         {
             invite_game v = this.games[i];
             if (v == null)
             {
                 Eproto.PackNil(wb);
             }
             else
             {
                 v.Encode(wb);
             }
         }
     }
 }
示例#2
0
        override public void Decode(ReadBuffer rb)
        {
            long c = Eproto.UnpackArray(rb);

            if (c <= 0)
            {
                return;
            }
            Eproto.UnpackInteger(rb, ref this.result);
            if (--c <= 0)
            {
                return;
            }
            Eproto.UnpackInteger(rb, ref this.region_code);
            if (--c <= 0)
            {
                return;
            }
            {
                long n = Eproto.UnpackArray(rb);
                if (n < 0)
                {
                    this.games = null;
                }
                else
                {
                    this.games = new invite_game[n];
                    for (int i = 0; i < n; ++i)
                    {
                        invite_game v = null;
                        if (rb.NextIsNil())
                        {
                            rb.MoveNext();
                        }
                        else
                        {
                            v = new invite_game(); v.Decode(rb);
                        }
                        this.games[i] = v;
                    }
                }
            }
            if (--c <= 0)
            {
                return;
            }
            Eproto.UnpackDiscard(rb, c);
        }