Ejemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        EditorGUI.BeginChangeCheck();
        DrawInspectorGUI();
        var endChangeCheck = EditorGUI.EndChangeCheck();

        try
        {
            _eventAction?.Invoke();
        }
        catch (Exception e)
        {
            Debug.LogError(e);
            // ignored
        }
        finally
        {
            _eventAction = null;
        }

        if (!endChangeCheck)
        {
            return;
        }
        OnChange();
        serializedObject.ApplyModifiedProperties();
    }
Ejemplo n.º 2
0
    private void OnGUI()
    {
        var serializedObject = new SerializedObject(this);

        EditorGUI.BeginChangeCheck();
        EditorGUILayout.BeginVertical();
        // Draw Top Help/Tutorial Boxes
        GUILayout.BeginHorizontal("box");


        if (GUILayout.Button("Check Updates"))
        {
            Application.OpenURL("https://github.com/hooh-hooah/ModdingTool/tree/release/");
        }
        if (GUILayout.Button("Tutorials"))
        {
            Application.OpenURL("https://hooh-hooah.github.io/");
        }
        GUILayout.EndHorizontal();

        TabSelector = (MenuMode)GUILayout.Toolbar((int)TabSelector, new[] { "Useful Macros", "Mod Setup", "Mod Integration" }, Style.ButtonTab);

        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(0), GUILayout.Height(0));
        {
            switch (TabSelector)
            {
            case MenuMode.ModSetup:
                DrawModSetup(serializedObject);
                DrawXMLGenerator(serializedObject);
                break;

            case MenuMode.ModIntegration:
                DrawThumbnailUtility(serializedObject);
                DrawXMLHelper(serializedObject);
                DrawModBuilder(serializedObject);
                break;

            case MenuMode.UnityMacro:
                DrawLightProbeSetting(serializedObject);
                DrawUnityUtility(serializedObject);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        EditorGUILayout.EndScrollView();
        // End Scroll Positions
        EditorGUILayout.EndVertical();
        var endChangeCheck = EditorGUI.EndChangeCheck();


        try
        {
            _guiEventAction?.Invoke();
        }
        catch (Exception e)
        {
            Debug.LogError(e);
            // ignored
        }
        finally
        {
            _guiEventAction = null;
            EditorUtility.ClearProgressBar();
        }

        if (!endChangeCheck)
        {
            return;
        }
        serializedObject.ApplyModifiedProperties();
        isDirty = true;
    }