示例#1
0
 public void Serialize(NetDataWriter writer)
 {
     writer.Put(Username);
     writer.Put(PlayerId);
     writer.Put(LocalPlanetId);
     MechaColor.Serialize(writer);
     LocalPlanetPosition.Serialize(writer);
     UPosition.Serialize(writer);
     Rotation.Serialize(writer);
     BodyRotation.Serialize(writer);
     Mecha.Serialize(writer);
 }
示例#2
0
 public void Serialize(INetDataWriter writer)
 {
     writer.Put(Username);
     writer.Put(PlayerId);
     writer.Put(LocalPlanetId);
     writer.Put(MechaColors?.Length ?? 0);
     for (int i = 0; i < (MechaColors?.Length ?? 0); i++)
     {
         MechaColors[i].Serialize(writer);
     }
     LocalPlanetPosition.Serialize(writer);
     UPosition.Serialize(writer);
     Rotation.Serialize(writer);
     BodyRotation.Serialize(writer);
     Mecha.Serialize(writer);
     writer.Put(Appearance != null);
     if (Appearance != null)
     {
         using (MemoryStream ms = new MemoryStream())
         {
             using (BinaryWriter wr = new BinaryWriter(ms))
             {
                 Appearance.Export(wr);
             }
             byte[] export = ms.ToArray();
             writer.Put(export.Length);
             writer.Put(export);
         }
     }
     writer.Put(DIYAppearance != null);
     if (DIYAppearance != null)
     {
         using (MemoryStream ms = new MemoryStream())
         {
             using (BinaryWriter wr = new BinaryWriter(ms))
             {
                 DIYAppearance.Export(wr);
             }
             byte[] export = ms.ToArray();
             writer.Put(export.Length);
             writer.Put(export);
         }
     }
     writer.Put(DIYItemId.Length);
     for (int i = 0; i < DIYItemId.Length; i++)
     {
         writer.Put(DIYItemId[i]);
         writer.Put(DIYItemValue[i]);
     }
 }