コード例 #1
0
        // ===================================================================================
        // METHODS ---------------------------------------------------------------------------

        void Connect()
        {
            if (_src == null)
            {
                string srcDir = EditorUtils.assetsPath + EditorUtils.pathSlash + "Resources";
                if (!Directory.Exists(srcDir))
                {
                    AssetDatabase.CreateFolder("Assets", "Resources");
                }
                string adbSrcFilePath = EditorUtils.FullPathToADBPath(srcDir + EditorUtils.pathSlash + DOTweenSettings.AssetName + ".asset");

                // Legacy: check if there are settings saved in old mode (inside DOTween/Resources folder) and eventually move them
                string legacySrcDir      = EditorUtils.dotweenDir + "Resources";
                string legacySrcFilePath = legacySrcDir + EditorUtils.pathSlash + DOTweenSettings.AssetName + ".asset";
                if (File.Exists(legacySrcFilePath))
                {
                    // Move legacy src file to correct folder
                    AssetDatabase.MoveAsset(EditorUtils.FullPathToADBPath(legacySrcFilePath), adbSrcFilePath);
                    // Delete legacy Resources folder
                    AssetDatabase.DeleteAsset(EditorUtils.FullPathToADBPath(legacySrcDir));
                }

                _src = EditorUtils.ConnectToSourceAsset <DOTweenSettings>(adbSrcFilePath, true);
            }
        }
コード例 #2
0
        public static void DeleteLegacyNoModulesDOTweenFiles()
        {
            string adbPath = EditorUtils.FullPathToADBPath(EditorUtils.dotweenDir);

            AssetDatabase.StartAssetEditing();
            EditorUtils.DeleteAssetsIfExist(new string[21]
            {
                adbPath + "DOTween43.dll",
                adbPath + "DOTween43.xml",
                adbPath + "DOTween43.dll.mdb",
                adbPath + "DOTween43.dll.addon",
                adbPath + "DOTween43.xml.addon",
                adbPath + "DOTween43.dll.mdb.addon",
                adbPath + "DOTween46.dll",
                adbPath + "DOTween46.xml",
                adbPath + "DOTween46.dll.mdb",
                adbPath + "DOTween46.dll.addon",
                adbPath + "DOTween46.xml.addon",
                adbPath + "DOTween46.dll.mdb.addon",
                adbPath + "DOTween50.dll",
                adbPath + "DOTween50.xml",
                adbPath + "DOTween50.dll.mdb",
                adbPath + "DOTween50.dll.addon",
                adbPath + "DOTween50.xml.addon",
                adbPath + "DOTween50.dll.mdb.addon",
                adbPath + "DOTweenTextMeshPro.cs.addon",
                adbPath + "DOTweenTextMeshPro_mod.cs",
                adbPath + "DOTweenTk2d.cs.addon"
            });
            AssetDatabase.StopAssetEditing();
        }
コード例 #3
0
        public static void DeleteOldDemiLibCore()
        {
            string assemblyFilePath = EditorUtils.GetAssemblyFilePath(typeof(DOTween).Assembly);
            string str1             = assemblyFilePath.IndexOf("/") != -1 ? "/" : "\\";
            string str2             = assemblyFilePath.Substring(0, assemblyFilePath.LastIndexOf(str1));
            string fullPath         = str2.Substring(0, str2.LastIndexOf(str1)) + str1 + "DemiLib";
            string adbPath          = EditorUtils.FullPathToADBPath(fullPath);

            if (!EditorUtils.AssetExists(adbPath))
            {
                return;
            }
            string str3 = adbPath + "/Core";

            if (!EditorUtils.AssetExists(str3))
            {
                return;
            }
            EditorUtils.DeleteAssetsIfExist(new string[7]
            {
                adbPath + "/DemiLib.dll",
                adbPath + "/DemiLib.xml",
                adbPath + "/DemiLib.dll.mdb",
                adbPath + "/Editor/DemiEditor.dll",
                adbPath + "/Editor/DemiEditor.xml",
                adbPath + "/Editor/DemiEditor.dll.mdb",
                adbPath + "/Editor/Imgs"
            });
            if (!EditorUtils.AssetExists(adbPath + "/Editor") || Directory.GetFiles(fullPath + str1 + "Editor").Length != 0)
            {
                return;
            }
            AssetDatabase.DeleteAsset(adbPath + "/Editor");
            AssetDatabase.ImportAsset(str3, ImportAssetOptions.ImportRecursive);
        }
