示例#1
0
        /// <summary>
        /// Initialize the bone dialog.
        /// </summary>
        /// <param name="gui">The GUI that this dialog will be a part of.</param>
        /// <param name="position">The position of this dialog.</param>
        /// <param name="height">The height of this dialog.</param>
        /// <param name="width">The width of this dialog.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Layout.IsEnabled = false;
            _Bone = new Bone();
            _BoneSprite = null;
            _Border = 5;
            _Ratio = .4f;
            _StartPosition = Vector2.Zero;
            _EndPosition = Vector2.Zero;

            //Create the necessary components.
            _Picturebox = new Picturebox(GUI, new Vector2((position.X + _Border + (Width * _Ratio)), (position.Y + _Border)),
                ((Width * (1 - _Ratio)) - (2 * _Border) - 15), (Height - 35 - (2 * _Border)));
            _Slider = new Slider(GUI, new Vector2((position.X + Width - _Border - 10), (position.Y + (Height - 85 - _Border))), SliderType.Vertical, 50);
            _NameLabel = new Label(GUI, Vector2.Add(Position, new Vector2(_Border, _Border)), 50, 15);
            _NameTextbox = new Textbox(GUI, Vector2.Add(_NameLabel.Position, new Vector2(_NameLabel.Width, 0)),
                ((Width * _Ratio) - (2 * _Border) - _NameLabel.Width), 15);
            _ParentLabel = new Label(GUI, Vector2.Add(_NameLabel.Position, new Vector2(0, 15)), 50, 15);
            _ParentTextbox = new Textbox(GUI, Vector2.Add(_ParentLabel.Position, new Vector2(_ParentLabel.Width, 0)),
                ((Width * _Ratio) - (2 * _Border) - _ParentLabel.Width), 15);
            _AddSpriteButton = new Button(GUI, Vector2.Add(_NameLabel.Position, new Vector2(10, 40)), 75, 30);
            _CloseButton = new Button(GUI, new Vector2((Position.X + ((Width / 2) - 25)), (Position.Y + (Height - 30 - _Border))), 50, 30);

            //Modify the components.
            _Picturebox.Origin = new Vector2((_Picturebox.Width / 2), (_Picturebox.Height / 2));
            _NameLabel.Text = "Name:";
            _ParentLabel.Text = "Parent ID:";
            _AddSpriteButton.Text = "Sprite";
            _Slider.Value = 1;
            _Slider.Maximum = 3;
            _CloseButton.Text = "Done";

            //Add the controls.
            AddItem(_Picturebox);
            AddItem(_Slider);
            AddItem(_NameLabel);
            AddItem(_NameTextbox);
            AddItem(_ParentLabel);
            AddItem(_ParentTextbox);
            AddItem(_AddSpriteButton);
            AddItem(_CloseButton);

            //Hook up to some events.
            _AddSpriteButton.MouseClick += OnAddSpriteButtonClick;
            _CloseButton.MouseClick += OnCloseButtonClick;
            _Picturebox.MouseClick += OnPictureboxClick;
            _Slider.ValueChange += OnSliderChange;
        }
示例#2
0
        /// <summary>
        /// Initialize the item chooser.
        /// </summary>
        /// <param name="gui">The GUI that this chooser will be a part of.</param>
        /// <param name="position">The position of this chooser.</param>
        /// <param name="height">The height of this chooser.</param>
        /// <param name="width">The width of this chooser.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Layout.IsEnabled = false;
            _Border = 5;
            _Ratio = .4f;
            _Type = ItemType.Item;
            _PctbDisplay = new Picturebox(GUI, new Vector2(position.X + _Border + (Width * _Ratio), position.Y + _Border), (Width * (1 - _Ratio)) - (2 * _Border) - 15,
                Height - 35 - (2 * _Border));
            _PctbDisplay.Origin = new Vector2(_PctbDisplay.Width / 2, _PctbDisplay.Height / 2);
            _TrvItems = new TreeView(GUI, new Vector2(position.X + _Border, position.Y + _Border), (Width * _Ratio) - _Border, Height - (2 * _Border));
            _SldScale = new Slider(GUI, new Vector2(position.X + Width - _Border - 10, position.Y + (Height - 85 - _Border)), SliderType.Vertical, 50);
            _SldScale.Value = 1;
            _SldScale.Maximum = 3;
            _BtnFinish = new Button(GUI, new Vector2(position.X + (2 * (Width / 3) - 25), position.Y + (Height - 30 - _Border)), 50, 30);

            //Add the controls.
            AddItem(_PctbDisplay);
            AddItem(_TrvItems);
            AddItem(_SldScale);
            AddItem(_BtnFinish);

            //Hook up some events.
            _BtnFinish.MouseClick += OnDoneButtonClick;
            //_TrvItems.ItemSelect += OnListSelect;
            _SldScale.ValueChange += OnSliderChange;
        }
