private void OnShowDefaultGUI()
    {
        EditorGUILayout.LabelField("Asset Hunter v1.2.1", EditorStyles.boldLabel);
        //Show logo
        if (m_window && m_window.m_UIWideLogo)
        {
            GUILayout.Label(m_window.m_UIWideLogo);
        }

        //If there is no valid build log
        if (!m_BuildLogExists)
        {
            m_BuildLogExists = AssetHunterHelper.HasBuildLogAvaliable();

            if (!m_BuildLogExists)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(m_UIWarning);
                GUILayout.Label("Go build your project in order for this tool to function...(Ctrl+Shift+B)", EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
            }
        }

        Color  intialGUIColor = GUI.color;
        string buildLogButtonText;

        //If build log up to date
        if (!m_newBuildReady)
        {
            buildLogButtonText = m_BuildLogLoaded ? "Log updated (refresh)" : "Load Build Log (Required)";
            GUI.color          = m_BuildLogLoaded ? Color.green : Color.red;
        }
        //If build log outdated
        else
        {
            buildLogButtonText = "Log outdated(Refresh)";
            GUI.color          = Color.yellow;
        }

        EditorGUILayout.BeginHorizontal();
        float btnMinWidth = 180;

        //Load the Editor build log
        if (GUILayout.Button(buildLogButtonText, GUILayout.MinWidth(btnMinWidth)))
        {
            loadEditorLog();
            return;
        }
        EditorGUILayout.Space();

        GUI.color = Color.cyan;

        if (GUILayout.Button("Open Log", GUILayout.MinWidth(btnMinWidth)))
        {
            System.Diagnostics.Process.Start(AssetHunterHelper.GetLogFolderPath());
        }

        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.Space();
        GUILayout.Label("------------------------------Select Mode------------------------------");
        EditorGUILayout.BeginHorizontal();

        //Choose window state
        GUI.color = (m_WindowState == AssetHunterWindowState.UnusedAssets) ? Color.gray : intialGUIColor;
        if (GUILayout.Button(AssetHunterWindowState.UnusedAssets.ToString(), GUILayout.MinWidth(btnMinWidth)))
        {
            m_WindowState = AssetHunterWindowState.UnusedAssets;
        }
        EditorGUILayout.Space();
        GUI.color = (m_WindowState == AssetHunterWindowState.BuildReport) ? Color.gray : intialGUIColor;
        if (GUILayout.Button(AssetHunterWindowState.BuildReport.ToString(), GUILayout.MinWidth(btnMinWidth)))
        {
            m_WindowState = AssetHunterWindowState.BuildReport;
        }

        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.Space();

        //Reset GUI Color
        GUI.color = intialGUIColor;
    }
