Exemple #1
0
        private void CreateUI()
        {
            Thickness margin = new Thickness(0, 2, 0, 4);

            _Frame = new Skill.Framework.UI.Frame("Frame");
            _Panel = new StackPanel();

            Grid pnlToggles = new Grid()
            {
                Height = 22
            };

            pnlToggles.ColumnDefinitions.Add(1, GridUnitType.Star);
            pnlToggles.ColumnDefinitions.Add(1, GridUnitType.Star);

            _TbEnable = new UI.ToggleButton()
            {
                IsChecked = _Implant.IsEnable, Margin = margin, Left = true, Column = 0
            }; _TbEnable.Label.text = "Enable";
            _TbUniform = new UI.ToggleButton()
            {
                IsChecked = _Implant.Uniform, Margin = margin, Left = true, Column = 1
            }; _TbUniform.Label.text = "Uniform";

            pnlToggles.Controls.Add(_TbEnable);
            pnlToggles.Controls.Add(_TbUniform);

            _AssetField = new Skill.Editor.UI.ObjectField <ImplantAsset>()
            {
                VerticalAlignment = VerticalAlignment.Center, Margin = margin, AllowSceneObjects = false
            };
            _AssetField.Label.text = "ImplantAsset";
            if (_Implant.ImplantAsset != null)
            {
                _Asset = _Implant.ImplantAsset as ImplantAsset;
                _Implant.ImplantAsset = _AssetField.Object = _Asset;
            }

            _RootField = new ObjectField <Transform>()
            {
                Margin = margin, AllowSceneObjects = true, Object = _Implant.Root
            }; _RootField.Label.text = "Root";

            _Layers = new Skill.Editor.UI.LayerMaskField()
            {
                Layers = _Implant.LayerMask, VerticalAlignment = VerticalAlignment.Center, Margin = margin
            };
            _Layers.Label.text = "Raycast layers";

            _SliDensity = new Skill.Editor.UI.IntSlider()
            {
                Value = _Implant.Density, MinValue = 1, MaxValue = 1000, Margin = margin, Height = 16
            }; _SliDensity.Label.text = "Density"; _SliDensity.Label.tooltip = "Shift + (W/S)";
            _SliRotation = new Skill.Editor.UI.Slider()
            {
                Value = _Implant.Rotation, MinValue = 0.0f, MaxValue = 360, Margin = margin, Height = 16
            }; _SliRotation.Label.text = "Rotation"; _SliRotation.Label.tooltip = "Shift + (A/D)";
            _SliOffsetY = new Skill.Editor.UI.Slider()
            {
                Value = _Implant.OffsetY, MinValue = -10.0f, MaxValue = 20, Margin = margin, Height = 16
            }; _SliOffsetY.Label.text = "Offset Y"; _SliOffsetY.Label.tooltip = "Offset in Y axis)";
            _SliMinRadius             = new Skill.Editor.UI.Slider()
            {
                Value = _Implant.MinRadius, MinValue = 0.0f, MaxValue = 200, Margin = margin, Height = 16
            }; _SliMinRadius.Label.text = "Min Radius";
            _SliMaxRadius = new Skill.Editor.UI.Slider()
            {
                Value = _Implant.MaxRadius, MinValue = 0.0f, MaxValue = 200, Margin = margin, Height = 16
            }; _SliMaxRadius.Label.text = "Max Radius";
            _SliRectWidth = new Skill.Editor.UI.Slider()
            {
                Value = _Implant.RectWidth, MinValue = 0.0f, MaxValue = 1000, Margin = margin, Height = 16
            }; _SliRectWidth.Label.text = "Width";
            _SliRectHeight = new Skill.Editor.UI.Slider()
            {
                Value = _Implant.RectHeight, MinValue = 0.0f, MaxValue = 1000, Margin = margin, Height = 16
            }; _SliRectHeight.Label.text = "Height";
            _Help = new Skill.Editor.UI.HelpBox()
            {
                Message = "Hold Ctrl and Right Click to implant obejcts.\nMouse3 to shuffle.\nShift + R : Make reference point.\nSpace : R reference point", Height = 60, Margin = new Thickness(0, 10, 0, 0)
            };

            _TbModes = new TabHeader {
                Margin = new Thickness(0, 2, 0, 10), HorizontalAlignment = HorizontalAlignment.Center, Width = 200, Height = 20
            };
            _TbModes[0].text     = "Circle";
            _TbModes[1].text     = "Rectangle";
            _TbModes.SelectedTab = _Implant.BrushMode;


            _Panel.Controls.Add(pnlToggles);
            _Panel.Controls.Add(_AssetField);
            _Panel.Controls.Add(_RootField);
            _Panel.Controls.Add(_Layers);
            _Panel.Controls.Add(_SliDensity);
            _Panel.Controls.Add(_SliRotation);
            _Panel.Controls.Add(_SliOffsetY);
            _Panel.Controls.Add(_TbModes);
            _Panel.Controls.Add(_SliMinRadius);
            _Panel.Controls.Add(_SliMaxRadius);
            _Panel.Controls.Add(_SliRectWidth);
            _Panel.Controls.Add(_SliRectHeight);
            _Panel.Controls.Add(_Help);
            _Frame.Grid.Controls.Add(_Panel);

            ChangeMode();
            UpdateRotation();

            _AssetField.ObjectChanged   += _AssetField_ObjectChanged;
            _RootField.ObjectChanged    += _RootField_ObjectChanged;
            _Layers.LayersChanged       += _Layers_LayersChanged;
            _SliDensity.ValueChanged    += _SliDensity_ValueChanged;
            _SliRotation.ValueChanged   += _SliRotation_ValueChanged;
            _TbModes.SelectedTabChanged += _TbModes_SelectedTabChanged;
            _SliMinRadius.ValueChanged  += _SliMinRadius_ValueChanged;
            _SliMaxRadius.ValueChanged  += _SliMaxRadius_ValueChanged;
            _SliRectWidth.ValueChanged  += _SliRectWidth_ValueChanged;
            _SliRectHeight.ValueChanged += _SliRectHeight_ValueChanged;
            _SliOffsetY.ValueChanged    += _SliOffsetY_ValueChanged;
            _TbEnable.Changed           += _TbEnable_Changed;
            _TbUniform.Changed          += _TbUniform_Changed;
        }