示例#3
0
        /// <summary>
        /// Initialize the item form.
        /// </summary>
        /// <param name="gui">The GUI that this form will be a part of.</param>
        /// <param name="position">The position of this form.</param>
        /// <param name="height">The height of this form.</param>
        /// <param name="width">The width of this form.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Item = null;

            //Create the tab controller.
            _TabControl = new TabControl(gui, position, width, height);

            //Create the general tab.
            _FrmGeneral = new Form(gui, position + new Vector2(0, 25), width, height);
            _PtbThumbnail = new Picturebox(gui, position, width - 10, 150);
            _ExpBase = new Expander(gui, position, width - 10, 15);
            _FldWidth = new Field(gui, width - 10, 15);
            _FldHeight = new Field(gui, width - 10, 15);
            _ExpWorld = new Expander(gui, position, width - 10, 15);
            _FldPosX = new Field(gui, width - 10, 15);
            _FldPosY = new Field(gui, width - 10, 15);
            _FldRotation = new Field(gui, width - 10, 15);
            _ExpLocal = new Expander(gui, position, width - 10, 15);
            _FldScaleX = new Field(gui, width - 10, 15);
            _FldScaleY = new Field(gui, width - 10, 15);
            _FldOriginX = new Field(gui, width - 10, 15);
            _FldOriginY = new Field(gui, width - 10, 15);

            //Create the physics tab.
            _FrmPhysics = new Form(gui, position + new Vector2(0, 25), width, height);
            _FldMass = new Field(gui, width - 10, 15);
            _FldFriction = new Field(gui, width - 10, 15);
            _FldRestitution = new Field(gui, width - 10, 15);
            _CkbIsStatic = new Checkbox(gui, position, width - 10, 15);
            _CkbIgnoreGravity = new Checkbox(gui, position, width - 10, 15);

            //Set up the components.
            SetUpComponents();

            //Add controls to the expanders.
            _ExpBase.AddItem(_FldWidth);
            _ExpBase.AddItem(_FldHeight);
            _ExpWorld.AddItem(_FldPosX);
            _ExpWorld.AddItem(_FldPosY);
            _ExpWorld.AddItem(_FldRotation);
            _ExpLocal.AddItem(_FldScaleX);
            _ExpLocal.AddItem(_FldScaleY);
            _ExpLocal.AddItem(_FldOriginX);
            _ExpLocal.AddItem(_FldOriginY);

            //Add the controls to the forms.
            _FrmGeneral.AddItem(_PtbThumbnail);
            _FrmGeneral.AddItem(_ExpBase);
            _FrmGeneral.AddItem(_ExpWorld);
            _FrmGeneral.AddItem(_ExpLocal);
            _FrmPhysics.AddItem(_FldMass);
            _FrmPhysics.AddItem(_FldFriction);
            _FrmPhysics.AddItem(_FldRestitution);
            _FrmPhysics.AddItem(_CkbIsStatic);
            _FrmPhysics.AddItem(_CkbIgnoreGravity);

            //Add the controls to their respective tabs.
            _TabControl.AddTab(_FrmGeneral, "General");
            _TabControl.AddTab(_FrmPhysics, "Physics");

            //Add the tab control to this modifier.
            Add(_TabControl);

            //Subscribe to the component's events.
            _FldPosX.Textbox.FocusChange += OnUserModify;
            _FldPosY.Textbox.FocusChange += OnUserModify;
            _FldRotation.Textbox.FocusChange += OnUserModify;
            _FldScaleX.Textbox.FocusChange += OnUserModify;
            _FldScaleY.Textbox.FocusChange += OnUserModify;
            _FldOriginX.Textbox.FocusChange += OnUserModify;
            _FldOriginY.Textbox.FocusChange += OnUserModify;
            _FldMass.Textbox.FocusChange += OnUserModify;
            _FldFriction.Textbox.FocusChange += OnUserModify;
            _FldRestitution.Textbox.FocusChange += OnUserModify;
            _CkbIsStatic.CheckboxTick += OnUserModify;
            _CkbIgnoreGravity.CheckboxTick += OnUserModify;
        }
示例#4
0
        /// <summary>
        /// Initialize the sprite dialog.
        /// </summary>
        /// <param name="gui">The GUI that this sprite dialog will be a part of.</param>
        /// <param name="position">The position of this sprite dialog.</param>
        /// <param name="height">The height of this sprite dialog.</param>
        /// <param name="width">The width of this sprite dialog.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Layout.IsEnabled = false;
            _Border = 5;
            _Ratio = .4f;
            _Textures = new List<string>();
            _StartPosition = Vector2.Zero;
            _EndPosition = Vector2.Zero;
            _Picturebox = new Picturebox(GUI, new Vector2((position.X + _Border + (Width * _Ratio)), (position.Y + _Border)), ((Width * (1 - _Ratio)) - (2 * _Border) - 15),
                (Height - 35 - (2 * _Border)));
            _Picturebox.Origin = new Vector2((_Picturebox.Width / 2), (_Picturebox.Height / 2));
            _List = new List(GUI, new Vector2((position.X + _Border), (position.Y + _Border)), ((Width * _Ratio) - _Border), (Height - (2 * _Border)));
            _Slider = new Slider(GUI, new Vector2((position.X + Width - _Border - 10), (position.Y + (Height - 85 - _Border))), SliderType.Vertical, 50);
            _Slider.Value = 1;
            _Slider.Maximum = 3;
            _Button = new Button(GUI, new Vector2((position.X + (2 * (Width / 3) - 25)), (position.Y + (Height - 30 - _Border))), 50, 30);

            //Add the controls.
            AddItem(_Picturebox);
            AddItem(_List);
            AddItem(_Slider);
            AddItem(_Button);

            //Hook up some events.
            _Picturebox.MouseClick += OnPictureboxClick;
            _Button.MouseClick += OnDoneButtonClick;
            _List.ItemSelect += OnListSelect;
            _Slider.ValueChange += OnSliderChange;
        }