protected virtual Serializer Deserialize(Serializer serializer) { TextureReference = serializer.GetDataItem <string>("texture"); Frame = serializer.GetDataItem <Rectangle>("frame"); Origin = serializer.GetDataItem <Vector2>("origin"); DisplayPosition = serializer.GetDataItem <Vector2>("display-position"); Visible = serializer.GetDataItem <bool>("visible"); Scale = serializer.GetDataItem <float>("scale"); Rotation = serializer.GetDataItem <float>("rotation"); Tint = serializer.GetDataItem <Color>("tint"); AnimationEngine = null; switch (serializer.GetDataItem <string>("engine-type")) { case "colour": AnimationEngine = new ColourAnimationEngine(this); WireUpAnimationEngineHooks(); serializer.KnownSerializedObjects.Add(AnimationEngine); AnimationEngine = serializer.GetDataItem <ColourAnimationEngine>("animation-engine"); break; case "transform": AnimationEngine = new TransformationAnimationEngine(this); WireUpAnimationEngineHooks(); serializer.KnownSerializedObjects.Add(AnimationEngine); AnimationEngine = serializer.GetDataItem <TransformationAnimationEngine>("animation-engine"); break; } TextureManager.AddManagedObject(this); return(serializer); }
protected virtual Serializer Deserialize(Serializer serializer) { TextureReference = serializer.GetDataItem<string>("texture"); base.Frame = serializer.GetDataItem<Rectangle>("frame"); base.Origin = serializer.GetDataItem<Vector2>("origin"); base.WorldPosition = serializer.GetDataItem<Vector2>("worldposition"); base.CameraPosition = serializer.GetDataItem<Vector2>("cameraposition"); base.RenderLayer = serializer.GetDataItem<int>("renderlayer"); base.Visible = serializer.GetDataItem<bool>("visible"); base.Scale = serializer.GetDataItem<float>("scale"); base.Rotation = serializer.GetDataItem<float>("rotation"); base.Mirror = serializer.GetDataItem<bool>("mirror"); base.RenderDepth = serializer.GetDataItem<float>("renderdepth"); base.Tint = serializer.GetDataItem<Color>("tint"); TextureManager.AddManagedObject(this); return serializer; }
public StorableSimpleDrawableObject(string id) : this() { ID = id; TextureManager.AddManagedObject(this); }