void DrawLine(Track track, ITimeConverter converter)
        {
            var x = converter.TimeToPixel(0);
            var w = converter.TimeToPixel(Time.unscaledTime - GameDebuggerDatabase.StartRecordingTime) - x;

            EditorGUI.DrawRect(new Rect(x, 24, w, 1), m_LineColor);
        }
        protected override void DrawItem(Track track, ITimeConverter converter)
        {
            float lastTime = 0;
            var   count    = m_LayerNames.Count;
            var   oldColor = GUI.backgroundColor;

            for (int i = 0; i < count; i++)
            {
                var leftTime = converter.TimeToPixel(m_LayerNames[i].time);

                var nextTime = i + 1 == count
                    ? Time.unscaledTime - GameDebuggerDatabase.StartRecordingTime
                    : m_LayerNames[i + 1].time;

                var rightTime = converter.TimeToPixel(nextTime);
                var rect      = track.contentRect;
                rect.xMin           = leftTime;
                rect.xMax           = rightTime;
                rect.yMax          -= 5;
                GUI.backgroundColor = StringToColor(m_LayerNames[i].name);
                GUI.Box(rect, m_LayerNames[i].name, EditorStyles.helpBox);
            }

            GUI.backgroundColor = oldColor;
        }
 void DrawKeys(ITimeConverter converter)
 {
     foreach (var frameId in m_FrameIds)
     {
         var frameTime    = GameDebuggerDatabase.GetRecords(frameId).time;
         var keyPixelXPos = converter.TimeToPixel(frameTime);
         EditorGUI.DrawRect(new Rect(keyPixelXPos - 3, 22, 6, 6), m_KeyColor);
     }
 }
Пример #4
0
        static Rect GetRectForScreenshot(ITimeConverter converter, ScreenshotForTime screenshot)
        {
            var pixel = converter.TimeToPixel(screenshot.time);

            if (screenshot.screenshot != null)
            {
                var width = screenshot.screenshot.width * 45 / screenshot.screenshot.height;
                return(new Rect(pixel, 0, width, 45));
            }
            return(Rect.zero);
        }
Пример #5
0
        void DrawKeys(Track track, ITimeConverter converter)
        {
            if (m_FrameIds.Count == 0)
            {
                return;
            }

            // Get max velocity.
            var maxVelocity = Mathf.Max(m_Velocities.Max(v => v), 0.1f);

            var height = track.contentRect.height;

            var prevVelocity       = m_Velocities[0];
            var prevVelocityHeight = 5.0f + (prevVelocity / maxVelocity) * 25.0f;
            var prevFrameTime      = GameDebuggerDatabase.GetRecords(m_FrameIds[0]).time;
            var prevFrameTimeXPos  = converter.TimeToPixel(prevFrameTime);
            var prevFrameTimeYPos  = (height - prevVelocityHeight) / 2.0f;
            var prevColor          = Color.Lerp(m_LowVelocityColor, m_HighVelocityColor, prevVelocity / maxVelocity);

            for (var f = 1; f < m_FrameIds.Count; ++f)
            {
                var frameId       = m_FrameIds[f];
                var frameTime     = GameDebuggerDatabase.GetRecords(frameId).time;
                var frameTimeXPos = converter.TimeToPixel(frameTime);
                EditorGUI.DrawRect(new Rect(prevFrameTimeXPos, prevFrameTimeYPos, frameTimeXPos - prevFrameTimeXPos, prevVelocityHeight), prevColor);

                prevVelocity       = m_Velocities[f];
                prevVelocityHeight = 5.0f + (prevVelocity / maxVelocity) * 25.0f;
                prevFrameTimeXPos  = frameTimeXPos;
                prevFrameTimeYPos  = (height - prevVelocityHeight) / 2.0f;
                prevColor          = Color.Lerp(m_LowVelocityColor, m_HighVelocityColor, prevVelocity / maxVelocity);
            }

            var currentTimeXPos = converter.TimeToPixel(Time.unscaledTime - GameDebuggerDatabase.StartRecordingTime);

            EditorGUI.DrawRect(new Rect(prevFrameTimeXPos, prevFrameTimeYPos, currentTimeXPos - prevFrameTimeXPos, prevVelocityHeight), prevColor);
        }
        public void RefreshPlayheadPosition()
        {
            var pixel = m_TimeConverter.TimeToPixel(m_Time);

            if (pixel > parent.style.positionLeft)
            {
                style.positionLeft = pixel - contentRect.width / 2.0f;
            }

            if (pixel < 150) //ugly hack, sorry
            {
                style.opacity = 0;
            }
            else
            {
                style.opacity = 100;
            }
        }
        protected override void DrawItem(Track track, ITimeConverter converter)
        {
            var oldColor = GUI.color;

            for (int i = 0; i < m_Inputs.Count; i++)
            {
                if (m_Height[i] == -1)
                {
                    m_Height[i] = s_Random.Next(0, 34);
                }

                var pixel = converter.TimeToPixel(m_Inputs[i].time);
                var line  = new Rect(pixel, 0, 3, 45);
                var pos   = new Rect(pixel + 3, m_Height[i], 50, 50);
                foreach (var input in m_Inputs[i].inputs)
                {
                    var color = StringToColor(input);
                    EditorGUI.DrawRect(line, color);
                    GUI.Label(pos, input);
                }
            }

            GUI.color = oldColor;
        }