Exemple #2
0
        private void CreateUI()
        {
            _ChangeCheck = new ChangeCheck();
            _ChangeCheck.ColumnDefinitions.Add(1, Skill.Framework.UI.GridUnitType.Star);
            _ChangeCheck.ColumnDefinitions.Add(1, Skill.Framework.UI.GridUnitType.Star);

            _ChangeCheck.RowDefinitions.Add(24, Skill.Framework.UI.GridUnitType.Pixel);  // buttons _BtnAdd/_BtnRemove
            _ChangeCheck.RowDefinitions.Add(164, Skill.Framework.UI.GridUnitType.Pixel); // _PointsScrollView
            _ChangeCheck.RowDefinitions.Add(64, Skill.Framework.UI.GridUnitType.Pixel);  // _PnlPoperties
            _ChangeCheck.RowDefinitions.Add(154, Skill.Framework.UI.GridUnitType.Pixel); // _PnlTools

            _BtnAdd = new Button()
            {
                Row = 0, Column = 0
            }; _BtnAdd.Content.text = "Add"; _BtnAdd.Content.tooltip = "Add new point the end of the path."; _BtnAdd.Content.image = Resources.UITextures.Plus;
            _BtnRemove = new Button()
            {
                Row = 0, Column = 1
            }; _BtnRemove.Content.text = "Remove"; _BtnRemove.Content.tooltip = "Remove selected point."; _BtnRemove.Content.image = Resources.UITextures.Minus;
            _PointsScrollView          = new Skill.Framework.UI.ScrollView()
            {
                Row = 1, Column = 0, ColumnSpan = 2, AlwayShowVertical = true, Padding = new Skill.Framework.UI.Thickness(0, 2)
            };
            _GridPoints = new Skill.Framework.UI.SelectionGrid()
            {
                XCount = 5
            };
            _PointsScrollView.Controls.Add(_GridPoints);
            _PointsScrollView.RenderAreaChanged += _PointsScrollView_RenderAreaChanged;

            _SelectedPointPropertiesBackground = new Skill.Framework.UI.Box()
            {
                Row = 2, Column = 0, ColumnSpan = 2
            };
            _PnlPoperties = new Skill.Framework.UI.StackPanel()
            {
                Row = 2, Column = 0, ColumnSpan = 2, Orientation = Skill.Framework.UI.Orientation.Vertical, Padding = new Skill.Framework.UI.Thickness(2)
            };
            _VFValue = new Vector3Field()
            {
                Height = 20
            }; _VFValue.Label.text = "Position";
            _FFTime = new FloatField()
            {
                Height = 16, Margin = new Skill.Framework.UI.Thickness(0, 2, 0, 4)
            }; _FFTime.Label.text = "Time";

            _PnlPoperties.Controls.Add(_FFTime);
            _PnlPoperties.Controls.Add(_VFValue);

            _ToolsBackground = new Skill.Framework.UI.Box()
            {
                Row = 3, Column = 0, ColumnSpan = 2, Margin = new Framework.UI.Thickness(0, 2, 0, 0)
            };
            _PnlTools = new Skill.Framework.UI.Grid()
            {
                Row = 3, Column = 0, ColumnSpan = 2, Padding = new Skill.Framework.UI.Thickness(2), Margin = _ToolsBackground.Margin
            };
            _PnlTools.ColumnDefinitions.Add(1, Skill.Framework.UI.GridUnitType.Star);
            _PnlTools.ColumnDefinitions.Add(1, Skill.Framework.UI.GridUnitType.Star);
            _PnlTools.ColumnDefinitions.Add(2, Skill.Framework.UI.GridUnitType.Star);

            _PnlTools.RowDefinitions.Add(24, Framework.UI.GridUnitType.Pixel);
            _PnlTools.RowDefinitions.Add(30, Framework.UI.GridUnitType.Pixel);
            _PnlTools.RowDefinitions.Add(30, Framework.UI.GridUnitType.Pixel);
            _PnlTools.RowDefinitions.Add(30, Framework.UI.GridUnitType.Pixel);
            _PnlTools.RowDefinitions.Add(30, Framework.UI.GridUnitType.Pixel);

            _LmGroundLayer = new LayerMaskField()
            {
                Row = 0, Column = 0, ColumnSpan = 3, Layers = _Path.GroundLayer, Margin = new Framework.UI.Thickness(2, 1)
            }; _LmGroundLayer.Label.text = "Ground Layer";
            _BtnGroundSelected           = new Button()
            {
                Row = 1, Column = 0, ColumnSpan = 2, Margin = new Framework.UI.Thickness(0, 0, 0, 4)
            }; _BtnGroundSelected.Content.text = "Ground Selected"; _BtnGroundSelected.Content.tooltip = "put selected on ground";
            _BtnGroundAll = new Button()
            {
                Row = 1, Column = 2, Margin = new Framework.UI.Thickness(0, 0, 0, 4)
            }; _BtnGroundAll.Content.text = "Ground All"; _BtnGroundAll.Content.tooltip = "put all points on ground";
            _PnlTools.Controls.Add(_LmGroundLayer);
            _PnlTools.Controls.Add(_BtnGroundSelected);
            _PnlTools.Controls.Add(_BtnGroundAll);

            _LblFLinearTime = new LabelField()
            {
                Row = 2, Column = 0, Margin = new Skill.Framework.UI.Thickness(0, 4)
            }; _LblFLinearTime.Label.text = "Time";
            _FFLinearTime = new FloatField()
            {
                Row = 2, Column = 1, Margin = new Skill.Framework.UI.Thickness(0, 4), Value = _Path.PathTime
            };
            _BtnSetLinearTime = new Button()
            {
                Row = 2, Column = 2, Margin = new Skill.Framework.UI.Thickness(2, 2)
            }; _BtnSetLinearTime.Content.text = "Set Time by Distance"; _BtnSetLinearTime.Content.tooltip = "Set time of nodes by relative distance";
            _PnlTools.Controls.Add(_LblFLinearTime);
            _PnlTools.Controls.Add(_FFLinearTime);
            _PnlTools.Controls.Add(_BtnSetLinearTime);


            _InterpolationsField = new UI.IntSlider()
            {
                Value = _Path.Interpolations, Row = 3, Column = 0, ColumnSpan = 3, Margin = new Skill.Framework.UI.Thickness(0, 4), MinValue = 2, MaxValue = 20
            }; _InterpolationsField.Label.text = "Interpolations";
            _BtnSmoothPath = new Button()
            {
                Row = 4, Column = 0, ColumnSpan = 2, Margin = new Skill.Framework.UI.Thickness(0, 4)
            }; _BtnSmoothPath.Content.text = "Smooth Path";
            _BtnFrameSelected = new Button()
            {
                Row = 4, Column = 2, ColumnSpan = 1, Margin = new Skill.Framework.UI.Thickness(0, 4)
            }; _BtnFrameSelected.Content.text = "Frame Selected";

            _PnlTools.Controls.Add(_InterpolationsField);
            _PnlTools.Controls.Add(_BtnSmoothPath);
            _PnlTools.Controls.Add(_BtnFrameSelected);

            _ChangeCheck.Controls.Add(_BtnAdd);
            _ChangeCheck.Controls.Add(_BtnRemove);
            _ChangeCheck.Controls.Add(_PointsScrollView);
            _ChangeCheck.Controls.Add(_SelectedPointPropertiesBackground);
            _ChangeCheck.Controls.Add(_PnlPoperties);
            _ChangeCheck.Controls.Add(_ToolsBackground);
            _ChangeCheck.Controls.Add(_PnlTools);

            _Frame = new Skill.Framework.UI.Frame("EditorFrame");
            _Frame.Grid.Controls.Add(_ChangeCheck);

            _BtnAdd.Click               += _BtnAdd_Click;
            _BtnRemove.Click            += _BtnRemove_Click;
            _ChangeCheck.Changed        += _ChangeCheck_Changed;
            _GridPoints.SelectedChanged += _GridPoints_SelectedChanged;

            _VFValue.ValueChanged        += SelectedPoint_ValueChanged;
            _LmGroundLayer.LayersChanged += _LmGroundLayer_LayersChanged;
            _BtnGroundSelected.Click     += _BtnGroundSelected_Click;
            _BtnGroundAll.Click          += _BtnGroundAll_Click;

            _FFLinearTime.ValueChanged += _FFLinearTime_ValueChanged;
            _BtnSetLinearTime.Click    += _BtnSetLinearTime_Click;
            _FFTime.ValueChanged       += SelectedPoint_ValueChanged;

            _InterpolationsField.ValueChanged += _InterpolationsField_ValueChanged;
            _BtnSmoothPath.Click    += _BtnSmoothPath_Click;
            _BtnFrameSelected.Click += _BtnFrameSelected_Click;


            ValidateSelectedIndex();
        }