diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll index 7e589f6..c8abe88 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 7f88a5f..a3a6b24 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 38c5acc..aa0823d 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 8a954a6..5270e62 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/Modules/DOTweenModuleAudio.cs b/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleAudio.cs index c9b77af..e7c4fc1 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleAudio.cs +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleAudio.cs @@ -1,7 +1,7 @@ // Author: Daniele Giardini - http://www.demigiant.com // Created: 2018/07/13 -#if DOTAUDIO +#if true // MODULE_MARKER using System; using UnityEngine; using UnityEngine.Audio; diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModulePhysics.cs b/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModulePhysics.cs index dca71a0..2a85cc6 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModulePhysics.cs +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModulePhysics.cs @@ -1,7 +1,7 @@ // Author: Daniele Giardini - http://www.demigiant.com // Created: 2018/07/13 -#if DOTPHYSICS +#if true // MODULE_MARKER using System; using DG.Tweening.Core; using DG.Tweening.Core.Enums; diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModulePhysics2D.cs b/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModulePhysics2D.cs index ba8625f..f4e2aa2 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModulePhysics2D.cs +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModulePhysics2D.cs @@ -1,7 +1,7 @@ // Author: Daniele Giardini - http://www.demigiant.com // Created: 2018/07/13 -#if DOTPHYSICS2D && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) +#if true && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) // MODULE_MARKER using System; using UnityEngine; diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleSprite.cs b/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleSprite.cs index 21f5d60..12e07aa 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleSprite.cs +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleSprite.cs @@ -1,7 +1,7 @@ // Author: Daniele Giardini - http://www.demigiant.com // Created: 2018/07/13 -#if DOTSPRITE && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) +#if true && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) // MODULE_MARKER using System; using UnityEngine; using DG.Tweening.Core; diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleUI.cs b/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleUI.cs index de800d5..df2b42c 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleUI.cs +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleUI.cs @@ -1,7 +1,7 @@ // Author: Daniele Giardini - http://www.demigiant.com // Created: 2018/07/13 -#if DOTUI && (UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) +#if true && (UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) // MODULE_MARKER using System; using UnityEngine; using UnityEngine.UI; diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs b/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs index a768721..69b89f3 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs @@ -1,4 +1,4 @@ -// Author: Daniele Giardini - http://www.demigiant.com +// Author: Daniele Giardini - http://www.demigiant.com // Created: 2018/07/13 using System; @@ -46,7 +46,7 @@ namespace DG.Tweening // Called via DOTweenExternalCommand callback public static void SetOrientationOnPath(PathOptions options, Tween t, Quaternion newRot, Transform trans) { -#if DOTPHYSICS +#if true // PHYSICS_MARKER if (options.isRigidbody) ((Rigidbody)t.target).rotation = newRot; else trans.rotation = newRot; #else @@ -57,7 +57,7 @@ namespace DG.Tweening // Returns FALSE if the DOTween's Physics2D Module is disabled, or if there's no Rigidbody2D attached public static bool HasRigidbody2D(Component target) { -#if DOTPHYSICS2D +#if true // PHYSICS2D_MARKER return target.GetComponent() != null; #else return false; @@ -71,7 +71,7 @@ namespace DG.Tweening // Returns FALSE if the DOTween's Physics Module is disabled, or if there's no rigidbody attached public static bool HasRigidbody(Component target) { -#if DOTPHYSICS +#if true // PHYSICS_MARKER return target.GetComponent() != null; #else return false; @@ -83,7 +83,7 @@ namespace DG.Tweening MonoBehaviour target, bool tweenRigidbody, bool isLocal, Path path, float duration, PathMode pathMode ){ TweenerCore t; -#if DOTPHYSICS +#if true // PHYSICS_MARKER Rigidbody rBody = tweenRigidbody ? target.GetComponent() : null; if (tweenRigidbody && rBody != null) { t = isLocal diff --git a/UnityTests.Unity5/ProjectSettings/ProjectSettings.asset b/UnityTests.Unity5/ProjectSettings/ProjectSettings.asset index 4ceded1..336425d 100644 Binary files a/UnityTests.Unity5/ProjectSettings/ProjectSettings.asset and b/UnityTests.Unity5/ProjectSettings/ProjectSettings.asset differ diff --git a/_DOTween.Assembly/DOTween/DOTween.cs b/_DOTween.Assembly/DOTween/DOTween.cs index a4bdc59..697c135 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.020"; // Last version before modules: 1.1.755 + public static readonly string Version = "1.2.050"; // Last version before modules: 1.1.755 /////////////////////////////////////////////// // Options //////////////////////////////////// diff --git a/_DOTween.Assembly/DOTweenEditor/DOTweenDefines.cs b/_DOTween.Assembly/DOTweenEditor/DOTweenDefines.cs index 40988a8..69ece03 100644 --- a/_DOTween.Assembly/DOTweenEditor/DOTweenDefines.cs +++ b/_DOTween.Assembly/DOTweenEditor/DOTweenDefines.cs @@ -16,47 +16,38 @@ namespace DG.DOTweenEditor /// static class DOTweenDefines { + // Legacy (in versions older than 1.2.050) // Modules - public const string GlobalDefine_AudioModule = "DOTAUDIO"; - public const string GlobalDefine_PhysicsModule = "DOTPHYSICS"; - public const string GlobalDefine_Physics2DModule = "DOTPHYSICS2D"; - public const string GlobalDefine_SpriteModule = "DOTSPRITE"; - public const string GlobalDefine_UIModule = "DOTUI"; + public const string GlobalDefine_Legacy_AudioModule = "DOTAUDIO"; + public const string GlobalDefine_Legacy_PhysicsModule = "DOTPHYSICS"; + public const string GlobalDefine_Legacy_Physics2DModule = "DOTPHYSICS2D"; + public const string GlobalDefine_Legacy_SpriteModule = "DOTSPRITE"; + public const string GlobalDefine_Legacy_UIModule = "DOTUI"; // External assets defines - public const string GlobalDefine_TK2D = "DOTWEEN_TK2D"; - public const string GlobalDefine_TextMeshPro = "DOTWEEN_TMP"; + public const string GlobalDefine_Legacy_TK2D = "DOTWEEN_TK2D"; + public const string GlobalDefine_Legacy_TextMeshPro = "DOTWEEN_TMP"; // Legacy (in versions older than 1.2.000) public const string GlobalDefine_Legacy_NoRigidbody = "DOTWEEN_NORBODY"; // Removes all DOTween defines including the ones for external assets public static void RemoveAllDefines() { - EditorUtils.RemoveGlobalDefine(GlobalDefine_AudioModule); - EditorUtils.RemoveGlobalDefine(GlobalDefine_PhysicsModule); - EditorUtils.RemoveGlobalDefine(GlobalDefine_Physics2DModule); - EditorUtils.RemoveGlobalDefine(GlobalDefine_SpriteModule); - EditorUtils.RemoveGlobalDefine(GlobalDefine_UIModule); - - EditorUtils.RemoveGlobalDefine(GlobalDefine_Legacy_NoRigidbody); - - EditorUtils.RemoveGlobalDefine(GlobalDefine_TK2D); - EditorUtils.RemoveGlobalDefine(GlobalDefine_TextMeshPro); + // No defines currently in use } // Removes all legacy defines public static void RemoveAllLegacyDefines() { - EditorUtils.RemoveGlobalDefine(GlobalDefine_Legacy_NoRigidbody); - } + EditorUtils.RemoveGlobalDefine(GlobalDefine_Legacy_AudioModule); + EditorUtils.RemoveGlobalDefine(GlobalDefine_Legacy_PhysicsModule); + EditorUtils.RemoveGlobalDefine(GlobalDefine_Legacy_Physics2DModule); + EditorUtils.RemoveGlobalDefine(GlobalDefine_Legacy_SpriteModule); + EditorUtils.RemoveGlobalDefine(GlobalDefine_Legacy_UIModule); - // Adds all Unity Modules defines but not the ones for external assets - public static void AddAllUnityDefines() - { - EditorUtils.AddGlobalDefine(GlobalDefine_AudioModule); - EditorUtils.AddGlobalDefine(GlobalDefine_PhysicsModule); - EditorUtils.AddGlobalDefine(GlobalDefine_Physics2DModule); - EditorUtils.AddGlobalDefine(GlobalDefine_SpriteModule); - EditorUtils.AddGlobalDefine(GlobalDefine_UIModule); + EditorUtils.RemoveGlobalDefine(GlobalDefine_Legacy_NoRigidbody); + + EditorUtils.RemoveGlobalDefine(GlobalDefine_Legacy_TK2D); + EditorUtils.RemoveGlobalDefine(GlobalDefine_Legacy_TextMeshPro); } @@ -116,13 +107,13 @@ namespace DG.DOTweenEditor // // PRO > 2DToolkit shortcuts // if (Has2DToolkit()) { // totImported += ImportAddons("Tk2d", proAddonsDir); -// EditorUtils.AddGlobalDefine(GlobalDefine_TK2D); -// } else EditorUtils.RemoveGlobalDefine(GlobalDefine_TK2D); +// EditorUtils.AddGlobalDefine(GlobalDefine_Legacy_TK2D); +// } else EditorUtils.RemoveGlobalDefine(GlobalDefine_Legacy_TK2D); // // PRO > TextMeshPro shortcuts // if (HasTextMeshPro()) { // totImported += ImportAddons("TextMeshPro", proAddonsDir); -// EditorUtils.AddGlobalDefine(GlobalDefine_TextMeshPro); -// } else EditorUtils.RemoveGlobalDefine(GlobalDefine_TextMeshPro); +// EditorUtils.AddGlobalDefine(GlobalDefine_Legacy_TextMeshPro); +// } else EditorUtils.RemoveGlobalDefine(GlobalDefine_Legacy_TextMeshPro); // } // // SetupComplete(addonsDir, proAddonsDir, totImported); diff --git a/_DOTween.Assembly/DOTweenEditor/EditorUtils.cs b/_DOTween.Assembly/DOTweenEditor/EditorUtils.cs index 6ac6a48..d886b77 100644 --- a/_DOTween.Assembly/DOTweenEditor/EditorUtils.cs +++ b/_DOTween.Assembly/DOTweenEditor/EditorUtils.cs @@ -131,6 +131,7 @@ namespace DG.DOTweenEditor adbDOTweenDir + "DOTween50.dll.mdb.addon", // adbDOTweenDir + "DOTweenTextMeshPro.cs.addon", + adbDOTweenDir + "DOTweenTextMeshPro_mod.cs", adbDOTweenDir + "DOTweenTk2d.cs.addon", }); AssetDatabase.StopAssetEditing(); diff --git a/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindow.cs b/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindow.cs index ffad3dd..c3e23c9 100644 --- a/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindow.cs +++ b/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindow.cs @@ -163,6 +163,7 @@ namespace DG.DOTweenEditor.UI _src.showModulesPanel = true; EditorUtility.SetDirty(_src); EditorUtils.DeleteLegacyNoModulesDOTweenFiles(); + DOTweenDefines.RemoveAllLegacyDefines(); EditorUtils.DeleteDOTweenUpgradeManagerFiles(); return; } diff --git a/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindowModules.cs b/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindowModules.cs index dca6c9e..a720624 100644 --- a/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindowModules.cs +++ b/_DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindowModules.cs @@ -3,6 +3,7 @@ // License Copyright (c) Daniele Giardini // This work is subject to the terms at http://dotween.demigiant.com/license.php +using System.IO; using DG.Tweening.Core; using UnityEditor; using UnityEngine; @@ -11,33 +12,36 @@ namespace DG.DOTweenEditor.UI { public static class DOTweenUtilityWindowModules { - static bool _refreshed; - static bool _hasAudioModule; - static bool _hasPhysicsModule; - static bool _hasPhysics2DModule; - static bool _hasSpriteModule; - static bool _hasUIModule; + const string ModuleMarkerId = "MODULE_MARKER"; - static bool _hasTextMeshProModule; - static bool _hasTk2DModule; + static readonly ModuleInfo _audioModule = new ModuleInfo("Modules/DOTweenModuleAudio.cs", "AUDIO"); + static readonly ModuleInfo _physicsModule = new ModuleInfo("Modules/DOTweenModulePhysics.cs", "PHYSICS"); + static readonly ModuleInfo _physics2DModule = new ModuleInfo("Modules/DOTweenModulePhysics2D.cs", "PHYSICS2D"); + static readonly ModuleInfo _spriteModule = new ModuleInfo("Modules/DOTweenModuleSprite.cs", "SPRITE"); + static readonly ModuleInfo _uiModule = new ModuleInfo("Modules/DOTweenModuleUI.cs", "UI"); + static readonly ModuleInfo _textMeshProModule = new ModuleInfo("DOTweenTextMeshPro.cs", "TEXTMESHPRO"); + static readonly ModuleInfo _tk2DModule = new ModuleInfo("DOTweenTk2D.cs", "TK2D"); + + static readonly string _ModuleUtilsPath = "Modules/DOTweenModuleUtils.cs"; static EditorWindow _editor; + static bool _refreshed; static bool _isWaitingForCompilation; - public static void Refresh() + static DOTweenUtilityWindowModules() { - _refreshed = true; - - _hasAudioModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_AudioModule); - _hasPhysicsModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_PhysicsModule); - _hasPhysics2DModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_Physics2DModule); - _hasSpriteModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_SpriteModule); - _hasUIModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_UIModule); - - _hasTextMeshProModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_TextMeshPro); - _hasTk2DModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_TK2D); + _ModuleUtilsPath = EditorUtils.dotweenDir + _ModuleUtilsPath; + _audioModule.filePath = EditorUtils.dotweenDir + _audioModule.filePath; + _physicsModule.filePath = EditorUtils.dotweenDir + _physicsModule.filePath; + _physics2DModule.filePath = EditorUtils.dotweenDir + _physics2DModule.filePath; + _spriteModule.filePath = EditorUtils.dotweenDir + _spriteModule.filePath; + _uiModule.filePath = EditorUtils.dotweenDir + _uiModule.filePath; + _textMeshProModule.filePath = EditorUtils.dotweenProDir + _textMeshProModule.filePath; + _tk2DModule.filePath = EditorUtils.dotweenProDir + _tk2DModule.filePath; } + #region GUI + // Returns TRUE if it should be closed public static bool Draw(EditorWindow editor) { @@ -50,17 +54,17 @@ namespace DG.DOTweenEditor.UI EditorGUI.BeginDisabledGroup(EditorApplication.isCompiling); GUILayout.BeginVertical(UnityEngine.GUI.skin.box); GUILayout.Label("Unity", EditorGUIUtils.boldLabelStyle); - _hasAudioModule = EditorGUILayout.Toggle("Audio", _hasAudioModule); - _hasPhysicsModule = EditorGUILayout.Toggle("Physics", _hasPhysicsModule); - _hasPhysics2DModule = EditorGUILayout.Toggle("Physics2D", _hasPhysics2DModule); - _hasSpriteModule = EditorGUILayout.Toggle("Sprites", _hasSpriteModule); - _hasUIModule = EditorGUILayout.Toggle("UI", _hasUIModule); + _audioModule.enabled = EditorGUILayout.Toggle("Audio", _audioModule.enabled); + _physicsModule.enabled = EditorGUILayout.Toggle("Physics", _physicsModule.enabled); + _physics2DModule.enabled = EditorGUILayout.Toggle("Physics2D", _physics2DModule.enabled); + _spriteModule.enabled = EditorGUILayout.Toggle("Sprites", _spriteModule.enabled); + _uiModule.enabled = EditorGUILayout.Toggle("UI", _uiModule.enabled); EditorGUILayout.EndVertical(); if (EditorUtils.hasPro) { GUILayout.BeginVertical(UnityEngine.GUI.skin.box); GUILayout.Label("External Assets (Pro)", EditorGUIUtils.boldLabelStyle); - _hasTk2DModule = EditorGUILayout.Toggle("2D Toolkit", _hasTk2DModule); - _hasTextMeshProModule = EditorGUILayout.Toggle("TextMesh Pro", _hasTextMeshProModule); + _textMeshProModule.enabled = EditorGUILayout.Toggle("TextMesh Pro", _textMeshProModule.enabled); + _tk2DModule.enabled = EditorGUILayout.Toggle("2D Toolkit", _tk2DModule.enabled); EditorGUILayout.EndVertical(); } @@ -82,29 +86,6 @@ namespace DG.DOTweenEditor.UI return false; } - static void Apply() - { - ModifyDefineIfChanged(_hasAudioModule, DOTweenDefines.GlobalDefine_AudioModule); - ModifyDefineIfChanged(_hasPhysicsModule, DOTweenDefines.GlobalDefine_PhysicsModule); - ModifyDefineIfChanged(_hasPhysics2DModule, DOTweenDefines.GlobalDefine_Physics2DModule); - ModifyDefineIfChanged(_hasSpriteModule, DOTweenDefines.GlobalDefine_SpriteModule); - ModifyDefineIfChanged(_hasUIModule, DOTweenDefines.GlobalDefine_UIModule); - - if (EditorUtils.hasPro) { - ModifyDefineIfChanged(_hasTextMeshProModule, DOTweenDefines.GlobalDefine_TextMeshPro); - ModifyDefineIfChanged(_hasTk2DModule, DOTweenDefines.GlobalDefine_TK2D); - } - } - - static void ModifyDefineIfChanged(bool wantsToBeSet, string defineId) - { - bool hasDefine = EditorUtils.HasGlobalDefine(defineId); - if (wantsToBeSet != hasDefine) { - if (wantsToBeSet) EditorUtils.AddGlobalDefine(defineId); - else EditorUtils.RemoveGlobalDefine(defineId); - } - } - static void WaitForCompilation() { if (!_isWaitingForCompilation) { @@ -112,9 +93,6 @@ namespace DG.DOTweenEditor.UI EditorApplication.update += WaitForCompilation_Update; WaitForCompilation_Update(); } - -// Rect r = GUILayoutUtility.GetLastRect(); -// EditorGUI.HelpBox(r, "Waiting for Unity to finish the compilation process...", MessageType.Info); EditorGUILayout.HelpBox("Waiting for Unity to finish the compilation process...", MessageType.Info); } @@ -127,5 +105,105 @@ namespace DG.DOTweenEditor.UI } _editor.Repaint(); } + + #endregion + + #region Methods + + public static void Refresh() + { + _refreshed = true; + + _audioModule.enabled = ModuleIsEnabled(_audioModule); + _physicsModule.enabled = ModuleIsEnabled(_physicsModule); + _physics2DModule.enabled = ModuleIsEnabled(_physics2DModule); + _spriteModule.enabled = ModuleIsEnabled(_spriteModule); + _uiModule.enabled = ModuleIsEnabled(_uiModule); + + _textMeshProModule.enabled = ModuleIsEnabled(_textMeshProModule); + _tk2DModule.enabled = ModuleIsEnabled(_tk2DModule); + } + + static void Apply() + { + AssetDatabase.StartAssetEditing(); + ToggleModule(_audioModule); + ToggleModule(_physicsModule); + ToggleModule(_physics2DModule); + ToggleModule(_spriteModule); + ToggleModule(_uiModule); + + if (EditorUtils.hasPro) { + ToggleModule(_textMeshProModule); + ToggleModule(_tk2DModule); + } + AssetDatabase.StopAssetEditing(); + } + + static bool ModuleIsEnabled(ModuleInfo m) + { + if (!File.Exists(m.filePath)) return false; + + using (StreamReader sr = new StreamReader(m.filePath)) { + string line = sr.ReadLine(); + while (line != null) { + if (line.EndsWith(ModuleMarkerId) && line.TrimStart().StartsWith("#if")) return line.Contains("#if true"); + line = sr.ReadLine(); + } + } + return true; + } + + static void ToggleModule(ModuleInfo m) + { + if (!File.Exists(m.filePath)) return; + if (ModuleIsEnabled(m) == m.enabled) return; // Already set + + string[] lines = File.ReadAllLines(m.filePath); + using (StreamWriter sw = new StreamWriter(m.filePath)) { + for (int i = 0; i < lines.Length; ++i) { + string s = lines[i]; + if (s.EndsWith(ModuleMarkerId) && s.TrimStart().StartsWith("#if")) { + s = m.enabled ? s.Replace("#if false", "#if true") : s.Replace("#if true", "#if false"); + } + sw.WriteLine(s); + } + } + AssetDatabase.ImportAsset(EditorUtils.FullPathToADBPath(m.filePath), ImportAssetOptions.Default); + + // Enable/disable conditions inside DOTweenModuleUtils.cs + if (!File.Exists(_ModuleUtilsPath)) return; + string marker = m.id + "_MARKER"; + lines = File.ReadAllLines(_ModuleUtilsPath); + using (StreamWriter sw = new StreamWriter(_ModuleUtilsPath)) { + for (int i = 0; i < lines.Length; ++i) { + string s = lines[i]; + if (s.EndsWith(marker) && s.TrimStart().StartsWith("#if")) { + s = m.enabled ? s.Replace("#if false", "#if true") : s.Replace("#if true", "#if false"); + } + sw.WriteLine(s); + } + } + AssetDatabase.ImportAsset(EditorUtils.FullPathToADBPath(_ModuleUtilsPath), ImportAssetOptions.Default); + } + + #endregion + + // █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ + // ███ INTERNAL CLASSES ████████████████████████████████████████████████████████████████████████████████████████████████ + // █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ + + class ModuleInfo + { + public bool enabled; + public string filePath; + public readonly string id; // ID is used exclusively with DOTweenModuleUtils, to determine if the line is related to this module + + public ModuleInfo(string filePath, string id) + { + this.filePath = filePath; + this.id = id; + } + } } } \ No newline at end of file diff --git a/_DOTween.Assembly/bin/DOTween.dll b/_DOTween.Assembly/bin/DOTween.dll index 7e589f6..c8abe88 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 7f88a5f..a3a6b24 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 38c5acc..aa0823d 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 8a954a6..5270e62 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 495130b..9443ec2 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 5a846a9..70ae7a7 100644 Binary files a/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb and b/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb differ diff --git a/_DOTween.Assembly/bin/Modules/DOTweenModuleAudio.cs b/_DOTween.Assembly/bin/Modules/DOTweenModuleAudio.cs index c9b77af..e7c4fc1 100644 --- a/_DOTween.Assembly/bin/Modules/DOTweenModuleAudio.cs +++ b/_DOTween.Assembly/bin/Modules/DOTweenModuleAudio.cs @@ -1,7 +1,7 @@ // Author: Daniele Giardini - http://www.demigiant.com // Created: 2018/07/13 -#if DOTAUDIO +#if true // MODULE_MARKER using System; using UnityEngine; using UnityEngine.Audio; diff --git a/_DOTween.Assembly/bin/Modules/DOTweenModulePhysics.cs b/_DOTween.Assembly/bin/Modules/DOTweenModulePhysics.cs index dca71a0..2a85cc6 100644 --- a/_DOTween.Assembly/bin/Modules/DOTweenModulePhysics.cs +++ b/_DOTween.Assembly/bin/Modules/DOTweenModulePhysics.cs @@ -1,7 +1,7 @@ // Author: Daniele Giardini - http://www.demigiant.com // Created: 2018/07/13 -#if DOTPHYSICS +#if true // MODULE_MARKER using System; using DG.Tweening.Core; using DG.Tweening.Core.Enums; diff --git a/_DOTween.Assembly/bin/Modules/DOTweenModulePhysics2D.cs b/_DOTween.Assembly/bin/Modules/DOTweenModulePhysics2D.cs index ba8625f..f4e2aa2 100644 --- a/_DOTween.Assembly/bin/Modules/DOTweenModulePhysics2D.cs +++ b/_DOTween.Assembly/bin/Modules/DOTweenModulePhysics2D.cs @@ -1,7 +1,7 @@ // Author: Daniele Giardini - http://www.demigiant.com // Created: 2018/07/13 -#if DOTPHYSICS2D && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) +#if true && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) // MODULE_MARKER using System; using UnityEngine; diff --git a/_DOTween.Assembly/bin/Modules/DOTweenModuleSprite.cs b/_DOTween.Assembly/bin/Modules/DOTweenModuleSprite.cs index 21f5d60..12e07aa 100644 --- a/_DOTween.Assembly/bin/Modules/DOTweenModuleSprite.cs +++ b/_DOTween.Assembly/bin/Modules/DOTweenModuleSprite.cs @@ -1,7 +1,7 @@ // Author: Daniele Giardini - http://www.demigiant.com // Created: 2018/07/13 -#if DOTSPRITE && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) +#if true && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) // MODULE_MARKER using System; using UnityEngine; using DG.Tweening.Core; diff --git a/_DOTween.Assembly/bin/Modules/DOTweenModuleUI.cs b/_DOTween.Assembly/bin/Modules/DOTweenModuleUI.cs index de800d5..df2b42c 100644 --- a/_DOTween.Assembly/bin/Modules/DOTweenModuleUI.cs +++ b/_DOTween.Assembly/bin/Modules/DOTweenModuleUI.cs @@ -1,7 +1,7 @@ // Author: Daniele Giardini - http://www.demigiant.com // Created: 2018/07/13 -#if DOTUI && (UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) +#if true && (UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) // MODULE_MARKER using System; using UnityEngine; using UnityEngine.UI; diff --git a/_DOTween.Assembly/bin/Modules/DOTweenModuleUtils.cs b/_DOTween.Assembly/bin/Modules/DOTweenModuleUtils.cs index a768721..3115bb2 100644 --- a/_DOTween.Assembly/bin/Modules/DOTweenModuleUtils.cs +++ b/_DOTween.Assembly/bin/Modules/DOTweenModuleUtils.cs @@ -46,7 +46,7 @@ namespace DG.Tweening // Called via DOTweenExternalCommand callback public static void SetOrientationOnPath(PathOptions options, Tween t, Quaternion newRot, Transform trans) { -#if DOTPHYSICS +#if true // PHYSICS_MARKER if (options.isRigidbody) ((Rigidbody)t.target).rotation = newRot; else trans.rotation = newRot; #else @@ -57,7 +57,7 @@ namespace DG.Tweening // Returns FALSE if the DOTween's Physics2D Module is disabled, or if there's no Rigidbody2D attached public static bool HasRigidbody2D(Component target) { -#if DOTPHYSICS2D +#if true // PHYSICS2D_MARKER return target.GetComponent() != null; #else return false; @@ -71,7 +71,7 @@ namespace DG.Tweening // Returns FALSE if the DOTween's Physics Module is disabled, or if there's no rigidbody attached public static bool HasRigidbody(Component target) { -#if DOTPHYSICS +#if true // PHYSICS_MARKER return target.GetComponent() != null; #else return false; @@ -83,7 +83,7 @@ namespace DG.Tweening MonoBehaviour target, bool tweenRigidbody, bool isLocal, Path path, float duration, PathMode pathMode ){ TweenerCore t; -#if DOTPHYSICS +#if true // PHYSICS_MARKER Rigidbody rBody = tweenRigidbody ? target.GetComponent() : null; if (tweenRigidbody && rBody != null) { t = isLocal