Beispiel #1
0
        public static byte[] Write(GameRoomMemberSvo svo)
        {
            ByteBuffer buffer = new ByteBuffer();

            buffer.WriteLong(svo.Id)
            .WriteString(svo.Name)
            .WriteInt32(svo.Type);
            return(buffer.Getbuffer());
        }
Beispiel #2
0
        public static GameRoomMemberSvo Read(byte[] bytes)
        {
            GameRoomMemberSvo svo    = new GameRoomMemberSvo();
            ByteBuffer        buffer = new ByteBuffer(bytes);

            svo.Id   = buffer.ReadLong();
            svo.Name = buffer.ReadString();
            svo.Type = buffer.ReadInt32();

            return(svo);
        }
Beispiel #3
0
 public static byte[] Write(GameRoomSvo value)
 {
     using (ByteBuffer buffer = new ByteBuffer())
     {
         buffer.WriteInt32(value.RoomId)
         .WriteInt32(value.Members.Count);
         for (int i = 0; i < value.Members.Count; ++i)
         {
             buffer.WriteBytes(GameRoomMemberSvo.Write(value.Members[i]));
         }
         return(buffer.Getbuffer());
     }
 }
Beispiel #4
0
        public static GameRoomSvo Read(byte[] bytes)
        {
            GameRoomSvo svo    = new GameRoomSvo();
            ByteBuffer  buffer = new ByteBuffer(bytes);

            svo.RoomId  = buffer.ReadInt32();
            svo.Members = new List <GameRoomMemberSvo>();
            int size = buffer.ReadInt32();

            for (int i = 0; i < size; ++i)
            {
                svo.Members.Add(GameRoomMemberSvo.Read(buffer.ReadBytes()));
            }
            return(svo);
        }