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
 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.º 3
0
 static ASMDEFManager()
 {
     ASMDEFManager.Refresh();
 }
Ejemplo n.º 4
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);
            }
        }