コード例 #1
0
    public override void OnInspectorGUI()
    {
        // Update the serializedProperty - always do this in the beginning of OnInspectorGUI.
        serializedObject.Update();
        yAxisSO.Update();
        if (!nullYaxis2)
        {
            yAxis2SO.Update();
        }
        xAxisSO.Update();

        if (!nullYaxis2 && graph.axesType == WMG_Axis_Graph.axesTypes.DUAL_Y)
        {
            string[] toolBarButtonNames = System.Enum.GetNames(typeof(eTabType));

            m_tabType = (eTabType)GUILayout.Toolbar((int)m_tabType, toolBarButtonNames);

            switch (m_tabType)
            {
            case eTabType.Core: DrawCore(); break;

            case eTabType.YAxis: DrawYAxis(); break;

            case eTabType.YAxis2: DrawYAxis2(); break;

            case eTabType.XAxis: DrawXAxis(); break;

            case eTabType.Tooltip: DrawTooltip(); break;

            case eTabType.Anim: DrawAnim(); break;

            case eTabType.Misc: DrawMisc(); break;
            }
        }
        else
        {
            string[] toolBarButtonNames = System.Enum.GetNames(typeof(eTabTypeNullYaxis2));

            m_tabTypeNullYaxis2 = (eTabTypeNullYaxis2)GUILayout.Toolbar((int)m_tabTypeNullYaxis2, toolBarButtonNames);

            switch (m_tabTypeNullYaxis2)
            {
            case eTabTypeNullYaxis2.Core: DrawCore(); break;

            case eTabTypeNullYaxis2.YAxis: DrawYAxis(); break;

            case eTabTypeNullYaxis2.XAxis: DrawXAxis(); break;

            case eTabTypeNullYaxis2.Tooltip: DrawTooltip(); break;

            case eTabTypeNullYaxis2.Anim: DrawAnim(); break;

            case eTabTypeNullYaxis2.Misc: DrawMisc(); break;
            }
        }

        // In editor mode, update graphics based on graph width and height
        if (!Application.isPlaying)
        {
            UpdateSceneView();
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(graph);
            EditorUtility.SetDirty(yAxisSO.targetObject);
            if (!nullYaxis2)
            {
                EditorUtility.SetDirty(yAxis2SO.targetObject);
            }
            EditorUtility.SetDirty(xAxisSO.targetObject);

            if (!Application.isPlaying)
            {
                if (previousOrientationType != graph.orientationType)
                {
                    graph.UpdateOrientation();
                }
            }
        }
        previousOrientationType = graph.orientationType;

        // Apply changes to the serializedProperty - always do this in the end of OnInspectorGUI.
        serializedObject.ApplyModifiedProperties();
        yAxisSO.ApplyModifiedProperties();
        if (!nullYaxis2)
        {
            yAxis2SO.ApplyModifiedProperties();
        }
        xAxisSO.ApplyModifiedProperties();
    }