diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll index 5479d12..3ad01a4 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb index 595ed01..cbeb993 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll index 9f5d4bf..ef614b5 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb index dec7da8..fdcac1b 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll index d5b2fc5..1d62642 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll.mdb index 31052fb..a93afde 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll.mdb differ diff --git a/_DOTween.Assembly/DOTween/DOTween.cs b/_DOTween.Assembly/DOTween/DOTween.cs index 0c34377..bb0d890 100644 --- a/_DOTween.Assembly/DOTween/DOTween.cs +++ b/_DOTween.Assembly/DOTween/DOTween.cs @@ -32,7 +32,7 @@ namespace DG.Tweening public class DOTween { /// DOTween's version - public static readonly string Version = "1.2.220"; // Last version before modules: 1.1.755 + public static readonly string Version = "1.2.225"; // Last version before modules: 1.1.755 /////////////////////////////////////////////// // Options //////////////////////////////////// diff --git a/_DOTween.Assembly/DOTweenEditor/ASMDEFManager.cs b/_DOTween.Assembly/DOTweenEditor/ASMDEFManager.cs new file mode 100644 index 0000000..09bb960 --- /dev/null +++ b/_DOTween.Assembly/DOTweenEditor/ASMDEFManager.cs @@ -0,0 +1,201 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2019/03/05 12:37 +// License Copyright (c) Daniele Giardini +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using System.IO; +using DG.DOTweenEditor.UI; +using DG.Tweening.Core; +using UnityEditor; +using UnityEngine; + +namespace DG.DOTweenEditor +{ + internal static class ASMDEFManager + { + public enum ASMDEFType + { + Modules, + DOTweenPro + } + + enum ChangeType + { + Deleted, + Created, + Overwritten + } + + public static bool hasModulesASMDEF { get; private set; } + public static bool hasProASMDEF { get; private set; } + + const string _ModulesId = "DOTween.Modules"; + const string _ProId = "DOTweenPro.Scripts"; + const string _ModulesASMDEFFile = _ModulesId + ".asmdef"; + const string _ProASMDEFFile = _ProId + ".asmdef"; + + const string _RefTextMeshPro = "Unity.TextMeshPro"; + + static ASMDEFManager() + { + Refresh(); + } + + #region Public Methods + + public static void Refresh() + { + hasModulesASMDEF = File.Exists(EditorUtils.dotweenModulesDir + _ModulesASMDEFFile); + hasProASMDEF = File.Exists(EditorUtils.dotweenProDir + _ProASMDEFFile); + } + + public static void RefreshExistingASMDEFFiles() + { + Refresh(); + + if (!hasModulesASMDEF) { + if (hasProASMDEF) RemoveASMDEF(ASMDEFType.DOTweenPro); + return; + } + if (EditorUtils.hasPro && !hasProASMDEF) { + CreateASMDEF(ASMDEFType.DOTweenPro); + return; + } + + // Pro ASMDEF present: check that it contains correct elements + DOTweenSettings src = DOTweenUtilityWindow.GetDOTweenSettings(); + if (src == null) return; + + bool hasTextMeshProRef = false; + using (StreamReader sr = new StreamReader(EditorUtils.dotweenProDir + _ProASMDEFFile)) { + string s; + while ((s = sr.ReadLine()) != null) { + if (!s.Contains(_RefTextMeshPro)) continue; + hasTextMeshProRef = true; + break; + } + } + bool recreate = hasTextMeshProRef != src.modules.textMeshProEnabled; + if (recreate) CreateASMDEF(ASMDEFType.DOTweenPro, true); + } + + public static void CreateAllASMDEF() + { + CreateASMDEF(ASMDEFType.Modules); + CreateASMDEF(ASMDEFType.DOTweenPro); + } + + public static void RemoveAllASMDEF() + { + RemoveASMDEF(ASMDEFType.Modules); + RemoveASMDEF(ASMDEFType.DOTweenPro); + } + + #endregion + + #region Methods + + static void LogASMDEFChange(ASMDEFType asmdefType, ChangeType changeType) + { + Debug.Log(string.Format( + "DOTween ASMDEF file {1} ► {2}", + changeType == ChangeType.Deleted ? "ff0000" : changeType == ChangeType.Created ? "00ff00" : "ff6600", + changeType == ChangeType.Deleted ? "removed" : changeType == ChangeType.Created ? "created" : "changed", + asmdefType == ASMDEFType.Modules ? "DOTween/Modules/" + _ModulesASMDEFFile : "DOTweenPro/" + _ProASMDEFFile + )); + } + + 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; + } + 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: + 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); + } + 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); + } + + 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; + } + + 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); + } + + #endregion + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTweenEditor/DOTweenEditor.csproj b/_DOTween.Assembly/DOTweenEditor/DOTweenEditor.csproj index 6b5294b..5c15c9f 100644 --- a/_DOTween.Assembly/DOTweenEditor/DOTweenEditor.csproj +++ b/_DOTween.Assembly/DOTweenEditor/DOTweenEditor.csproj @@ -74,6 +74,7 @@ + diff --git a/_DOTween.Assembly/DOTweenEditor/DOTweenProcessors.cs b/_DOTween.Assembly/DOTweenEditor/DOTweenProcessors.cs index 3119d06..a94d91a 100644 --- a/_DOTween.Assembly/DOTweenEditor/DOTweenProcessors.cs +++ b/_DOTween.Assembly/DOTweenEditor/DOTweenProcessors.cs @@ -62,37 +62,23 @@ namespace DG.DOTweenEditor 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) return; + if (dotweenImported) { + // Reapply modules + EditorUtils.DelayedCall(0.1f, ()=> { +// Debug.Log("Apply Modules Settings after reimport"); + DOTweenUtilityWindowModules.ApplyModulesSettings(); + }); + } - // Reapply modules - EditorUtils.DelayedCall(0.1f, ()=> { -// Debug.Log("Apply Modules Settings after reimport"); - DOTweenUtilityWindowModules.ApplyModulesSettings(); - }); -// DOTweenUtilityWindowModules.ApplyModulesSettings(); - - - -// // Delete old DOTween files -// EditorUtils.DeleteLegacyNoModulesDOTweenFiles(); -// // Delete old DemiLib configuration -// EditorUtils.DeleteOldDemiLibCore(); -// // Remove old legacy defines -// DOTweenDefines.RemoveAllLegacyDefines(); -// // Reapply modules -// DOTweenUtilityWindowModules.ApplyModulesSettings(); -// // -// bool differentCoreVersion = EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.Id) != Application.dataPath + DOTween.Version; -// bool differentProVersion = EditorUtils.hasPro && EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.IdPro) != Application.dataPath + EditorUtils.proVersion; -// bool setupRequired = differentCoreVersion || differentProVersion; -// if (!setupRequired) return; -// -// _setupDialogRequested = true; -// EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.Id, Application.dataPath + DOTween.Version); -// if (EditorUtils.hasPro) { -// EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.IdPro, Application.dataPath + EditorUtils.proVersion); -// } -// DOTweenUtilityWindow.Open(); + 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(); + }); + } } } } \ No newline at end of file diff --git a/_DOTween.Assembly/DOTweenEditor/EditorUtils.cs b/_DOTween.Assembly/DOTweenEditor/EditorUtils.cs index 8ee284d..de1e99c 100644 --- a/_DOTween.Assembly/DOTweenEditor/EditorUtils.cs +++ b/_DOTween.Assembly/DOTweenEditor/EditorUtils.cs @@ -25,6 +25,8 @@ namespace DG.DOTweenEditor public static string dotweenDir { get { if (string.IsNullOrEmpty(_dotweenDir)) StoreDOTweenDirs(); return _dotweenDir; } } // With final slash (system based) public static string dotweenProDir { get { if (string.IsNullOrEmpty(_dotweenProDir)) StoreDOTweenDirs(); return _dotweenProDir; } } + // With final slash (system based) + public static string dotweenModulesDir { get { if (string.IsNullOrEmpty(_dotweenModulesDir)) StoreDOTweenDirs(); return _dotweenModulesDir; } } public static bool isOSXEditor { get; private set; } public static string pathSlash { get; private set; } // for full paths public static string pathSlashToReplace { get; private set; } // for full paths @@ -37,6 +39,7 @@ namespace DG.DOTweenEditor static string _demigiantDir; // with final slash static string _dotweenDir; // with final slash static string _dotweenProDir; // with final slash + static string _dotweenModulesDir; // with final slash static EditorUtils() { @@ -372,6 +375,7 @@ namespace DG.DOTweenEditor _dotweenDir = _dotweenDir.Replace(pathSlashToReplace, pathSlash); _dotweenProDir = _dotweenProDir.Replace(pathSlashToReplace, pathSlash); + _dotweenModulesDir = _dotweenDir + "Modules" + pathSlash; if (_demigiantDir != null) _demigiantDir = _demigiantDir.Replace(pathSlashToReplace, pathSlash); } diff --git a/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindow.cs b/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindow.cs index 0e1d9c1..5caff25 100644 --- a/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindow.cs +++ b/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindow.cs @@ -159,7 +159,7 @@ namespace DG.DOTweenEditor.UI GUI.color = Color.green; GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); - if (GUILayout.Button("Setup DOTween...\n(add/remove Modules)", EditorGUIUtils.btSetup)) { + if (GUILayout.Button("Setup DOTween...\n(add/remove Modules)", EditorGUIUtils.btSetup, GUILayout.Width(200))) { // DOTweenDefines.Setup(); // _setupRequired = EditorUtils.DOTweenSetupRequired(); DOTweenUtilityWindowModules.ApplyModulesSettings(); @@ -171,15 +171,34 @@ namespace DG.DOTweenEditor.UI return; } GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); GUI.color = Color.white; + GUILayout.Space(4); + + // ASMDEF + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + GUI.color = ASMDEFManager.hasModulesASMDEF ? Color.yellow : Color.cyan; + if (GUILayout.Button(ASMDEFManager.hasModulesASMDEF ? "Remove ASMDEF..." : "Create ASMDEF...", EditorGUIUtils.btSetup, GUILayout.Width(200))) { + if (ASMDEFManager.hasModulesASMDEF) { + if (EditorUtility.DisplayDialog("Remove ASMDEF", + string.Format("This will remove the \"DOTween/Modules/DOTween.Modules.asmdef\" and \"DOTweenPro/DOTweenPro.Scripts.asmdef\"" + + " (if you have DOTween Pro) files."), + "Ok", "Cancel" + )) ASMDEFManager.RemoveAllASMDEF(); + } else { + if (EditorUtility.DisplayDialog("Create ASMDEF", + string.Format("This will create the \"DOTween/Modules/DOTween.Modules.asmdef\" and \"DOTweenPro/DOTweenPro.Scripts.asmdef\"" + + " (if you have DOTween Pro) files."), + "Ok", "Cancel" + )) ASMDEFManager.CreateAllASMDEF(); + } + } + GUI.color = Color.white; + GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(8); -// EditorGUILayout.HelpBox( -// "NOTE: if you get \"Requested build target group (N) doesn't exist\" or [CS0618] errors during the setup don't worry: it's ok and allows the setup to work on all possible Unity versions", -// MessageType.Info -// ); - GUILayout.BeginHorizontal(); if (GUILayout.Button("Website", EditorGUIUtils.btBigStyle, GUILayout.Width(_HalfBtSize))) Application.OpenURL("http://dotween.demigiant.com/index.php"); if (GUILayout.Button("Get Started", EditorGUIUtils.btBigStyle, GUILayout.Width(_HalfBtSize))) Application.OpenURL("http://dotween.demigiant.com/getstarted.php"); diff --git a/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindowModules.cs b/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindowModules.cs index 0297866..8c3c1cf 100644 --- a/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindowModules.cs +++ b/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindowModules.cs @@ -199,6 +199,8 @@ namespace DG.DOTweenEditor.UI strb.Remove(strb.Length - 3, 3); Debug.Log(strb.ToString()); } + + ASMDEFManager.RefreshExistingASMDEFFiles(); } static void Apply_AppendLog(StringBuilder strb, bool enabled, string id) diff --git a/_DOTween.Assembly/DOTweenEditor/UI/EditorGUIUtils.cs b/_DOTween.Assembly/DOTweenEditor/UI/EditorGUIUtils.cs index 33c46ac..427f484 100644 --- a/_DOTween.Assembly/DOTweenEditor/UI/EditorGUIUtils.cs +++ b/_DOTween.Assembly/DOTweenEditor/UI/EditorGUIUtils.cs @@ -148,7 +148,7 @@ namespace DG.DOTweenEditor.UI btBigStyle.padding = new RectOffset(0, 0, 10, 10); btSetup = new GUIStyle(btBigStyle); - btSetup.padding = new RectOffset(36, 36, 6, 6); + btSetup.padding = new RectOffset(10, 10, 6, 6); btSetup.wordWrap = true; btSetup.richText = true; diff --git a/_DOTween.Assembly/bin/DOTween.dll b/_DOTween.Assembly/bin/DOTween.dll index 5479d12..3ad01a4 100644 Binary files a/_DOTween.Assembly/bin/DOTween.dll and b/_DOTween.Assembly/bin/DOTween.dll differ diff --git a/_DOTween.Assembly/bin/DOTween.dll.mdb b/_DOTween.Assembly/bin/DOTween.dll.mdb index 595ed01..cbeb993 100644 Binary files a/_DOTween.Assembly/bin/DOTween.dll.mdb and b/_DOTween.Assembly/bin/DOTween.dll.mdb differ diff --git a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll index 9f5d4bf..ef614b5 100644 Binary files a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll and b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll differ diff --git a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb index dec7da8..fdcac1b 100644 Binary files a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb and b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb differ diff --git a/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll b/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll index d5b2fc5..1d62642 100644 Binary files a/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll and b/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll differ diff --git a/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb b/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb index 31052fb..a93afde 100644 Binary files a/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb and b/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb differ