Example #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();
    }
Example #2
0
    public void OnEnable()
    {
        _guiEventAction = null;
        if (_icons.IsNullOrEmpty())
        {
            _icons = new Dictionary <string, Texture2D>
            {
                { "plus", Resources.Load("icons/plus") as Texture2D },
                { "minus", Resources.Load("icons/minus") as Texture2D },
                { "reset", Resources.Load("icons/arrow_repeat") as Texture2D },
                { "wrap", Resources.Load("icons/wrap") as Texture2D },
                { "wrapscale", Resources.Load("icons/wrapscale") as Texture2D }
            }
        }
        ;

        smallButton = new GUIStyle
        {
            fixedWidth  = 16,
            fixedHeight = 16,
            padding     = new RectOffset(0, 0, 0, 0),
            margin      = new RectOffset(5, 0, 0, 0)
        };
        bigButton = new GUIStyle
        {
            fixedWidth  = 32,
            fixedHeight = 32,
            padding     = new RectOffset(0, 0, 0, 0),
            margin      = new RectOffset(5, 0, 0, 0)
        };
        headerStyle = new GUIStyle {
            fontSize = 12
        };
        titleStyle = new GUIStyle
        {
            fontSize = 15,
            margin   = new RectOffset(10, 10, 0, 10)
        };

        foldoutElement     = EditorPrefs.GetBool("hoohTool_foldoutElement", true);
        foldoutMacros      = EditorPrefs.GetBool("hoohTool_foldoutMacros", true);
        foldoutProbeset    = EditorPrefs.GetBool("hoohTool_foldoutProbeset", true);
        foldoutScaffolding = EditorPrefs.GetBool("hoohTool_foldoutScaffolding", true);
        foldoutMod         = EditorPrefs.GetBool("hoohTool_foldoutMod", true);
        foldoutBundler     = EditorPrefs.GetBool("hoohTool_foldoutBundler", true);

        Category         = EditorPrefs.GetInt("hoohTool_category");      // this is mine tho
        SideloaderString = EditorPrefs.GetString("hoohTool_sideloadString");
        CategorySmall    = EditorPrefs.GetInt("hoohTool_categorysmall"); // this is mine tho
        GameExportPath   = EditorPrefs.GetString("hoohTool_exportPath");
        sliderValue      = EditorPrefs.GetFloat("hoohTool_probeStrength");
        LightScaleSize   = 9f;
    }
Example #3
0
 protected void Run(GUIEventAction dEventAction)
 {
     _eventAction = dEventAction;
 }
Example #4
0
 protected void SetEvent(GUIEventAction func)
 {
     _guiEventAction = null;
     _guiEventAction = func;
 }
Example #5
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;
    }