DoTimeControl() public method

public DoTimeControl ( Rect rect ) : void
rect UnityEngine.Rect
return void
Ejemplo n.º 1
0
        public void AvatarTimeControlGUI(Rect rect)
        {
            Rect timeControlRect = rect;

            timeControlRect.height = kTimeControlRectHeight;

            timeControl.DoTimeControl(timeControlRect);

            // Show current time in seconds:frame and in percentage
            rect.y = rect.yMax - 20;
            float time = timeControl.currentTime - timeControl.startTime;

            EditorGUI.DropShadowLabel(new Rect(rect.x, rect.y, rect.width, 20),
                                      UnityString.Format("{0,2}:{1:00} ({2:000.0%}) Frame {3}", (int)time, Repeat(Mathf.FloorToInt(time * fps), fps), timeControl.normalizedTime, Mathf.FloorToInt(timeControl.currentTime * fps))
                                      );
        }
Ejemplo n.º 2
0
        public void AvatarTimeControlGUI(Rect rect)
        {
            const float kSliderWidth    = 150f;
            const float kSpacing        = 4f;
            Rect        timeControlRect = rect;

            // background
            GUI.Box(rect, GUIContent.none, EditorStyles.toolbar);

            timeControlRect.height = kTimeControlRectHeight;
            timeControlRect.xMax  -= kSliderWidth;

            Rect sliderControlRect = rect;

            sliderControlRect.height = kTimeControlRectHeight;
            sliderControlRect.yMin  += 1;
            sliderControlRect.yMax  -= 1;
            sliderControlRect.xMin   = sliderControlRect.xMax - kSliderWidth + kSpacing;

            timeControl.DoTimeControl(timeControlRect);
            Rect labelRect = new Rect(new Vector2(rect.x, rect.y), EditorStyles.toolbarLabel.CalcSize(EditorGUIUtility.TrTempContent("xxxxxx")));;

            labelRect.x    = rect.xMax - labelRect.width;
            labelRect.yMin = rect.yMin;
            labelRect.yMax = rect.yMax;

            sliderControlRect.xMax = labelRect.xMin;

            EditorGUI.BeginChangeCheck();
            timeControl.playbackSpeed = PreviewSlider(sliderControlRect, timeControl.playbackSpeed, 0.03f);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetFloat(kSpeedPref, timeControl.playbackSpeed);
            }
            GUI.Label(labelRect, timeControl.playbackSpeed.ToString("f2", CultureInfo.InvariantCulture.NumberFormat) + "x", EditorStyles.toolbarLabel);

            // Show current time in seconds:frame and in percentage
            rect.y = rect.yMax - 24;
            float time = timeControl.currentTime - timeControl.startTime;

            EditorGUI.DropShadowLabel(new Rect(rect.x, rect.y, rect.width, 20),
                                      UnityString.Format("{0,2}:{1:00} ({2:000.0%}) Frame {3}", (int)time, Repeat(Mathf.FloorToInt(time * fps), fps), timeControl.normalizedTime, Mathf.FloorToInt(timeControl.currentTime * fps))
                                      );
        }