Example #1
0
        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();
        }
Example #2
0
        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();
        }
Example #3
0
        public TextureItemEditor()
        {
            _properties = new TextureItemProperties();

            ObjectFactory.GetInstance <IModelEventHub>().Subscribe <ContentRootChanged>(this);
        }