예제 #1
0
        public override void Draw(EventDataSet dataSet, Rect rect, int startFrame, int frameCount, int inspectFrame, bool expanded, Material material, int maxValue)
        {
            if (dataSet == null)
            {
                return;
            }

            var endTime = startFrame + frameCount;
            var stream  = dataSet.GetStream(Stream);

            if (stream != null)
            {
                var prevCol = UnityEngine.GUI.color;
                UnityEngine.GUI.color = GraphColor;
                if (expanded)
                {
                    var text      = new GUIContent(maxValue.ToString());
                    var size      = UnityEngine.GUI.skin.label.CalcSize(text);
                    var labelRect = new Rect(rect.xMin + 2, rect.yMin, size.x, size.y);
                    EditorGUI.LabelField(labelRect, text);
                    labelRect = new Rect(rect.xMax - size.x, rect.yMin, size.x, size.y);
                    EditorGUI.LabelField(labelRect, text);
                }

                if (inspectFrame != endTime)
                {
                    var val = stream.GetValue(inspectFrame);
                    if (val > 0)
                    {
                        var   text      = new GUIContent(m_LabelFunc(val));
                        var   size      = UnityEngine.GUI.skin.label.CalcSize(text);
                        var   x         = GraphUtility.ValueToPixel(inspectFrame, startFrame, endTime, rect.width);
                        float pixelVal  = GraphUtility.ValueToPixel(val, 0, maxValue, rect.height);
                        var   labelRect = new Rect(rect.xMin + x + 5, Mathf.Max(rect.yMin, rect.yMax - (pixelVal + size.y)), size.x, size.y);
                        UnityEngine.GUI.DrawTexture(labelRect, EditorGUIUtility.whiteTexture, ScaleMode.StretchToFill, true, 0, m_BgColor, 50, 5);
                        EditorGUI.LabelField(labelRect, text, UnityEngine.GUI.skin.label);
                    }
                }
                UnityEngine.GUI.color = prevCol;
            }
        }
예제 #2
0
        public override void Draw(EventDataSet dataSet, Rect rect, int startFrame, int frameCount, int inspectFrame, bool expanded, Material material, int maxValue)
        {
            if (dataSet == null)
            {
                return;
            }

            int endFrame = startFrame + frameCount;

            EventDataSetStream refStream = dataSet.GetStream(Stream);

            if (refStream != null)
            {
                foreach (GraphUtility.Segment s in GraphUtility.IterateSegments(refStream, startFrame, endFrame, IsContinuationOfSegment))
                {
                    if (s.data != 0)
                    {
                        float x = rect.xMin + GraphUtility.ValueToPixel(s.frameStart, startFrame, endFrame, rect.width);
                        float w = (rect.xMin + GraphUtility.ValueToPixel(s.frameEnd, startFrame, endFrame, rect.width)) - x;
                        EditorGUI.DrawRect(new Rect(x, rect.yMin, w, rect.height), GraphColor);
                    }
                }
            }

            EventDataSetStream loadStream = dataSet.GetStream(m_LoadStatusStream);

            if (loadStream != null)
            {
                foreach (GraphUtility.Segment s in GraphUtility.IterateSegments(loadStream, startFrame, endFrame, IsContinuationOfSegment))
                {
                    if (s.data == 0)
                    {
                        float x = rect.xMin + GraphUtility.ValueToPixel(s.frameStart, startFrame, endFrame, rect.width);
                        float w = (rect.xMin + GraphUtility.ValueToPixel(s.frameEnd, startFrame, endFrame, rect.width)) - x;
                        EditorGUI.DrawRect(new Rect(x, rect.yMin, w, rect.height), m_LoadColor);
                    }
                }
            }
        }
예제 #3
0
        public override void Draw(EventDataSet dataSet, Rect rect, int startFrame, int frameCount, int inspectFrame, bool expanded, Material material, int maxValue)
        {
            if (dataSet == null)
            {
                return;
            }

            var endTime = startFrame + frameCount;
            var stream  = dataSet.GetStream(Stream);

            if (stream != null)
            {
                for (int i = stream.samples.Count - 1; i >= 0; --i)
                {
                    var frame = stream.samples[i].frame;
                    if (frame < startFrame)
                    {
                        break;
                    }
                    EditorGUI.DrawRect(new Rect(rect.xMin + GraphUtility.ValueToPixel(frame, startFrame, endTime, rect.width), rect.yMin, 2, rect.height), stream.samples[i].data == 0 ? m_EndColor : GraphColor);
                }
            }
        }