예제 #1
0
        private void CreateUI()
        {
            _ObjectField = new ImplantObjectField(this)
            {
                Row = 4, Column = 1
            };

            _MainPanel = new ChangeCheck();

            _MainPanel.RowDefinitions.Add(26, GridUnitType.Pixel);                        // property lable
            _MainPanel.RowDefinitions.Add(124, GridUnitType.Pixel);                       // properties
            _MainPanel.RowDefinitions.Add(ButtonRowHeight, GridUnitType.Pixel);           // button add
            _MainPanel.RowDefinitions.Add(1, GridUnitType.Star);                          // object list
            _MainPanel.RowDefinitions.Add(_ObjectField.LayoutHeight, GridUnitType.Pixel); // object filed


            _LblDefaultProperties = new DropShadowLabel()
            {
                Row = 0, Column = 0, Margin = new Thickness(0, 0, 0, 6)
            }; _LblDefaultProperties.Text = "Default properties";

            ImplantAsset asset = target as ImplantAsset;

            if (asset.DefaultObject == null)
            {
                asset.DefaultObject = CreateNew();
            }
            asset.DefaultObject.OverrideProperties = true;
            _PropertiesField = new ImplantObjectPropertiesField()
            {
                Row = 1, Column = 0, Object = asset.DefaultObject
            };

            _ItemsList = new ListBox()
            {
                Row = 3, Column = 0, Margin = new Thickness(0, 2)
            };
            _ItemsList.BackgroundVisible = true;
            _ItemsList.DisableFocusable();

            _BtnAdd = new Skill.Framework.UI.Button()
            {
                Row = 2, Column = 0, Margin = new Thickness(2)
            };
            _BtnAdd.Content.text = "Add";
            _BtnAdd.Click       += new System.EventHandler(_BtnAdd_Click);

            _MainPanel.Controls.Add(new Box()
            {
                Row = 4, Column = 0
            });
            _MainPanel.Controls.Add(new Box()
            {
                Row = 0, Column = 0, RowSpan = 2
            });

            _MainPanel.Controls.Add(_LblDefaultProperties);
            _MainPanel.Controls.Add(_PropertiesField);
            _MainPanel.Controls.Add(_BtnAdd);
            _MainPanel.Controls.Add(_ItemsList);
            _MainPanel.Controls.Add(_ObjectField);



            _Frame = new Frame("MainFrame");
            _Frame.Grid.Controls.Add(_MainPanel);

            _MainPanel.Changed          += new EventHandler(_ChangeCheck_Changed);
            _ItemsList.SelectionChanged += _ItemsList_SelectionChanged;
        }
예제 #2
0
        public ImplantObjectPropertiesField()
        {
            this.Margin = new Thickness(0, 0, 0, 8);
            this.Width  = 300;

            this._MinScaleField = new FloatField()
            {
                Margin = new Thickness(2, 2, 2, 0)
            };
            this._MinScaleField.Label.text = "Min Scale Percent";

            this._MaxScaleField = new FloatField()
            {
                Margin = new Thickness(2, 2, 2, 0)
            };
            this._MaxScaleField.Label.text = "Max Scale Percent";

            this._ChanceField = new Skill.Editor.UI.Slider()
            {
                MinValue = 0.1f, MaxValue = 1.0f, Margin = new Thickness(2, 2, 2, 2)
            };
            this._ChanceField.Label.text = "Chance";

            _RandomRotationPanel = new Grid()
            {
                Height = 45
            };

            _RandomRotationPanel.ColumnDefinitions.Add(30, GridUnitType.Pixel);
            _RandomRotationPanel.ColumnDefinitions.Add(1, GridUnitType.Star);

            _RandomRotationPanel.RowDefinitions.Add(1, GridUnitType.Star);
            _RandomRotationPanel.RowDefinitions.Add(1, GridUnitType.Star);

            _MinRandomRotation = new Vector3Field()
            {
                Row = 0, Column = 1
            };
            _MaxRandomRotation = new Vector3Field()
            {
                Row = 1, Column = 1
            };
            _RandomRotationPanel.Controls.Add(_MinRandomRotation);
            _RandomRotationPanel.Controls.Add(_MaxRandomRotation);

            Label lblMin = new Label()
            {
                Row = 0, Column = 0, Text = "Min"
            };
            Label lblMax = new Label()
            {
                Row = 1, Column = 0, Text = "Max"
            };

            _RandomRotationPanel.Controls.Add(lblMin);
            _RandomRotationPanel.Controls.Add(lblMax);
            _CustomRotation = new Skill.Editor.UI.Vector3Field();

            _RandomYaw = new Skill.Framework.UI.ToggleButton()
            {
                HorizontalAlignment = Skill.Framework.UI.HorizontalAlignment.Left, Margin = new Thickness(20, 0, 0, 0)
            };
            _RandomYaw.Content.text = "Random Yaw";

            _RotationSF = new Skill.Editor.UI.SelectionField()
            {
                Margin = new Thickness(2)
            };
            _RotationSF.Label.Width           = 110;
            _RotationSF.Background.Visibility = Skill.Framework.UI.Visibility.Hidden;

            _RotationSF.AddField(_RandomYaw, "Surface Normal ");
            _RotationSF.AddField(_CustomRotation, "Custom ");
            _RotationSF.AddField(_RandomRotationPanel, "Random ");

            _RotationLabel = new DropShadowLabel()
            {
                Text = "Rotation", Margin = new Thickness(4, 0, 0, 0)
            };

            this.Orientation = Orientation.Vertical;
            this.Controls.Add(_MinScaleField);
            this.Controls.Add(_MaxScaleField);
            this.Controls.Add(_ChanceField);
            this.Controls.Add(_RotationLabel);
            this.Controls.Add(_RotationSF);

            this._MinScaleField.ValueChanged      += new EventHandler(_MinScaleField_ValueChanged);
            this._MaxScaleField.ValueChanged      += new EventHandler(_MaxScaleField_ValueChanged);
            this._ChanceField.ValueChanged        += new EventHandler(_ChanceField_ValueChanged);
            this._RotationSF.SelectedFieldChanged += new EventHandler(_RotationSF_SelectedFieldChanged);

            this._MinRandomRotation.ValueChanged += _MinRandomRotation_ValueChanged;
            this._MaxRandomRotation.ValueChanged += _MaxRandomRotation_ValueChanged;

            this._CustomRotation.ValueChanged += new EventHandler(_CustomRotation_ValueChanged);
            this._RandomYaw.Changed           += new EventHandler(_RandomYaw_Changed);


            this.Object = null;
            this.Height = _MinScaleField.LayoutHeight + _MinScaleField.Margin.Vertical +
                          _MaxScaleField.LayoutHeight + _MaxScaleField.Margin.Vertical +
                          _ChanceField.LayoutHeight + _ChanceField.Margin.Vertical +
                          _RotationLabel.LayoutHeight + _RotationLabel.Margin.Vertical +
                          _RotationSF.LayoutHeight + _RotationSF.Margin.Vertical + 20;
        }