Пример #1
0
        public RectangleItemEditor( )
        {
            _properties= new RectangleItemProperties(  );

            _properties = fromRectangle(Rectangle.Empty);
            _properties.Position = Vector2.Zero;
            _properties.Visible = true;
            _properties.FillColor = Constants.Instance.ColorPrimitives;
            _properties.Width = _properties.Height = 100 ;
        }
Пример #2
0
 public virtual void LoadRectangleItem(RectangleItemProperties rectangleitem, Layer l)
 {
     if (l.Properties.CustomProperties.Keys.Contains("Collision") && (bool)l.Properties.CustomProperties["Collision"].Value)
     {
         Body b = BodyFactory.CreateRectangle(this.World, ConvertUnits.ToSimUnits(rectangleitem.Width), ConvertUnits.ToSimUnits(rectangleitem.Height), 1f);
         b.Position = rectangleitem.getSimPosition();
         //b.Position.X +=
         b.IsStatic = true;
         b.BodyType = BodyType.Static;
         b.UserData = this;
     }
 }
Пример #3
0
        public virtual void CreateReadyForDroppingOntoCanvas(LayerEditor parentLayer, IEntityCreationProperties creationProperties)
        {
            ParentLayer = parentLayer ;

            _properties = fromRectangle( Rectangle.Empty ) ;

            _properties.Position = MouseStatus.WorldPosition ;

            Vector2 size = calculateDefaultSizeOfNewlyCreatedItem();

            _properties.Width = size.X;
            _properties.Height = size.Y;
            _properties.Visible = true ;
            _properties.FillColor = Constants.Instance.ColorPrimitives ;

            summonMainForm(  ).SetToolStripStatusLabel1(Resource1.Rectangle_DragDrop);

            WhenUpdatedByUi();
        }
Пример #4
0
        public override void RecreateFromXml( LayerEditor parentLayer, XElement xml )
        {
            ParentLayer = parentLayer ;

            _properties = xml.Element( @"RectangleItemProperties" ).DeserializedAs<RectangleItemProperties>( ) ;

            //todo: don't like having to call the base - use the Prototype
            base.RecreateFromXml( parentLayer, xml );

            WhenUpdatedByUi(  );
        }
Пример #5
0
        public override void CreateInDesignMode(LayerEditor parentLayer, IEntityCreationProperties creationProperties)
        {
            ParentLayer = parentLayer ;

            _properties = fromRectangle( Rectangle.Empty ) ;

            if (creationProperties.TriggeredBy == UiAction.Dragging)
            {
                var size = calculateDefaultSizeOfNewlyCreatedItem();
                _properties.Width = size.X;
                _properties.Height = size.Y;
            }

            _properties.Position = MouseStatus.WorldPosition ;

            _properties.Visible = true ;
            _properties.FillColor = Constants.Instance.ColorPrimitives ;

            summonMainForm(  ).SetToolStripStatusLabel1(Resource1.Rectangle_Started);

            WhenUpdatedByUi();
        }