public void Serialize(NetDataWriter writer) { writer.Put(PlayerId); writer.Put(LocalPlanetId); Color.Serialize(writer); LocalPlanetPosition.Serialize(writer); UPosition.Serialize(writer); Rotation.Serialize(writer); BodyRotation.Serialize(writer); Mecha.Serialize(writer); }
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]); } }