public void Deserialize(BinaryReader reader) { if (new string(reader.ReadChars(4)) != "FSOo") { return; } Version = reader.ReadInt32(); Compressed = reader.ReadBoolean(); var uReader = reader; MemoryStream cStream = null; GZipStream zipStream = null; if (Compressed) { var length = reader.ReadInt32(); cStream = new MemoryStream(reader.ReadBytes(length)); zipStream = new GZipStream(cStream, CompressionMode.Decompress); reader = new BinaryReader(zipStream); } int ents = reader.ReadInt32(); Entities = new VMEntityMarshal[ents]; for (int i = 0; i < ents; i++) { var ent = new VMGameObjectMarshal(); ent.Deserialize(reader); Entities[i] = ent; } MultitileGroup = new VMMultitileGroupMarshal(); MultitileGroup.Deserialize(reader); }
public VMGameObjectMarshal Save() { var gameObj = new VMGameObjectMarshal { Direction = Direction }; SaveEnt(gameObj); return gameObj; }
public void Load(VMGameObjectMarshal input) { base.Load(input); Position = Position; Direction = input.Direction; if (UseWorld) { ((ObjectComponent)this.WorldUI).DynamicSpriteFlags = this.DynamicSpriteFlags; ((ObjectComponent)WorldUI).ObjectID = ObjectID; if (Slots != null && Slots.Slots.ContainsKey(0)) ((ObjectComponent)WorldUI).ContainerSlots = Slots.Slots[0]; RefreshGraphic(); } }