Exemple #1
0
        /// <summary>
        /// Create a ZoomPanel
        /// </summary>
        /// <param name="view">instance of a TimeLineView implemented class</param>
        public TimeLine(TimeLineView view)
        {
            if (view == null)
            {
                throw new System.InvalidOperationException("Invalid TimeLineView");
            }
            _View          = view;
            _View.TimeLine = this;

            if (UnityEditor.EditorGUIUtility.isProSkin)
            {
                Background = new Color(0.15f, 0.15f, 0.15f, 1.0f);
            }
            else
            {
                Background = new Color(0.55f, 0.55f, 0.55f, 1.0f);
            }

            this.ExtendTime        = true;
            this._SelectionEnable  = true;
            this._StartVisibleTime = 0;
            this._EndVisibleTime   = 1.0;
            this._MaxTime          = 1.0;

            //this.Padding = new Thickness(2);

            this.RowDefinitions.Add(24, GridUnitType.Pixel);
            this.RowDefinitions.Add(4, GridUnitType.Pixel);
            this.RowDefinitions.Add(1, GridUnitType.Star);

            _BtnTimeStyle = new Button()
            {
                Row = 0, Column = 0, HorizontalAlignment = Framework.UI.HorizontalAlignment.Right, Width = 16, Margin = new Thickness(0, 1)
            };
            _BtnTimeStyle.Style         = new GUIStyle();
            _BtnTimeStyle.Style.padding = new RectOffset(1, 1, 2, 2);

            _BtnTimeStyle.Click += _BtnTimeStyle_Click;

            _Timebar = new TimeBar(this)
            {
                Row = 0, Column = 0, Margin = new Thickness(0, 0, 16, 0)
            };

            _View.Row                = 2;
            _View.Column             = 0;
            _View.ScrollbarThickness = 16;
            _View.Padding            = new Thickness(0, 0, 16, 0);

            this.Controls.Add(_BtnTimeStyle);
            this.Controls.Add(_Timebar);
            this.Controls.Add(_View);
        }
Exemple #2
0
 /// <summary>
 /// Get closest snap time to specified time
 /// </summary>
 /// <param name="time">Time</param>
 /// <returns>Snapped time</returns>
 public double GetSnapedTime(double time)
 {
     return(TimeBar.GetSnapedTime(time));
 }
Exemple #3
0
 /// <summary>
 /// Get time at mouse position
 /// </summary>
 /// <param name="mousePosX">MousePosition.x</param>
 /// <returns>time</returns>
 public double GetTime(float mousePosX)
 {
     return(TimeBar.GetTime(mousePosX));
 }
Exemple #4
0
 /// <summary>
 /// Convert delta pixel to delta time base on current zoom
 /// </summary>
 /// <param name="deltaPixel">delta pixel</param>
 /// <returns></returns>
 public double GetDeltaTime(float deltaPixel)
 {
     return(TimeBar.GetDeltaTime(deltaPixel));
 }