private void OnGUI()
        {
            if (!m_window)
            {
                Init();
            }

            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
            AH_WindowStyler.DrawGlobalHeader(m_window, AH_WindowStyler.clr_Dark, "BUILD INFO MERGER", false);
            EditorGUILayout.Space();

            EditorGUILayout.HelpBox("Select a folder that contains buildinfo files", MessageType.Info);

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Change", GUILayout.ExpandWidth(false)))
            {
                buildInfoFolder = EditorUtility.OpenFolderPanel("Buildinfo folder", buildInfoFolder, "");
                updateBuildInfoFiles();
            }
            EditorGUILayout.LabelField("Current folder: " + buildInfoFolder);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            //Show all used types
            EditorGUILayout.BeginVertical();

            foreach (var item in buildInfoFiles)
            {
                item.Selected = EditorGUILayout.ToggleLeft(item.BuildInfoFile.Name, item.Selected);
            }

            EditorGUILayout.Space();
            EditorGUI.BeginDisabledGroup(buildInfoFiles.Count(val => val.Selected == true) < 2);
            if (GUILayout.Button("Merge Selected", GUILayout.ExpandWidth(false)))
            {
                AH_SerializedBuildInfo merged = new AH_SerializedBuildInfo();
                foreach (var item in buildInfoFiles.FindAll(val => val.Selected))
                {
                    merged.MergeWith(item.BuildInfoFile.FullName);
                }
                merged.SaveAfterMerge();

                EditorUtility.DisplayDialog("Merge completed", "A new buildinfo was created by combined existing buildinfos", "Ok");
                //Reset
                buildInfoFiles.ForEach(val => val.Selected = false);
                updateBuildInfoFiles();
            }
            EditorGUI.EndDisabledGroup();
            //Make sure this window has focus to update contents
            Repaint();

            EditorGUILayout.EndVertical();
            EditorGUILayout.EndScrollView();
        }
        void OnGUI()
        {
            if (!m_window)
            {
                Init(true);
            }

            AH_WindowStyler.DrawGlobalHeader(m_window, AH_WindowStyler.clr_dBlue, "SETTINGS", false);

            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Reset Settings"))
            {
                if (EditorUtility.DisplayDialog("Reset Settings", "Are you sure you want to reset Settings completely", "OK", "CANCEL"))
                {
                    AH_SettingsManager.Instance.ResetAll();
                }
            }
            if (GUILayout.Button("Save prefs to file"))
            {
                AH_SettingsManager.Instance.SaveToFile();
            }
            if (GUILayout.Button("Load prefs from file"))
            {
                AH_SettingsManager.Instance.LoadFromFile();
            }

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

            AH_SettingsManager.Instance.DrawSettings();

            EditorGUILayout.Space();

            AH_SettingsManager.Instance.DrawIgnored();

            EditorGUILayout.EndScrollView();
        }
Exemple #3
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();
        }
Exemple #4
0
 private void doNoBuildInfoLoaded()
 {
     AH_WindowStyler.DrawCenteredMessage(m_window, 380f, 110f, "Buildinfo not yet loaded" + Environment.NewLine + "Load existing / create new build");
 }