Exemple #1
0
        /// <summary>
        /// MouseDragEvent
        /// </summary>
        /// <param name="args">Args</param>
        protected override void MouseDragEvent(MouseMoveEventArgs args)
        {
            if (args.Button == MouseButton.Left)
            {
                if (TimeLine != null)
                {
                    _DeltaX += args.Delta.x;
                    double time = _TimeLine.GetSnapedTime(_StartTime + _TimeLine.GetDeltaTime(_DeltaX));
                    if (time < _TimeLine.MinTime)
                    {
                        time = _TimeLine.MinTime;
                    }
                    else if (time > _TimeLine.MaxTime)
                    {
                        time = _TimeLine.MaxTime;
                    }

                    OwnerEvent.FireTime = time;
                    OnLayoutChanged();
                    EditorFrame.RepaintParentEditorWindow(this);
                    args.Handled = true;
                }
            }
            base.MouseDragEvent(args);
        }
Exemple #2
0
 /// <summary>
 /// Zoom time line
 /// </summary>
 /// <param name="deltaTime">delta time to zoom ( negative for zoom out, positive to zoom in)</param>
 public void Zoom(double deltaTime)
 {
     deltaTime *= 0.5f;
     if (deltaTime < 0)
     {
         StartVisible += deltaTime;
         EndVisible   -= deltaTime;
     }
     else
     {
         EndVisible   -= deltaTime;
         StartVisible += deltaTime;
     }
     EditorFrame.RepaintParentEditorWindow(this);
 }
Exemple #3
0
 /// <summary>
 /// Scroll time line
 /// </summary>
 /// <param name="deltaTime">delta time to scroll</param>
 public void Scroll(double deltaTime)
 {
     if (deltaTime < 0)
     {
         double preStartTime = StartVisible;
         StartVisible += deltaTime;
         EndVisible   += StartVisible - preStartTime;
     }
     else
     {
         double preEndTime = EndVisible;
         EndVisible   += deltaTime;
         StartVisible += EndVisible - preEndTime;
     }
     EditorFrame.RepaintParentEditorWindow(this);
 }
Exemple #4
0
        private void CreateUI()
        {
            _RefreshStyles      = true;
            _Frame              = new Skill.Editor.UI.EditorFrame("Frame", this);
            _Frame.Grid.Padding = new Thickness(2);

            _Frame.Grid.RowDefinitions.Add(20, Skill.Framework.UI.GridUnitType.Pixel);
            _Frame.Grid.RowDefinitions.Add(1, Skill.Framework.UI.GridUnitType.Star);

            CreateAudioPanel();
            CreateFieldPanel();
            CreateTextPanel();

            _Frame.Grid.Controls.Add(_FieldPanel);
            _Frame.Grid.Controls.Add(_AudioPanel);
            _Frame.Grid.Controls.Add(_TextPanel);

            SetLayout(0);
        }
Exemple #5
0
    private void CreateUI()
    {
        _Frame = new Skill.Editor.UI.EditorFrame("Frame", this);
        _Frame.Grid.RowDefinitions.Add(140, Skill.Framework.UI.GridUnitType.Pixel); // Panel
        _Frame.Grid.RowDefinitions.Add(1, Skill.Framework.UI.GridUnitType.Star);    // Empty
        _Frame.Grid.Padding = new Skill.Framework.UI.Thickness(2, 4);

        _Panel = new Skill.Framework.UI.Grid();
        _Panel.RowDefinitions.Add(24, Skill.Framework.UI.GridUnitType.Pixel); // _UnitsField
        _Panel.RowDefinitions.Add(36, Skill.Framework.UI.GridUnitType.Pixel); // _BtnOrganizeByPrefab
        _Panel.RowDefinitions.Add(36, Skill.Framework.UI.GridUnitType.Pixel); // _BtnOrganizeByUnits
        _Panel.RowDefinitions.Add(36, Skill.Framework.UI.GridUnitType.Pixel); // _BtnRemoveEmptyObjects
        _Panel.RowDefinitions.Add(4, Skill.Framework.UI.GridUnitType.Pixel);  // empty
        _Frame.Controls.Add(_Panel);

        var margin = new Skill.Framework.UI.Thickness(0, 4, 0, 0);

        Grid g = new Grid()
        {
            Row = 0, Column = 0, Margin = margin
        };

        g.ColumnDefinitions.Add(40, GridUnitType.Pixel);
        g.ColumnDefinitions.Add(1, GridUnitType.Star);
        _UnitsLabel = new Label()
        {
            Column = 0, Text = "Units"
        };
        g.Controls.Add(_UnitsLabel);

        _BtnOrganizeByPrefab = new Button()
        {
            Row = 1, Column = 0, Margin = margin
        }; _BtnOrganizeByPrefab.Content.text = "Organize by prefab";
        _Panel.Controls.Add(_BtnOrganizeByPrefab);

        _UnitsField = new Skill.Editor.UI.Vector3Field()
        {
            Column = 1, Value = _UnitLength
        };
        g.Controls.Add(_UnitsField);

        _Panel.Controls.Add(g);

        _BtnOrganizeByUnits = new Button()
        {
            Row = 2, Column = 0, Margin = margin
        }; _BtnOrganizeByUnits.Content.text = "Organize by units";
        _Panel.Controls.Add(_BtnOrganizeByUnits);

        _BtnRemoveEmptyObjects = new Button()
        {
            Row = 3, Column = 0, Margin = margin
        }; _BtnRemoveEmptyObjects.Content.text = "Delete empty objects";
        _Panel.Controls.Add(_BtnRemoveEmptyObjects);

        _BtnOrganizeByPrefab.Click   += _BtnOrganizeByPrefab_Click;
        _BtnOrganizeByUnits.Click    += _BtnOrganizeByUnits_Click;
        _BtnRemoveEmptyObjects.Click += _BtnRemoveEmptyObjects_Click;
        _UnitsField.ValueChanged     += _UnitsField_ValueChanged;
    }