Exemplo n.º 1
0
        public static System.Type InspectorTypeForAction(GPAction action)
        {
            System.Type actionType    = action.GetType();
            System.Type inspectorType = null;

            while (inspectorType == null && actionType != typeof(GPAction))
            {
                if (s_gpactionInspectorMap.TryGetValue(actionType, out inspectorType))
                {
                    return(inspectorType);
                }

                actionType = actionType.BaseType;
            }

            return(typeof(GPActionDefaultInspector));
        }
Exemplo n.º 2
0
        protected virtual void DisplayBlueprint()
        {
            ComputeScrollView();

            float xInspector = position.width - m_inspectorWidth;

            Handles.BeginGUI();

            GUILayout.BeginArea(new Rect(0, 0, xInspector, position.height));

            m_blueprintScrollPosition = GUI.BeginScrollView(new Rect(0, 0, xInspector, position.height),
                                                            m_blueprintScrollPosition,
                                                            m_blueprintScrollView);

            BeginWindows();

            GUI.backgroundColor = m_eventHandlerColor;

            m_handler._windowRect = GUI.Window(-1, m_handler._windowRect, DisplayHandler, "Event");

            for (int i = 0; i < m_actions.Length; i++)
            {
                GPAction box = m_actions[i];

                SetBoxColor(box);

                string name = GetDisplayName(box.GetType());

                Rect newRect = GUI.Window(i, box._windowRect, DisplayAction, name);

                if (box._windowRect != newRect)
                {
                    box._windowRect = newRect;
                    m_actionInspectors[i].SerialObject.FindProperty("_windowRect").rectValue = newRect;
                }
            }

            EndWindows();

            GUI.EndScrollView();

            GUILayout.EndArea();

            Handles.EndGUI();
        }