Esempio n. 1
0
        private bool DrawEventMesh(int curEventIndex, FrameDebuggerEvent curEvent)
        {
            int frameEventMeshID = FrameDebuggerUtility.GetFrameEventMeshID(curEventIndex);

            if (frameEventMeshID == 0)
            {
                return(false);
            }
            UnityEngine.Object @object = EditorUtility.InstanceIDToObject(frameEventMeshID);
            Mesh mesh = @object as Mesh;

            if (mesh == null)
            {
                return(false);
            }
            Rect rect = GUILayoutUtility.GetRect(10f, 10f, new GUILayoutOption[]
            {
                GUILayout.ExpandHeight(true)
            });

            if (rect.width < 64f || rect.height < 64f)
            {
                return(true);
            }
            GameObject gameObjectForEvent = FrameDebuggerWindow.GetGameObjectForEvent(curEventIndex);
            Rect       rect2 = rect;

            rect2.yMin = rect2.yMax - EditorGUIUtility.singleLineHeight * 2f;
            Rect position = rect2;

            rect2.xMin    = rect2.center.x;
            position.xMax = position.center.x;
            if (Event.current.type == EventType.MouseDown)
            {
                if (rect2.Contains(Event.current.mousePosition))
                {
                    EditorGUIUtility.PingObject(frameEventMeshID);
                    Event.current.Use();
                }
                if (gameObjectForEvent != null && position.Contains(Event.current.mousePosition))
                {
                    EditorGUIUtility.PingObject(gameObjectForEvent.GetInstanceID());
                    Event.current.Use();
                }
            }
            this.m_PreviewDir = PreviewGUI.Drag2D(this.m_PreviewDir, rect);
            if (Event.current.type == EventType.Repaint)
            {
                int frameEventMeshSubset = FrameDebuggerUtility.GetFrameEventMeshSubset(curEventIndex);
                this.DrawMeshPreview(curEvent, rect, rect2, mesh, frameEventMeshSubset);
                if (gameObjectForEvent != null)
                {
                    EditorGUI.DropShadowLabel(position, gameObjectForEvent.name);
                }
            }
            return(true);
        }
Esempio n. 2
0
        private bool DrawEventMesh(int curEventIndex, FrameDebuggerEvent curEvent)
        {
            int frameEventMeshID = FrameDebuggerUtility.GetFrameEventMeshID(curEventIndex);

            if (frameEventMeshID == 0)
            {
                return(false);
            }
            Mesh mesh = EditorUtility.InstanceIDToObject(frameEventMeshID) as Mesh;

            if (mesh == null)
            {
                return(false);
            }
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandHeight(true) };
            Rect position             = GUILayoutUtility.GetRect((float)10f, (float)10f, options);

            if ((position.width >= 64f) && (position.height >= 64f))
            {
                GameObject gameObjectForEvent = GetGameObjectForEvent(curEventIndex);
                Rect       meshInfoRect       = position;
                meshInfoRect.yMin = meshInfoRect.yMax - (EditorGUIUtility.singleLineHeight * 2f);
                Rect rect3 = meshInfoRect;
                meshInfoRect.xMin = meshInfoRect.center.x;
                rect3.xMax        = rect3.center.x;
                if (Event.current.type == EventType.MouseDown)
                {
                    if (meshInfoRect.Contains(Event.current.mousePosition))
                    {
                        EditorGUIUtility.PingObject(frameEventMeshID);
                        Event.current.Use();
                    }
                    if ((gameObjectForEvent != null) && rect3.Contains(Event.current.mousePosition))
                    {
                        EditorGUIUtility.PingObject(gameObjectForEvent.GetInstanceID());
                        Event.current.Use();
                    }
                }
                this.m_PreviewDir = PreviewGUI.Drag2D(this.m_PreviewDir, position);
                if (Event.current.type == EventType.Repaint)
                {
                    int frameEventMeshSubset = FrameDebuggerUtility.GetFrameEventMeshSubset(curEventIndex);
                    this.DrawMeshPreview(curEvent, position, meshInfoRect, mesh, frameEventMeshSubset);
                    if (gameObjectForEvent != null)
                    {
                        EditorGUI.DropShadowLabel(rect3, gameObjectForEvent.name);
                    }
                }
            }
            return(true);
        }