Esempio n. 1
0
        public TextureBrushGrid(int brushSize = 64)
        {
            LoadBrushes(brushSize);
            _BrushBg = new Skill.Framework.UI.Box()
            {
                Row = 0, Column = 0
            };
            _BrushSelectionGrid = new Skill.Framework.UI.SelectionGrid()
            {
                Row = 0, Column = 0, XCount = 10
            };
            for (int i = 0; i < _Brushes.Length; i++)
            {
                Skill.Framework.UI.SelectionGridItem item = new Skill.Framework.UI.SelectionGridItem();
                item.Name          = _Brushes[i].Brush.name;
                item.Content.image = _Brushes[i].Brush;
                _BrushSelectionGrid.Items.Add(item);
            }

            this.Controls.Add(_BrushBg);
            this.Controls.Add(_BrushSelectionGrid);

            _TryToLoadStyle = false;
        }
Esempio n. 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);  // _BtnAdd , _BtnRemove
            _ChangeCheck.RowDefinitions.Add(164, Skill.Framework.UI.GridUnitType.Pixel); // _PointsScrollView
            _ChangeCheck.RowDefinitions.Add(86, Skill.Framework.UI.GridUnitType.Pixel);  // _PnlPoperties
            _ChangeCheck.RowDefinitions.Add(130, 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)
            };

            _FFTime = new FloatField()
            {
                Height = 16, Margin = new Skill.Framework.UI.Thickness(0, 2, 0, 4)
            }; _FFTime.Label.text = "Time";
            _VFValue = new Vector3Field()
            {
                Height = 20
            }; _VFValue.Label.text = "Position";
            _VFInTangent           = new Vector3Field()
            {
                Height = 20
            }; _VFInTangent.Label.text = "InTangent";
            _VFOutTangent = new Vector3Field()
            {
                Height = 20
            }; _VFOutTangent.Label.text = "OutTangent";

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

            _PnlTools = new Skill.Framework.UI.Grid()
            {
                Row = 5, Column = 0, ColumnSpan = 2, Padding = new Skill.Framework.UI.Thickness(2)
            };
            _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(1, Skill.Framework.UI.GridUnitType.Star); // _LmGroundLayer
            _PnlTools.RowDefinitions.Add(1, Skill.Framework.UI.GridUnitType.Star); // _BtnGroundAll , _BtnGroundSelected
            _PnlTools.RowDefinitions.Add(1, Skill.Framework.UI.GridUnitType.Star); // _LblFLinearTime
            _PnlTools.RowDefinitions.Add(1, Skill.Framework.UI.GridUnitType.Star);
            _PnlTools.RowDefinitions.Add(1, Skill.Framework.UI.GridUnitType.Star);

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

            _LblFLinearTime = new LabelField()
            {
                Row = 2, Column = 0, Margin = new Skill.Framework.UI.Thickness(0, 2)
            }; _LblFLinearTime.Label.text = "Time";
            _FFLinearTime = new FloatField()
            {
                Row = 2, Column = 1, Margin = new Skill.Framework.UI.Thickness(0, 2), 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";

            _SliSmoothValue = new Skill.Editor.UI.Slider()
            {
                Row = 3, Column = 0, ColumnSpan = 3, MinValue = 0.0f, MaxValue = 1.0f, Value = _Path.SmoothValue
            }; _SliSmoothValue.Label.text = "Smooth Value";
            _BtnSmoothCurve = new Button()
            {
                Row = 4, Column = 0, ColumnSpan = 2, Margin = new Skill.Framework.UI.Thickness(2, 2)
            }; _BtnSmoothCurve.Content.text = "Smooth Curve"; _BtnSmoothCurve.Content.tooltip = "Smooth the in and out tangents of the keys.";
            _BtnSmoothPoint = new Button()
            {
                Row = 4, Column = 2, Margin = new Skill.Framework.UI.Thickness(2, 2)
            }; _BtnSmoothPoint.Content.text = "Smooth Point"; _BtnSmoothPoint.Content.tooltip = "Smooth the in and out tangents of the selected key.";

            _PnlTools.Controls.Add(_LmGroundLayer);
            _PnlTools.Controls.Add(_BtnGroundSelected);
            _PnlTools.Controls.Add(_BtnGroundAll);
            _PnlTools.Controls.Add(_LblFLinearTime);
            _PnlTools.Controls.Add(_FFLinearTime);
            _PnlTools.Controls.Add(_BtnSetLinearTime);
            _PnlTools.Controls.Add(_SliSmoothValue);
            _PnlTools.Controls.Add(_BtnSmoothPoint);
            _PnlTools.Controls.Add(_BtnSmoothCurve);


            _ChangeCheck.Controls.Add(_BtnAdd);
            _ChangeCheck.Controls.Add(_BtnRemove);
            _ChangeCheck.Controls.Add(_PointsScrollView);
            _ChangeCheck.Controls.Add(_SelectedPointPropertiesBackground);
            _ChangeCheck.Controls.Add(_PnlPoperties);
            _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;

            _FFTime.ValueChanged       += SelectedPoint_ValueChanged;
            _VFValue.ValueChanged      += SelectedPoint_ValueChanged;
            _VFInTangent.ValueChanged  += SelectedPoint_ValueChanged;
            _VFOutTangent.ValueChanged += SelectedPoint_ValueChanged;

            _FFLinearTime.ValueChanged += _FFLinearTime_ValueChanged;
            _BtnSmoothPoint.Click      += _BtnSmoothPoint_Click;
            _BtnSmoothCurve.Click      += _BtnSmoothCurve_Click;
            _BtnSetLinearTime.Click    += _BtnSetLinearTime_Click;

            _SliSmoothValue.ValueChanged += _SliSmoothValue_ValueChanged;

            _LmGroundLayer.LayersChanged += _LmGroundLayer_LayersChanged;
            _BtnGroundSelected.Click     += _BtnGroundSelected_Click;
            _BtnGroundAll.Click          += _BtnGroundAll_Click;
        }