コード例 #4
0
            public string adbParentDir; // without final slash

            public LocationData(string srcDir) : this()
            {
                dir          = srcDir;
                filePath     = dir + EditorUtils.pathSlash + DOTweenSettings.AssetName + ".asset";
                adbFilePath  = EditorUtils.FullPathToADBPath(filePath);
                adbParentDir = EditorUtils.FullPathToADBPath(dir.Substring(0, dir.LastIndexOf(EditorUtils.pathSlash)));
            }
コード例 #5
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);
            }
        }
コード例 #6
0
 public LocationData(string srcDir)
 {
     this              = default(LocationData);
     this.dir          = srcDir;
     this.filePath     = this.dir + EditorUtils.pathSlash + "DOTweenSettings.asset";
     this.adbFilePath  = EditorUtils.FullPathToADBPath(this.filePath);
     this.adbParentDir = EditorUtils.FullPathToADBPath(this.dir.Substring(0, this.dir.LastIndexOf(EditorUtils.pathSlash)));
 }
コード例 #7
0
        public static void DeleteDOTweenUpgradeManagerFiles()
        {
            string adbPath = EditorUtils.FullPathToADBPath(EditorUtils.dotweenDir);

            AssetDatabase.StartAssetEditing();
            EditorUtils.DeleteAssetsIfExist(new string[4]
            {
                adbPath + "Editor/DOTweenUpgradeManager.dll",
                adbPath + "Editor/DOTweenUpgradeManager.xml",
                adbPath + "Editor/DOTweenUpgradeManager.pdb",
                adbPath + "Editor/DOTweenUpgradeManager.dll.mdb"
            });
            AssetDatabase.StopAssetEditing();
        }
コード例 #8
0
 private void MoveSrc(LocationData[] from, LocationData to)
 {
     if (!Directory.Exists(to.dir))
     {
         AssetDatabase.CreateFolder(to.adbParentDir, "Resources");
     }
     foreach (LocationData locationData in from)
     {
         if (File.Exists(locationData.filePath))
         {
             AssetDatabase.MoveAsset(locationData.adbFilePath, to.adbFilePath);
             AssetDatabase.DeleteAsset(locationData.adbFilePath);
             if (Directory.GetDirectories(locationData.dir).Length == 0 && Directory.GetFiles(locationData.dir).Length == 0)
             {
                 AssetDatabase.DeleteAsset(EditorUtils.FullPathToADBPath(locationData.dir));
             }
         }
     }
     this._src = EditorUtils.ConnectToSourceAsset <DOTweenSettings>(to.adbFilePath, true);
 }
コード例 #9
0
ファイル: ASMDEFManager.cs プロジェクト: seem-sky/AccountBook
        static void RemoveASMDEF(ASMDEFType type)
        {
            bool   alreadyPresent = false;
            string asmdefFile     = null;
            string asmdefDir      = null; // with final OS slash

            switch (type)
            {
            case ASMDEFType.Modules:
                alreadyPresent = hasModulesASMDEF;
                asmdefDir      = EditorUtils.dotweenModulesDir;
                asmdefFile     = _ModulesASMDEFFile;
                break;

            case ASMDEFType.DOTweenPro:
                alreadyPresent = hasProASMDEF;
                asmdefFile     = _ProASMDEFFile;
                asmdefDir      = EditorUtils.dotweenProDir;
                break;

            case ASMDEFType.DOTweenProEditor:
                alreadyPresent = hasProEditorASMDEF;
                asmdefFile     = _ProEditorASMDEFFile;
                asmdefDir      = EditorUtils.dotweenProEditorDir;
                break;
            }

            Refresh();
            if (!alreadyPresent)
            {
                EditorUtility.DisplayDialog("Remove ASMDEF", asmdefFile + " not present", "Ok");
                return;
            }

            string asmdefFilePath = asmdefDir + asmdefFile;

            AssetDatabase.DeleteAsset(EditorUtils.FullPathToADBPath(asmdefFilePath));
            Refresh();
            LogASMDEFChange(type, ChangeType.Deleted);
        }
