Example #1
0
        private static AH_Window initializeWindow()
        {
            //Open ReadMe
            Heureka_PackageDataManagerEditor.SelectReadme();

            m_window = EditorWindow.GetWindow <AH_Window>();

            AH_TreeViewSelectionInfo.OnAssetDeleted += m_window.OnAssetDeleted;
#if UNITY_2018_1_OR_NEWER
            EditorApplication.projectChanged += m_window.OnProjectChanged;
#elif UNITY_5_6_OR_NEWER
            EditorApplication.projectWindowChanged += m_window.OnProjectChanged;
#endif

            if (m_window.buildInfoManager == null)
            {
                m_window.buildInfoManager = ScriptableObject.CreateInstance <AH_BuildInfoManager>();
            }

            m_window.initializeGUIContent();

            //Subscribe to changes to list of ignored items
            AH_SettingsManager.Instance.IgnoreListUpdatedEvent += m_window.OnIgnoreListUpdatedEvent;

            return(m_window);
        }
Example #2
0
        private void doHeader()
        {
            AH_WindowStyler.DrawGlobalHeader(m_window, AH_WindowStyler.clr_Pink, "ASSET HUNTER PRO", true);
            EditorGUILayout.BeginHorizontal();

            bool infoLoaded = (buildInfoManager != null && buildInfoManager.HasSelection);

            if (infoLoaded)
            {
                GUIContent RefreshGUIContent = new GUIContent(guiContentRefresh);
                Color      origColor         = GUI.color;
                if (buildInfoManager.ProjectDirty)
                {
                    GUI.color = AH_WindowStyler.clr_lBlue;
                    RefreshGUIContent.tooltip = String.Format("{0}{1}", RefreshGUIContent.tooltip, " (Project has changed which means that treeview is out of date)");
                }

                if (doSelectionButton(RefreshGUIContent))// GUILayout.Button(content, GUILayout.MaxWidth(32), GUILayout.Height(18)))
                {
                    RefreshBuildLog();
                }

                GUI.color = origColor;
            }


            if (doSelectionButton(guiContentLoadBuildInfo))
            {
                openBuildInfoSelector();
            }
            EditorGUI.BeginDisabledGroup(!EditorBuildSettings.scenes.Any(val => val.enabled == true)); //Disable the generate btn if there are no enabled scenes in buildsettings
            if (doSelectionButton(guiContentGenerateBuildInfo))
            {
                generateBuildInfo();
            }
            EditorGUI.EndDisabledGroup();
            if (doSelectionButton(guiContentSettings))
            {
                AH_SettingsWindow.Init(true);
            }

            /*if (doSelectionButton(guiContentSceneUsage))
             *  AH_SceneReferenceWindow.Init();*/
            //Only avaliable in 2018
#if UNITY_2018_1_OR_NEWER
            if (infoLoaded && doSelectionButton(guiContentBuildReport))
            {
                AH_BuildReportWindow.Init();
            }
#endif

#if AH_HAS_OLD_INSTALLED
            //Transfer settings to PRO
            GUIContent TransferSettingsContent = new GUIContent("Transfer Settings", "Transfer your settings from old Asset Hunter into PRO");
            if (AH_VersionUpgrader.VersionUpgraderReady && GUILayout.Button(TransferSettingsContent, GUILayout.MaxHeight(18)))
            {
                AH_VersionUpgrader.RunUpgrade();
            }
#endif

            if (infoLoaded && m_TreeView.GetCombinedUnusedSize() > 0)
            {
                string sizeAsString = AH_Utils.GetSizeAsString(m_TreeView.GetCombinedUnusedSize());

                GUIContent instancedGUIContent = new GUIContent(guiContentDeleteAll);
                instancedGUIContent.tooltip = string.Format(instancedGUIContent.tooltip, sizeAsString);
                if (AH_SettingsManager.Instance.HideButtonText)
                {
                    instancedGUIContent.text = null;
                }

                GUIStyle btnStyle = "button";
                GUIStyle newStyle = new GUIStyle(btnStyle);
                newStyle.normal.textColor = AH_WindowStyler.clr_Pink;

                m_TreeView.DrawDeleteAllButton(instancedGUIContent, newStyle, GUILayout.MaxHeight(AH_SettingsManager.Instance.HideButtonText ? btnMaxHeight * 2f : btnMaxHeight));
            }

            GUILayout.FlexibleSpace();
            GUILayout.Space(20);

            if (m_TreeView != null)
            {
                m_TreeView.AssetSelectionToolBarGUI();
            }

            if (doSelectionButton(guiContentReadme))
            {
                Heureka_PackageDataManagerEditor.SelectReadme();
                if (AH_EditorData.Instance.Documentation != null)
                {
                    AssetDatabase.OpenAsset(AH_EditorData.Instance.Documentation);
                }
            }

            EditorGUILayout.EndHorizontal();
        }