Ejemplo n.º 1
0
        private static void RemoveASMDEF(ASMDEFManager.ASMDEFType type)
        {
            bool   flag = false;
            string str1 = (string)null;
            string str2 = (string)null;

            switch (type)
            {
            case ASMDEFManager.ASMDEFType.Modules:
                flag = ASMDEFManager.hasModulesASMDEF;
                str2 = EditorUtils.dotweenModulesDir;
                str1 = "DOTween.Modules.asmdef";
                break;

            case ASMDEFManager.ASMDEFType.DOTweenPro:
                flag = ASMDEFManager.hasProASMDEF;
                str1 = "DOTweenPro.Scripts.asmdef";
                str2 = EditorUtils.dotweenProDir;
                break;
            }
            ASMDEFManager.Refresh();
            if (!flag)
            {
                EditorUtility.DisplayDialog("Remove ASMDEF", str1 + " not present", "Ok");
            }
            else
            {
                AssetDatabase.DeleteAsset(EditorUtils.FullPathToADBPath(str2 + str1));
                ASMDEFManager.Refresh();
                ASMDEFManager.LogASMDEFChange(type, ASMDEFManager.ChangeType.Deleted);
            }
        }
Ejemplo n.º 2
0
        static bool _setupDialogRequested; // Used to prevent OnPostProcessAllAssets firing twice (because of a Unity bug/feature)

        static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
        {
            if (_setupDialogRequested)
            {
                return;
            }

            string[] dotweenEntries  = System.Array.FindAll(importedAssets, name => name.Contains("DOTween") && !name.EndsWith(".meta") && !name.EndsWith(".jpg") && !name.EndsWith(".png"));
            bool     dotweenImported = dotweenEntries.Length > 0;

            if (dotweenImported)
            {
                // Reapply modules
                EditorUtils.DelayedCall(0.1f, () => {
//                    Debug.Log("Apply Modules Settings after reimport");
                    DOTweenUtilityWindowModules.ApplyModulesSettings();
                });
            }

            string[] dotweenProEntries  = System.Array.FindAll(importedAssets, name => name.Contains("DOTweenPro") && !name.EndsWith(".meta") && !name.EndsWith(".jpg") && !name.EndsWith(".png"));
            bool     dotweenProImported = dotweenProEntries.Length > 0;

            if (dotweenProImported)
            {
                // Refresh ASMDEF
                EditorUtils.DelayedCall(0.1f, () => {
//                    Debug.Log("Refresh ASMDEF after DOTween Pro reimport");
                    ASMDEFManager.RefreshExistingASMDEFFiles();
                });
            }
        }
Ejemplo n.º 3
0
 public static void RefreshExistingASMDEFFiles()
 {
     ASMDEFManager.Refresh();
     if (!ASMDEFManager.hasModulesASMDEF)
     {
         if (!ASMDEFManager.hasProASMDEF)
         {
             return;
         }
         ASMDEFManager.RemoveASMDEF(ASMDEFManager.ASMDEFType.DOTweenPro);
     }
     else if (EditorUtils.hasPro && !ASMDEFManager.hasProASMDEF)
     {
         ASMDEFManager.CreateASMDEF(ASMDEFManager.ASMDEFType.DOTweenPro, false);
     }
     else if (EditorUtils.hasPro)
     {
         DOTweenSettings doTweenSettings = DOTweenUtilityWindow.GetDOTweenSettings();
         if ((Object)doTweenSettings == (Object)null)
         {
             return;
         }
         bool flag = false;
         using (StreamReader streamReader = new StreamReader(EditorUtils.dotweenProDir + "DOTweenPro.Scripts.asmdef"))
         {
             string str;
             while ((str = streamReader.ReadLine()) != null)
             {
                 if (str.Contains("Unity.TextMeshPro"))
                 {
                     flag = true;
                     break;
                 }
             }
         }
         if (flag == doTweenSettings.modules.textMeshProEnabled)
         {
             return;
         }
         ASMDEFManager.CreateASMDEF(ASMDEFManager.ASMDEFType.DOTweenPro, true);
     }
 }
Ejemplo n.º 4
0
 public static void RemoveAllASMDEF()
 {
     ASMDEFManager.RemoveASMDEF(ASMDEFManager.ASMDEFType.Modules);
     ASMDEFManager.RemoveASMDEF(ASMDEFManager.ASMDEFType.DOTweenPro);
 }
Ejemplo n.º 5
0
 public static void CreateAllASMDEF()
 {
     ASMDEFManager.CreateASMDEF(ASMDEFManager.ASMDEFType.Modules, false);
     ASMDEFManager.CreateASMDEF(ASMDEFManager.ASMDEFType.DOTweenPro, false);
 }
Ejemplo n.º 6
0
 static ASMDEFManager()
 {
     ASMDEFManager.Refresh();
 }
Ejemplo n.º 7
0
        private static void CreateASMDEF(ASMDEFManager.ASMDEFType type, bool forceOverwrite = false)
        {
            ASMDEFManager.Refresh();
            bool   flag = false;
            string str1 = (string)null;
            string str2 = (string)null;
            string path = (string)null;

            switch (type)
            {
            case ASMDEFManager.ASMDEFType.Modules:
                flag = ASMDEFManager.hasModulesASMDEF;
                str1 = "DOTween.Modules";
                str2 = "DOTween.Modules.asmdef";
                path = EditorUtils.dotweenModulesDir;
                break;

            case ASMDEFManager.ASMDEFType.DOTweenPro:
                flag = ASMDEFManager.hasProASMDEF;
                str1 = "DOTweenPro.Scripts";
                str2 = "DOTweenPro.Scripts.asmdef";
                path = EditorUtils.dotweenProDir;
                break;
            }
            if (flag && !forceOverwrite)
            {
                EditorUtility.DisplayDialog("Create ASMDEF", str2 + " already exists", "Ok");
            }
            else if (!Directory.Exists(path))
            {
                EditorUtility.DisplayDialog("Create ASMDEF", string.Format("Directory not found\n({0})", (object)path), "Ok");
            }
            else
            {
                string str3 = path + str2;
                using (StreamWriter text = File.CreateText(str3))
                {
                    text.WriteLine("{");
                    switch (type)
                    {
                    case ASMDEFManager.ASMDEFType.Modules:
                        text.WriteLine("\t\"name\": \"{0}\"", (object)str1);
                        break;

                    case ASMDEFManager.ASMDEFType.DOTweenPro:
                        text.WriteLine("\t\"name\": \"{0}\",", (object)str1);
                        text.WriteLine("\t\"references\": [");
                        DOTweenSettings doTweenSettings = DOTweenUtilityWindow.GetDOTweenSettings();
                        if ((Object)doTweenSettings != (Object)null && doTweenSettings.modules.textMeshProEnabled)
                        {
                            text.WriteLine("\t\t\"{0}\",", (object)"Unity.TextMeshPro");
                        }
                        text.WriteLine("\t\t\"{0}\"", (object)"DOTween.Modules");
                        text.WriteLine("\t]");
                        break;
                    }
                    text.WriteLine("}");
                }
                AssetDatabase.ImportAsset(EditorUtils.FullPathToADBPath(str3), ImportAssetOptions.ForceUpdate);
                ASMDEFManager.Refresh();
                ASMDEFManager.LogASMDEFChange(type, flag ? ASMDEFManager.ChangeType.Overwritten : ASMDEFManager.ChangeType.Created);
            }
        }