void OnEnable() { _src = target as DOTweenAnimation; _settings = DOTweenUtilityWindow.GetDOTweenSettings(); onStartProperty = base.serializedObject.FindProperty("onStart"); onPlayProperty = base.serializedObject.FindProperty("onPlay"); onUpdateProperty = base.serializedObject.FindProperty("onUpdate"); onStepCompleteProperty = base.serializedObject.FindProperty("onStepComplete"); onCompleteProperty = base.serializedObject.FindProperty("onComplete"); onRewindProperty = base.serializedObject.FindProperty("onRewind"); onTweenCreatedProperty = base.serializedObject.FindProperty("onTweenCreated"); // Convert _AnimationType to _animationTypeNoSlashes int len = _AnimationType.Length; _animationTypeNoSlashes = new string[len]; for (int i = 0; i < len; ++i) { string a = _AnimationType[i]; a = a.Replace("/", ""); _animationTypeNoSlashes[i] = a; } }
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); } }
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); }