예제 #1
0
        private static void UpdateInstalledPluginsInDoozySettings()
        {
            if (Settings == null)
            {
                return;
            }

            bool saveAssets = false;

            //DOTween - DG.Tweening
            bool hasDOTween = NamespaceExists(NAMESPACE_DG_TWEENING);

            if (Settings.DOTweenDetected != hasDOTween)
            {
                Settings.DOTweenDetected = hasDOTween;
                saveAssets = true;
            }

            //DOOZY UI version 2
            //Previous DoozyUI version - DoozyUI
            bool hasDoozyUI = NamespaceExists(NAMESPACE_DOOZYUI);

            if (Settings.DoozyUIVersion2Detected != hasDoozyUI)
            {
                Settings.DoozyUIVersion2Detected = hasDoozyUI;
                saveAssets = true;
            }

            //DOOZY UI version 3
            //Current DoozyUI version - Doozy.Engine
            bool hasDoozyEngine = NamespaceExists(NAMESPACE_DOOZY_ENGINE);

            if (Settings.DoozyUIVersion3Detected != hasDoozyEngine)
            {
                Settings.DoozyUIVersion3Detected = hasDoozyEngine;
                saveAssets = true;
            }

            if (hasDoozyEngine && !DefineSymbolsUtils.HasGlobalDefine(DEFINE_DOOZY_MANAGER))
            {
                DefineSymbolsUtils.AddGlobalDefine(DEFINE_DOOZY_MANAGER);
            }

            if (!saveAssets)
            {
                return;
            }
            Settings.SetDirty(false);
            s_saveAssets = true;
        }
예제 #2
0
        private void DrawDoozyUIVersion2()
        {
            GUIStyle iconStyle = !Settings.DoozyUIVersion2Detected ? s_iconOk : s_iconError;

            GUILayout.BeginHorizontal(s_itemBackground);
            {
                GUILayout.Space(24);
                GUILayout.BeginVertical(GUILayout.Height(s_itemBackground.fixedHeight));
                {
                    GUILayout.Space(s_itemBackground.fixedHeight / 2 - iconStyle.fixedHeight / 2);
                    GUILayout.Label(iconStyle.normal.background);
                }
                GUILayout.EndVertical();
                GUILayout.Space(48);
                GUILayout.BeginVertical(GUILayout.Height(s_itemBackground.fixedHeight));
                {
                    GUILayout.Space(s_itemBackground.fixedHeight / 2 - s_logoDOTween.fixedHeight / 2);
                    GUILayout.Label(s_logoDoozyUIVersion2.normal.background);
                }
                GUILayout.EndVertical();
                GUILayout.FlexibleSpace();
                if (!Settings.DoozyUIVersion2Detected)
                {
                    GUILayout.Label(Labels.NotInstalled, s_labelGreen, GUILayout.Height(s_itemBackground.fixedHeight));
                }
                else
                {
                    GUILayout.BeginVertical(GUILayout.Height(s_itemBackground.fixedHeight));
                    {
                        GUILayout.Space(s_itemBackground.fixedHeight / 2 - s_downloadButton.fixedHeight / 2);
                        if (GUILayout.Button(Labels.Uninstall, s_uninstallButton))
                        {
                            if (EditorUtility.DisplayDialog(Labels.Uninstall, Labels.AreYouSureYouWantToUninstallDoozyUIVersion2, Labels.Yes, Labels.No))
                            {
                                EditorUtility.DisplayProgressBar(Labels.Uninstall, Labels.DoozyUIVersion2, 0.1f);

                                string[] guids = AssetDatabase.FindAssets("t:DUIVersion", null);
                                if (guids != null && guids.Length > 0)
                                {
                                    string doozyPath = AssetDatabase.GUIDToAssetPath(guids[0]);
                                    doozyPath = doozyPath.Replace(@"/Editor/Resources/DUI/Data/DUIVersion.asset", "");

                                    EditorUtility.DisplayProgressBar(Labels.Uninstall, Labels.DoozyUIVersion2, 0.4f);
                                    if (AssetDatabase.IsValidFolder(doozyPath))
                                    {
                                        AssetDatabase.MoveAssetToTrash(doozyPath);
                                        AssetDatabase.ForceReserializeAssets(new[] { doozyPath });
                                    }
                                }

                                EditorUtility.DisplayProgressBar(Labels.Uninstall, Labels.DoozyUIVersion2, 0.7f);
                                if (AssetDatabase.IsValidFolder("Assets/Plugins/Quick"))
                                {
                                    AssetDatabase.MoveAssetToTrash("Assets/Plugins/Quick");
                                    AssetDatabase.ForceReserializeAssets(new[] { "Assets/Plugins/Quick" });
                                }

                                EditorUtility.DisplayProgressBar(Labels.Uninstall, Labels.DoozyUIVersion2, 0.9f);
                                DefineSymbolsUtils.RemoveGlobalDefine("dUI_DoozyUI");
                                EditorUtility.ClearProgressBar();
                            }
                        }
                    }
                    GUILayout.EndVertical();
                }

                GUILayout.Space(32);
            }
            GUILayout.EndHorizontal();
        }