diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML index de60e84..a260f73 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML @@ -1191,12 +1191,12 @@ Restarts the tween from the beginning - If TRUE includes the eventual tween delay, otherwise skips it - If >= 0 changes the startup delay to this value, otherwise doesn't touch it + Ignored in case of Sequences. If TRUE includes the eventual tween delay, otherwise skips it + Ignored in case of Sequences. If >= 0 changes the startup delay to this value, otherwise doesn't touch it Rewinds and pauses the tween - If TRUE includes the eventual tween delay, otherwise skips it + Ignored in case of Sequences. If TRUE includes the eventual tween delay, otherwise skips it Smoothly rewinds the tween (delays excluded). @@ -2457,8 +2457,10 @@ If TRUE sets the target to from value immediately, otherwise waits for the tween to start - Sets a delayed startup for the tween. - Has no effect on Sequences or if the tween has already started + Sets a delayed startup for the tween. + In case of Sequences behaves the same as , + which means the delay will repeat in case of loops (while with tweens it's ignored after the first loop cycle). + Has no effect on Sequences or if the tween has already started Sets the tween as relative diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll index a191937..17629e5 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 4072235..4ce4c30 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 1d4e8c2..e4ad889 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 4c85f54..9f547e4 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 467ae05..f4139b1 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 eefdee1..3ff85a1 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/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.pdb.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.pdb.meta new file mode 100644 index 0000000..8a01ea4 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenUpgradeManager.pdb.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 708f58d16f4025a4483f7673bca8cfd6 +timeCreated: 1576846470 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests/DORotateTests.cs b/UnityTests.Unity5/Assets/_Tests/DORotateTests.cs new file mode 100644 index 0000000..213e6b1 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/DORotateTests.cs @@ -0,0 +1,188 @@ +using System.Collections; +using System.Collections.Generic; +using DG.Tweening; +using DG.Tweening.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +public class DORotateTests : BrainBase +{ + public enum TweenType + { + Normal, + FromCurrent, + FromDirect + } + + [Header("Main")] + public TweenType tweenType = TweenType.Normal; + float tweenDuration = 2; + public bool relative = false; + public Vector2 offsetBetweenDices = new Vector2(7, 4); + public int maxDicesPerRow = 4; + [Header("Fast")] + public Vector3[] fastStartValues = new[] { + new Vector3(0, 0, 0), + new Vector3(85, 0, 0), + new Vector3(95, 0, 0), + new Vector3(180, 0, 0), + new Vector3(0, 85, 0), + new Vector3(0, 95, 0), + new Vector3(0, 0, 85), + new Vector3(0, 0, 95), + new Vector3(180, 0, 0), + }; + public Vector3 fastEndValue = new Vector3(100, 0, 0); + [Header("Beyond360")] + public Vector3[] beyond360StartValues = new[] { + new Vector3(0, 0, 0), + new Vector3(85, 0, 0), + new Vector3(95, 0, 0), + new Vector3(180, 0, 0), + new Vector3(0, 85, 0), + new Vector3(0, 95, 0), + new Vector3(0, 0, 85), + new Vector3(0, 0, 95), + new Vector3(180, 0, 0), + }; + public Vector3 beyond360EndValue = new Vector3(100, 0, 0); + + GameObject[] _dices; + GameObject _diceGroupPrefab; + RotateMode _currRotateMode; + + #region Main Methods + + void Start() + { + _diceGroupPrefab = GameObject.Find("n:DiceGroupPrefab"); + _diceGroupPrefab.SetActive(false); + } + + // Create and distribute dices, then set their rotation + void SetupFor(RotateMode mode) + { + DOTween.KillAll(); + // Destroy previous + if (_dices != null) { + for (int i = 0; i < _dices.Length; ++i) Destroy(_dices[i]); + _dices = null; + } + // Create and distribute + _currRotateMode = mode; + Vector3[] startVals; + Vector3 endVal; + switch (mode) { + case RotateMode.FastBeyond360: + startVals = beyond360StartValues; + endVal = beyond360EndValue; + break; + default: + startVals = fastStartValues; + endVal = fastEndValue; + break; + } + int totDices = startVals.Length; + int totRows = Mathf.CeilToInt(totDices / (float)maxDicesPerRow); + Vector3 startP = new Vector3( + -(offsetBetweenDices.x * (Mathf.Min(totDices, maxDicesPerRow) - 1)) * 0.5f, + (offsetBetweenDices.y * (totRows + 1)) * 0.5f, + 0 + ); + int xIndex = -1; + _dices = new GameObject[totDices]; + for (int i = 0; i < totDices; ++i) { + if (i % maxDicesPerRow == 0) { + xIndex = -1; + startP.y -= offsetBetweenDices.y; + } + xIndex++; + _dices[i] = Instantiate(_diceGroupPrefab, _diceGroupPrefab.transform.parent); + _dices[i].name = "Dice " + i; + _dices[i].SetActive(true); + _dices[i].transform.localPosition = startP + new Vector3(offsetBetweenDices.x, 0, 0) * xIndex; + Transform dice = GetDiceFromGroup(_dices[i]); + dice.localEulerAngles = startVals[i]; + TextMesh label = _dices[i].GetComponentInChildren(); + label.text = startVals[i] + "\n" + endVal; + } + } + + void StartTweening() + { + if (_dices == null) { + Debug.Log("Nothing to tween, Setup something first"); + return; + } + + Vector3[] startVals; + Vector3 endVal; + switch (_currRotateMode) { + case RotateMode.FastBeyond360: + startVals = beyond360StartValues; + endVal = beyond360EndValue; + break; + default: + startVals = fastStartValues; + endVal = fastEndValue; + break; + } + for (int i = 0; i < _dices.Length; ++i) { + Transform dice = GetDiceFromGroup(_dices[i]); + TextMesh label = _dices[i].GetComponentInChildren(); + Vector3 startVal = startVals[i]; + Vector3 actualEndVal = endVal; + Tween t; + switch (tweenType) { + case TweenType.FromCurrent: + actualEndVal = startVal; + t = dice.DOLocalRotate(endVal, tweenDuration, _currRotateMode).From(); + break; + case TweenType.FromDirect: + actualEndVal = startVal; + t = dice.DOLocalRotate(startVal, tweenDuration, _currRotateMode).From(endVal); + break; + default: + t = dice.DOLocalRotate(endVal, tweenDuration, _currRotateMode); + break; + } + t.OnUpdate(() => { + label.text = dice.eulerAngles + "\n" + actualEndVal; + }); + } + } + + #endregion + + #region Utils + + Transform GetDiceFromGroup(GameObject diceGroup) + { + Transform[] ts = diceGroup.GetComponentsInChildren(); + for (int i = 0; i < ts.Length; ++i) { + if (ts[i].name == "Dice") return ts[i]; + } + return null; + } + + #endregion + + #region UI Buttons + + public void SetupForFast() + { + SetupFor(RotateMode.Fast); + } + + public void SetupForBeyond360() + { + SetupFor(RotateMode.FastBeyond360); + } + + public void Tween() + { + StartTweening(); + } + + #endregion +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/DORotateTests.cs.meta b/UnityTests.Unity5/Assets/_Tests/DORotateTests.cs.meta new file mode 100644 index 0000000..facdbc0 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/DORotateTests.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c19f4e9941ebe844b98c268951e3bf17 +timeCreated: 1576676432 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests/DORotateTests.unity b/UnityTests.Unity5/Assets/_Tests/DORotateTests.unity new file mode 100644 index 0000000..a7094e9 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/DORotateTests.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/DORotateTests.unity.meta b/UnityTests.Unity5/Assets/_Tests/DORotateTests.unity.meta new file mode 100644 index 0000000..bac84de --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/DORotateTests.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5a7add83e6f7b3a418466bce176fd5e1 +timeCreated: 1576676415 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests/TempTests.cs b/UnityTests.Unity5/Assets/_Tests/TempTests.cs index d5c17e5..4e2d4aa 100644 --- a/UnityTests.Unity5/Assets/_Tests/TempTests.cs +++ b/UnityTests.Unity5/Assets/_Tests/TempTests.cs @@ -11,8 +11,13 @@ using UnityEngine.UI; public class TempTests : BrainBase { + public Transform target; + IEnumerator Start() { yield return new WaitForSeconds(1); + Sequence s = DOTween.Sequence().Append(target.DOMoveX(2, 1)).SetLoops(-1); + yield return new WaitForSeconds(1f); + s.Restart(true, 1); } } \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/TempTests.unity b/UnityTests.Unity5/Assets/_Tests/TempTests.unity index 1040b79..4252811 100644 Binary files a/UnityTests.Unity5/Assets/_Tests/TempTests.unity and b/UnityTests.Unity5/Assets/_Tests/TempTests.unity differ diff --git a/_DOTween.Assembly/DOTween/Core/TweenManager.cs b/_DOTween.Assembly/DOTween/Core/TweenManager.cs index 09828fc..b9e308a 100644 --- a/_DOTween.Assembly/DOTween/Core/TweenManager.cs +++ b/_DOTween.Assembly/DOTween/Core/TweenManager.cs @@ -769,7 +769,7 @@ namespace DG.Tweening.Core { bool wasPaused = !t.isPlaying; t.isBackwards = false; - if (changeDelayTo >= 0) t.delay = changeDelayTo; + if (changeDelayTo >= 0 && t.tweenType == TweenType.Tweener) t.delay = changeDelayTo; Rewind(t, includeDelay); t.isPlaying = true; if (wasPaused && t.playedOnce && t.delayComplete && t.onPlay != null) { diff --git a/_DOTween.Assembly/DOTween/DOTween.cs b/_DOTween.Assembly/DOTween/DOTween.cs index b9878a7..5a23b48 100644 --- a/_DOTween.Assembly/DOTween/DOTween.cs +++ b/_DOTween.Assembly/DOTween/DOTween.cs @@ -34,7 +34,7 @@ namespace DG.Tweening public class DOTween { /// DOTween's version - public static readonly string Version = "1.2.310"; // Last version before modules: 1.1.755 + public static readonly string Version = "1.2.315"; // Last version before modules: 1.1.755 /////////////////////////////////////////////// // Options //////////////////////////////////// diff --git a/_DOTween.Assembly/DOTween/TweenExtensions.cs b/_DOTween.Assembly/DOTween/TweenExtensions.cs index 166e35a..e8d95fe 100644 --- a/_DOTween.Assembly/DOTween/TweenExtensions.cs +++ b/_DOTween.Assembly/DOTween/TweenExtensions.cs @@ -190,8 +190,8 @@ namespace DG.Tweening } /// Restarts the tween from the beginning - /// If TRUE includes the eventual tween delay, otherwise skips it - /// If >= 0 changes the startup delay to this value, otherwise doesn't touch it + /// Ignored in case of Sequences. If TRUE includes the eventual tween delay, otherwise skips it + /// Ignored in case of Sequences. If >= 0 changes the startup delay to this value, otherwise doesn't touch it public static void Restart(this Tween t, bool includeDelay = true, float changeDelayTo = -1) { if (t == null) { @@ -206,7 +206,7 @@ namespace DG.Tweening } /// Rewinds and pauses the tween - /// If TRUE includes the eventual tween delay, otherwise skips it + /// Ignored in case of Sequences. If TRUE includes the eventual tween delay, otherwise skips it public static void Rewind(this Tween t, bool includeDelay = true) { if (t == null) { diff --git a/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs b/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs index bc70bfc..e9847f1 100644 --- a/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs +++ b/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs @@ -645,8 +645,10 @@ namespace DG.Tweening #endregion - /// Sets a delayed startup for the tween. - /// Has no effect on Sequences or if the tween has already started + /// Sets a delayed startup for the tween. + /// In case of Sequences behaves the same as , + /// which means the delay will repeat in case of loops (while with tweens it's ignored after the first loop cycle). + /// Has no effect on Sequences or if the tween has already started public static T SetDelay(this T t, float delay) where T : Tween { if (t == null || !t.active || t.creationLocked) return t; diff --git a/_DOTween.Assembly/bin/DOTween.XML b/_DOTween.Assembly/bin/DOTween.XML index de60e84..a260f73 100644 --- a/_DOTween.Assembly/bin/DOTween.XML +++ b/_DOTween.Assembly/bin/DOTween.XML @@ -1191,12 +1191,12 @@ Restarts the tween from the beginning - If TRUE includes the eventual tween delay, otherwise skips it - If >= 0 changes the startup delay to this value, otherwise doesn't touch it + Ignored in case of Sequences. If TRUE includes the eventual tween delay, otherwise skips it + Ignored in case of Sequences. If >= 0 changes the startup delay to this value, otherwise doesn't touch it Rewinds and pauses the tween - If TRUE includes the eventual tween delay, otherwise skips it + Ignored in case of Sequences. If TRUE includes the eventual tween delay, otherwise skips it Smoothly rewinds the tween (delays excluded). @@ -2457,8 +2457,10 @@ If TRUE sets the target to from value immediately, otherwise waits for the tween to start - Sets a delayed startup for the tween. - Has no effect on Sequences or if the tween has already started + Sets a delayed startup for the tween. + In case of Sequences behaves the same as , + which means the delay will repeat in case of loops (while with tweens it's ignored after the first loop cycle). + Has no effect on Sequences or if the tween has already started Sets the tween as relative diff --git a/_DOTween.Assembly/bin/DOTween.dll b/_DOTween.Assembly/bin/DOTween.dll index a191937..17629e5 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 4072235..4ce4c30 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 1d4e8c2..e4ad889 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 4c85f54..9f547e4 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 467ae05..f4139b1 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 eefdee1..3ff85a1 100644 Binary files a/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb and b/_DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb differ