public override void CreateInDesignMode( LayerEditor parentLayer, IEntityCreationProperties creationProperties) { _polygon = new Vector2[4]; ParentLayer = parentLayer; var tCreationProperties = (TextureCreationProperties)creationProperties; string fullPath = tCreationProperties.PathToTexture; tryInitialiseTexture(fullPath); // ReSharper disable UseObjectOrCollectionInitializer _properties = new TextureItemProperties // ReSharper restore UseObjectOrCollectionInitializer { Position = MouseStatus.WorldPosition, TexturePathRelativeToContentRoot = ObjectFactory.GetInstance <IDisk>().MakeRelativePath(parentLayer.ParentLevel.ContentRootFolder, fullPath), CustomProperties = new CustomProperties(), Visible = true, Scale = Vector2.One, TintColor = Color.White, }; _properties.Origin = getTextureOrigin(); WhenUpdatedByUi(); }
public override void RecreateFromXml(LayerEditor parentLayer, XElement xml) { base.RecreateFromXml(parentLayer, xml); _polygon = new Vector2[4]; ParentLayer = parentLayer; _properties = xml.Element(@"TextureItemProperties").DeserializedAs <TextureItemProperties>(); tryInitialiseTexture(_properties.TexturePathRelativeToContentRoot); WhenUpdatedByUi(); }
public TextureItemEditor() { _properties = new TextureItemProperties(); ObjectFactory.GetInstance <IModelEventHub>().Subscribe <ContentRootChanged>(this); }