Exemplo n.º 2
0
    private void OnShowDefaultGUI()
    {
        EditorGUILayout.LabelField("Asset Hunter v1.3.5", EditorStyles.boldLabel);

        //Show logo
        if (m_window && m_window.m_UIWideLogo)
        {
            GUILayout.Label(m_window.m_UIWideLogo);
        }

        //If there is no valid build log
        if (!m_BuildLogExists)
        {
            m_BuildLogExists = AssetHunterHelper.HasBuildLogAvaliable();

            if (!m_BuildLogExists)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(m_UIWarning);
                GUILayout.Label("Go build your project in order for this tool to function...(Ctrl+Shift+B)", EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
            }
        }

        string buildLogButtonText;

        //Settings
        EditorGUILayout.Space();
        EditorGUILayout.BeginVertical();
        if (GUILayout.Button(new GUIContent("Edit Settings", m_UISettings), GUILayout.Width(btnMinWidth - 70), GUILayout.Height(20)))
        {
            EditorWindow.GetWindow <AssetHunterSettingsWindow>(true, "Asset Hunter Settings");
        }


        EditorGUI.indentLevel = 0;

        //Only show the foldout if we actually have any manually excluded folders or types
        if (settings.HasExcludes())
        {
            bShowExcludeFoldout = EditorGUILayout.Foldout(bShowExcludeFoldout, "Show manual excludes");
        }

        if (bShowExcludeFoldout)
        {
            if (settings.HasDirectoryExcludes())
            {
                EditorGUI.indentLevel = 1;
                EditorGUILayout.LabelField("Excluded Directories", EditorStyles.boldLabel);

                EditorGUI.indentLevel = 2;
                foreach (Object obj in settings.m_DirectoryExcludes)
                {
                    EditorGUILayout.LabelField(AssetDatabase.GetAssetPath(obj), EditorStyles.miniLabel);
                }
            }
            if (settings.HasTypeExcludes())
            {
                EditorGUI.indentLevel = 1;
                EditorGUILayout.LabelField("Excluded Types", EditorStyles.boldLabel);

                EditorGUI.indentLevel = 2;
                foreach (SerializableSystemType sType in settings.m_AssetTypeExcludes)
                {
                    EditorGUILayout.LabelField(sType.Name);
                }
            }
        }

        EditorGUI.indentLevel = 0;
        EditorGUILayout.EndVertical();

        GUILayout.Label("-------------------------------Build Log--------------------------------");

        //If build log up to date
        if (!m_newBuildReady)
        {
            buildLogButtonText = m_BuildLogLoaded ? "Log updated (refresh)" : "Load Build Log (Required)";
            GUI.color          = m_BuildLogLoaded ? Color.green : Color.red;
        }

        //If build log outdated
        else
        {
            buildLogButtonText = "Log outdated(Refresh)";
            GUI.color          = Color.yellow;
        }

        EditorGUILayout.BeginHorizontal();

        //Load the Editor build log
        if (GUILayout.Button(buildLogButtonText, GUILayout.MinWidth(btnMinWidth)))
        {
            loadEditorLog();
            return;
        }
        EditorGUILayout.Space();

        GUI.color = Color.cyan;

        if (GUILayout.Button("Open Log", GUILayout.MinWidth(btnMinWidth)))
        {
            System.Diagnostics.Process.Start(AssetHunterHelper.GetLogFolderPath());
        }

        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.Space();

        GUILayout.Label("------------------------------Select Mode------------------------------");
        EditorGUILayout.BeginHorizontal();

        //Choose window state
        GUI.color = (m_WindowState == AssetHunterWindowState.UnusedAssets) ? Color.gray : m_IntialGUIColor;
        if (GUILayout.Button(AssetHunterWindowState.UnusedAssets.ToString(), GUILayout.MinWidth(btnMinWidth)))
        {
            changeState(AssetHunterWindowState.UnusedAssets);
        }
        EditorGUILayout.Space();
        GUI.color = (m_WindowState == AssetHunterWindowState.BuildReport) ? Color.gray : m_IntialGUIColor;
        if (GUILayout.Button(AssetHunterWindowState.BuildReport.ToString(), GUILayout.MinWidth(btnMinWidth)))
        {
            //AssetHunterHelper.GetAddedComponents();
            changeState(AssetHunterWindowState.BuildReport);
        }

        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.Space();

        //Reset GUI Color
        GUI.color = m_IntialGUIColor;
    }
Exemplo n.º 3
0
    private void OnShowDefaultHeader()
    {
        EditorGUILayout.LabelField("Asset Hunter v2.1.2", EditorStyles.boldLabel);
        EditorGUILayout.BeginVertical();
        EditorGUILayout.BeginHorizontal();

        //BUTTON Settings
        EditorGUILayout.Space();
        // GUI.color = AssetHunterHelper.AH_BLUE;
        if (GUILayout.Button(new GUIContent("Edit settings", m_UISettings), GUILayout.Width(btnMinWidth - 70), GUILayout.Height(20)))
        {
            EditorWindow.GetWindow <AssetHunterSettingsWindow>(true, "Asset Hunter Settings");
        }

        //BUTTON Open Log
        EditorGUILayout.Space();
        //GUI.color = AssetHunterHelper.AH_RED;
        if (GUILayout.Button("Open log", GUILayout.MinWidth(100)))
        {
            System.Diagnostics.Process.Start(AssetHunterHelper.GetLogFolderPath());
        }

        //BUTTON delete empty folders
        EditorGUILayout.Space();
        //GUI.color = AssetHunterHelper.AH_BLUE;
        if (GUILayout.Button("Delete empty folders", GUILayout.MinWidth(120)))
        {
            if (EditorUtility.DisplayDialog("Delete empty folder", "Are you sure you want to delete all empty folders", "Yes", "No"))
            {
                string path        = Application.dataPath;
                int    deleteCount = 0;
                deleteEmptyDirectories(path, ref deleteCount);

                Debug.LogWarning(deleteCount + " empty folders was deleted by Asset Hunter");
            }
        }

        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();

        GUILayout.Space(5);

        EditorGUILayout.BeginHorizontal();

        //BUTTON Settings
        EditorGUILayout.Space();
        if (GUILayout.Button("Scene overview", GUILayout.Width(btnMinWidth - 70), GUILayout.Height(20)))
        {
            EditorWindow.GetWindow <AssetHunterSceneOverview>(true, "Asset Hunter Scene Overview");
        }

        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        GUI.color = m_IntialGUIColor;

        //Show logo
        if (m_window && m_window.m_UIWideLogo)
        {
            GUILayout.Label(m_window.m_UIWideLogo);
        }

        //Only show the foldout if we actually have any manually excluded folders or types
        if (settings != null && settings.HasExcludes())
        {
            bShowExcludeFoldout = EditorGUILayout.Foldout(bShowExcludeFoldout, "Show manual excludes");
        }

        EditorGUILayout.EndVertical();
    }