diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll index 43c26b8..e0020b5 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 2c5f703..ba2cfa7 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.XML b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML index 6666e3e..884656c 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML @@ -4,6 +4,26 @@ DOTweenEditor + + + Starts the update loop of tween in the editor. Has no effect during playMode. + + Eventual callback to call after every update + + + + Stops the update loop and clears any callback. + + + + + Readies the tween for editor preview by setting its UpdateType to Manual plus eventual extra settings. + + The tween to ready + If TRUE (recommended) removes all callbacks (OnComplete/Rewind/etc) + If TRUE prevents the tween from being auto-killed at completion + If TRUE starts playing the tween immediately + Checks that the given editor texture use the correct import settings, diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll index 4d26385..0e18d71 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 545a09d..b4f0438 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/DemiLib/Core/Editor/Imgs/whiteSquare.png.meta b/UnityTests.Unity5/Assets/Demigiant/DemiLib/Core/Editor/Imgs/whiteSquare.png.meta index 379a302..c0d50e6 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DemiLib/Core/Editor/Imgs/whiteSquare.png.meta +++ b/UnityTests.Unity5/Assets/Demigiant/DemiLib/Core/Editor/Imgs/whiteSquare.png.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: d3e15b806a8368742ba6f10e794d7b76 -timeCreated: 1533807483 +timeCreated: 1534502369 licenseType: Pro TextureImporter: fileIDToRecycleName: {} diff --git a/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity b/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity index a820515..2b410b6 100644 Binary files a/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity and b/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity differ diff --git a/_DOTween.Assembly/DOTween/DOTween.cs b/_DOTween.Assembly/DOTween/DOTween.cs index 04aaf5a..2fd9640 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.105"; // Last version before modules: 1.1.755 + public static readonly string Version = "1.2.110"; // Last version before modules: 1.1.755 /////////////////////////////////////////////// // Options //////////////////////////////////// diff --git a/_DOTween.Assembly/DOTweenEditor/DOTweenEditor.csproj b/_DOTween.Assembly/DOTweenEditor/DOTweenEditor.csproj index 991141e..6b5294b 100644 --- a/_DOTween.Assembly/DOTweenEditor/DOTweenEditor.csproj +++ b/_DOTween.Assembly/DOTweenEditor/DOTweenEditor.csproj @@ -74,6 +74,7 @@ + diff --git a/_DOTween.Assembly/DOTweenEditor/DOTweenEditorPreview.cs b/_DOTween.Assembly/DOTweenEditor/DOTweenEditorPreview.cs new file mode 100644 index 0000000..428bca8 --- /dev/null +++ b/_DOTween.Assembly/DOTweenEditor/DOTweenEditorPreview.cs @@ -0,0 +1,106 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2018/08/17 12:18 +// License Copyright (c) Daniele Giardini +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using System.Collections.Generic; +using DG.Tweening; +using UnityEditor; +using UnityEngine; +using Object = UnityEngine.Object; + +namespace DG.DOTweenEditor +{ + public static class DOTweenEditorPreview + { + static bool _isPreviewing; + static double _previewTime; + static Action _onPreviewUpdated; + static GameObject _previewObj; // Used so it can be set dirty (otherwise canvas-only tweens won't refresh the view) + + static DOTweenEditorPreview() + { + Clear(); + } + + #region Public Methods + + /// + /// Starts the update loop of tween in the editor. Has no effect during playMode. + /// + /// Eventual callback to call after every update + public static void Start(Action onPreviewUpdated = null) + { + if (_isPreviewing || EditorApplication.isPlayingOrWillChangePlaymode) return; + + _isPreviewing = true; + _onPreviewUpdated = onPreviewUpdated; + _previewTime = EditorApplication.timeSinceStartup; + EditorApplication.update += PreviewUpdate; + _previewObj = new GameObject("-[ DOTween Preview ► ]-", typeof(PreviewComponent)); + } + + /// + /// Stops the update loop and clears any callback. + /// + public static void Stop() + { + _isPreviewing = false; + EditorApplication.update -= PreviewUpdate; + _onPreviewUpdated = null; + Clear(); + } + + /// + /// Readies the tween for editor preview by setting its UpdateType to Manual plus eventual extra settings. + /// + /// The tween to ready + /// If TRUE (recommended) removes all callbacks (OnComplete/Rewind/etc) + /// If TRUE prevents the tween from being auto-killed at completion + /// If TRUE starts playing the tween immediately + public static void PrepareTweenForPreview(Tween t, bool clearCallbacks = true, bool preventAutoKill = true, bool andPlay = true) + { + t.SetUpdate(UpdateType.Manual); + if (preventAutoKill) t.SetAutoKill(false); + if (clearCallbacks) { + t.OnComplete(null) + .OnStart(null).OnPlay(null).OnPause(null).OnUpdate(null).OnWaypointChange(null) + .OnStepComplete(null).OnRewind(null).OnKill(null); + } + if (andPlay) t.Play(); + } + + #endregion + + #region Methods + + static void Clear() + { + _previewObj = null; + // Find and destroy any existing preview objects + PreviewComponent[] objs = Object.FindObjectsOfType(); + for (int i = 0; i < objs.Length; ++i) Object.DestroyImmediate(objs[i].gameObject); + } + + static void PreviewUpdate() + { + double currTime = _previewTime; + _previewTime = EditorApplication.timeSinceStartup; + float elapsed = (float)(_previewTime - currTime); + DOTween.ManualUpdate(elapsed, elapsed); + + if (_previewObj != null) EditorUtility.SetDirty(_previewObj); + + if (_onPreviewUpdated != null) _onPreviewUpdated(); + } + + #endregion + + // █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ + // ███ INTERNAL CLASSES ████████████████████████████████████████████████████████████████████████████████████████████████ + // █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ + + class PreviewComponent : MonoBehaviour {} + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTweenEditor/MenuItems.cs b/_DOTween.Assembly/DOTweenEditor/MenuItems.cs index 8064b38..30b9c51 100644 --- a/_DOTween.Assembly/DOTweenEditor/MenuItems.cs +++ b/_DOTween.Assembly/DOTweenEditor/MenuItems.cs @@ -9,7 +9,7 @@ using UnityEngine; namespace DG.DOTweenEditor { - public static class MenuItems + static class MenuItems { [MenuItem("GameObject/Demigiant/DOTween Manager", false, 20)] static void CreateDOTweenComponent(MenuCommand menuCommand) diff --git a/_DOTween.Assembly/bin/DOTween.dll b/_DOTween.Assembly/bin/DOTween.dll index 43c26b8..e0020b5 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 2c5f703..ba2cfa7 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.XML b/_DOTween.Assembly/bin/Editor/DOTweenEditor.XML index 6666e3e..884656c 100644 --- a/_DOTween.Assembly/bin/Editor/DOTweenEditor.XML +++ b/_DOTween.Assembly/bin/Editor/DOTweenEditor.XML @@ -4,6 +4,26 @@ DOTweenEditor + + + Starts the update loop of tween in the editor. Has no effect during playMode. + + Eventual callback to call after every update + + + + Stops the update loop and clears any callback. + + + + + Readies the tween for editor preview by setting its UpdateType to Manual plus eventual extra settings. + + The tween to ready + If TRUE (recommended) removes all callbacks (OnComplete/Rewind/etc) + If TRUE prevents the tween from being auto-killed at completion + If TRUE starts playing the tween immediately + Checks that the given editor texture use the correct import settings, diff --git a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll index 4d26385..0e18d71 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 545a09d..b4f0438 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 1d42919..a5b800c 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 9c5e59f..abd8a08 100644 Binary files a/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb and b/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb differ