コード例 #10
0
 void MoveSrc(LocationData[] from, LocationData to)
 {
     if (!Directory.Exists(to.dir))
     {
         AssetDatabase.CreateFolder(to.adbParentDir, "Resources");
     }
     foreach (LocationData ld in from)
     {
         if (File.Exists(ld.filePath))
         {
             // Move external src file to correct folder
             AssetDatabase.MoveAsset(ld.adbFilePath, to.adbFilePath);
             // Delete external settings
             AssetDatabase.DeleteAsset(ld.adbFilePath);
             // Check if external Resources folder is empty and in case delete it
             if (Directory.GetDirectories(ld.dir).Length == 0 && Directory.GetFiles(ld.dir).Length == 0)
             {
                 AssetDatabase.DeleteAsset(EditorUtils.FullPathToADBPath(ld.dir));
             }
         }
     }
     _src = EditorUtils.ConnectToSourceAsset <DOTweenSettings>(to.adbFilePath, true);
 }
コード例 #11
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);
            }
        }
コード例 #12
0
ファイル: ASMDEFManager.cs プロジェクト: seem-sky/AccountBook
        static void CreateASMDEF(ASMDEFType type, bool forceOverwrite = false)
        {
            Refresh();
            bool   alreadyPresent = false;
            string asmdefId       = null;
            string asmdefFile     = null;
            string asmdefDir      = null; // with final OS slash

            switch (type)
            {
            case ASMDEFType.Modules:
                alreadyPresent = hasModulesASMDEF;
                asmdefId       = _ModulesId;
                asmdefFile     = _ModulesASMDEFFile;
                asmdefDir      = EditorUtils.dotweenModulesDir;
                break;

            case ASMDEFType.DOTweenPro:
                alreadyPresent = hasProASMDEF;
                asmdefId       = _ProId;
                asmdefFile     = _ProASMDEFFile;
                asmdefDir      = EditorUtils.dotweenProDir;
                break;

            case ASMDEFType.DOTweenProEditor:
                alreadyPresent = hasProEditorASMDEF;
                asmdefId       = _ProEditorId;
                asmdefFile     = _ProEditorASMDEFFile;
                asmdefDir      = EditorUtils.dotweenProEditorDir;
                break;
            }
            if (alreadyPresent && !forceOverwrite)
            {
                EditorUtility.DisplayDialog("Create ASMDEF", asmdefFile + " already exists", "Ok");
                return;
            }
            if (!Directory.Exists(asmdefDir))
            {
                EditorUtility.DisplayDialog(
                    "Create ASMDEF",
                    string.Format("Directory not found\n({0})", asmdefDir),
                    "Ok"
                    );
                return;
            }

            string asmdefFilePath = asmdefDir + asmdefFile;

            using (StreamWriter sw = File.CreateText(asmdefFilePath)) {
                sw.WriteLine("{");
                switch (type)
                {
                case ASMDEFType.Modules:
                    sw.WriteLine("\t\"name\": \"{0}\"", asmdefId);
                    break;

                case ASMDEFType.DOTweenPro:
                case ASMDEFType.DOTweenProEditor:
                    sw.WriteLine("\t\"name\": \"{0}\",", asmdefId);
                    sw.WriteLine("\t\"references\": [");
                    DOTweenSettings src = DOTweenUtilityWindow.GetDOTweenSettings();
                    if (src != null)
                    {
                        if (src.modules.textMeshProEnabled)
                        {
                            sw.WriteLine("\t\t\"{0}\",", _RefTextMeshPro);
                        }
                    }
                    if (type == ASMDEFType.DOTweenProEditor)
                    {
                        sw.WriteLine("\t\t\"{0}\",", _ModulesId);
                        sw.WriteLine("\t\t\"{0}\"", _ProId);
                        sw.WriteLine("\t],");
                        sw.WriteLine("\t\"includePlatforms\": [");
                        sw.WriteLine("\t\t\"Editor\"");
                        sw.WriteLine("\t],");
                        sw.WriteLine("\t\"autoReferenced\": false");
                    }
                    else
                    {
                        sw.WriteLine("\t\t\"{0}\"", _ModulesId);
                        sw.WriteLine("\t]");
                    }
                    break;
                }
                sw.WriteLine("}");
            }
            string adbFilePath = EditorUtils.FullPathToADBPath(asmdefFilePath);

            AssetDatabase.ImportAsset(adbFilePath, ImportAssetOptions.ForceUpdate);
            Refresh();
            LogASMDEFChange(type, alreadyPresent ? ChangeType.Overwritten : ChangeType.Created);
        }