1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 17:26:03 +08:00

Added optional "changeDelayTo" parameter to Restart methods

This commit is contained in:
Demigiant 2017-02-19 11:15:59 +01:00
parent 37fef411db
commit a3c95d9fc9
53 changed files with 110 additions and 28 deletions

View File

@ -662,12 +662,16 @@
<member name="M:DG.Tweening.DOTween.RestartAll(System.Boolean)">
<summary>Restarts all tweens, then returns the number of actual tweens restarted</summary>
</member>
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Boolean)">
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Boolean,System.Single)">
<summary>Restarts all tweens with the given ID or target, then returns the number of actual tweens restarted</summary>
<param name="includeDelay">If TRUE includes the eventual tweens delays, otherwise skips them</param>
<param name="changeDelayTo">If >= 0 changes the startup delay of all involved tweens to this value, otherwise doesn't touch it</param>
</member>
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Object,System.Boolean)">
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Object,System.Boolean,System.Single)">
<summary>Restarts all tweens with the given target and the given ID, and returns the number of actual tweens played
(meaning the tweens that were not already playing or complete)</summary>
<param name="includeDelay">If TRUE includes the eventual tweens delays, otherwise skips them</param>
<param name="changeDelayTo">If >= 0 changes the startup delay of all involved tweens to this value, otherwise doesn't touch it</param>
</member>
<member name="M:DG.Tweening.DOTween.RewindAll(System.Boolean)">
<summary>Rewinds and pauses all tweens, then returns the number of actual tweens rewinded
@ -1020,9 +1024,10 @@
<member name="M:DG.Tweening.TweenExtensions.PlayForward(DG.Tweening.Tween)">
<summary>Sets the tween in a forward direction and plays it</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions.Restart(DG.Tweening.Tween,System.Boolean)">
<member name="M:DG.Tweening.TweenExtensions.Restart(DG.Tweening.Tween,System.Boolean,System.Single)">
<summary>Restarts the tween from the beginning</summary>
<param name="includeDelay">If TRUE includes the eventual tween delay, otherwise skips it</param>
<param name="changeDelayTo">If >= 0 changes the startup delay to this value, otherwise doesn't touch it</param>
</member>
<member name="M:DG.Tweening.TweenExtensions.Rewind(DG.Tweening.Tween,System.Boolean)">
<summary>Rewinds and pauses the tween</summary>

View File

@ -662,12 +662,16 @@
<member name="M:DG.Tweening.DOTween.RestartAll(System.Boolean)">
<summary>Restarts all tweens, then returns the number of actual tweens restarted</summary>
</member>
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Boolean)">
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Boolean,System.Single)">
<summary>Restarts all tweens with the given ID or target, then returns the number of actual tweens restarted</summary>
<param name="includeDelay">If TRUE includes the eventual tweens delays, otherwise skips them</param>
<param name="changeDelayTo">If >= 0 changes the startup delay of all involved tweens to this value, otherwise doesn't touch it</param>
</member>
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Object,System.Boolean)">
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Object,System.Boolean,System.Single)">
<summary>Restarts all tweens with the given target and the given ID, and returns the number of actual tweens played
(meaning the tweens that were not already playing or complete)</summary>
<param name="includeDelay">If TRUE includes the eventual tweens delays, otherwise skips them</param>
<param name="changeDelayTo">If >= 0 changes the startup delay of all involved tweens to this value, otherwise doesn't touch it</param>
</member>
<member name="M:DG.Tweening.DOTween.RewindAll(System.Boolean)">
<summary>Rewinds and pauses all tweens, then returns the number of actual tweens rewinded
@ -1020,9 +1024,10 @@
<member name="M:DG.Tweening.TweenExtensions.PlayForward(DG.Tweening.Tween)">
<summary>Sets the tween in a forward direction and plays it</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions.Restart(DG.Tweening.Tween,System.Boolean)">
<member name="M:DG.Tweening.TweenExtensions.Restart(DG.Tweening.Tween,System.Boolean,System.Single)">
<summary>Restarts the tween from the beginning</summary>
<param name="includeDelay">If TRUE includes the eventual tween delay, otherwise skips it</param>
<param name="changeDelayTo">If >= 0 changes the startup delay to this value, otherwise doesn't touch it</param>
</member>
<member name="M:DG.Tweening.TweenExtensions.Rewind(DG.Tweening.Tween,System.Boolean)">
<summary>Rewinds and pauses the tween</summary>

View File

@ -662,12 +662,16 @@
<member name="M:DG.Tweening.DOTween.RestartAll(System.Boolean)">
<summary>Restarts all tweens, then returns the number of actual tweens restarted</summary>
</member>
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Boolean)">
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Boolean,System.Single)">
<summary>Restarts all tweens with the given ID or target, then returns the number of actual tweens restarted</summary>
<param name="includeDelay">If TRUE includes the eventual tweens delays, otherwise skips them</param>
<param name="changeDelayTo">If >= 0 changes the startup delay of all involved tweens to this value, otherwise doesn't touch it</param>
</member>
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Object,System.Boolean)">
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Object,System.Boolean,System.Single)">
<summary>Restarts all tweens with the given target and the given ID, and returns the number of actual tweens played
(meaning the tweens that were not already playing or complete)</summary>
<param name="includeDelay">If TRUE includes the eventual tweens delays, otherwise skips them</param>
<param name="changeDelayTo">If >= 0 changes the startup delay of all involved tweens to this value, otherwise doesn't touch it</param>
</member>
<member name="M:DG.Tweening.DOTween.RewindAll(System.Boolean)">
<summary>Rewinds and pauses all tweens, then returns the number of actual tweens rewinded
@ -1020,9 +1024,10 @@
<member name="M:DG.Tweening.TweenExtensions.PlayForward(DG.Tweening.Tween)">
<summary>Sets the tween in a forward direction and plays it</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions.Restart(DG.Tweening.Tween,System.Boolean)">
<member name="M:DG.Tweening.TweenExtensions.Restart(DG.Tweening.Tween,System.Boolean,System.Single)">
<summary>Restarts the tween from the beginning</summary>
<param name="includeDelay">If TRUE includes the eventual tween delay, otherwise skips it</param>
<param name="changeDelayTo">If >= 0 changes the startup delay to this value, otherwise doesn't touch it</param>
</member>
<member name="M:DG.Tweening.TweenExtensions.Rewind(DG.Tweening.Tween,System.Boolean)">
<summary>Rewinds and pauses the tween</summary>

View File

@ -5,15 +5,23 @@ using DG.Tweening;
public class TempPro : MonoBehaviour
{
public Transform target;
public DOTweenPath target;
void Start ()
IEnumerator Start()
{
target.DOMoveX(3, 1).OnComplete(TempPro.OnCompleteCallback);
Tween t = this.transform.DOMoveX(2, 2).OnRewind(()=> Debug.Log("Rewind 0"));
yield return new WaitForSeconds(1);
t.Rewind();
// target.GetTween().Rewind();
}
public static void OnCompleteCallback()
public void OnComplete()
{
Debug.Log("Hello I'm public! And Static! Love me!");
Debug.Log("COMPLETE");
}
public void OnRewind()
{
Debug.Log("REWIND");
}
}

View File

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class RestartAndChangeDelay : BrainBase
{
public Transform target;
Tween tween;
void Start()
{
tween = target.DOMoveX(2, 1).SetDelay(2).SetAutoKill(false)
.OnPlay(()=> Debug.Log("Play"));
}
public void Restart(float delay)
{
Debug.Log("Restart");
tween.Restart(true, delay);
}
public void Restart()
{
Debug.Log("Restart");
tween.Restart();
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 64c657372e0ab45408b6f9684c9703aa
timeCreated: 1487498114
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d252004f1d313fe448a64fff6db34230
timeCreated: 1487498101
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -510,7 +510,7 @@ namespace DG.Tweening.Core
if (PlayForward(t)) totInvolved++;
break;
case OperationType.Restart:
if (Restart(t, optionalBool)) totInvolved++;
if (Restart(t, optionalBool, optionalFloat)) totInvolved++;
break;
case OperationType.Rewind:
if (Rewind(t, optionalBool)) totInvolved++;
@ -641,10 +641,11 @@ namespace DG.Tweening.Core
return Play(t);
}
internal static bool Restart(Tween t, bool includeDelay = true)
internal static bool Restart(Tween t, bool includeDelay = true, float changeDelayTo = -1)
{
bool wasPaused = !t.isPlaying;
t.isBackwards = false;
if (changeDelayTo >= 0) t.delay = changeDelayTo;
Rewind(t, includeDelay);
t.isPlaying = true;
if (wasPaused && t.playedOnce && t.delayComplete && t.onPlay != null) {

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.1.560";
public static readonly string Version = "1.1.570";
///////////////////////////////////////////////
// Options ////////////////////////////////////
@ -816,17 +816,21 @@ namespace DG.Tweening
return TweenManager.FilteredOperation(OperationType.Restart, FilterType.All, null, includeDelay, 0);
}
/// <summary>Restarts all tweens with the given ID or target, then returns the number of actual tweens restarted</summary>
public static int Restart(object targetOrId, bool includeDelay = true)
/// <param name="includeDelay">If TRUE includes the eventual tweens delays, otherwise skips them</param>
/// <param name="changeDelayTo">If >= 0 changes the startup delay of all involved tweens to this value, otherwise doesn't touch it</param>
public static int Restart(object targetOrId, bool includeDelay = true, float changeDelayTo = -1)
{
if (targetOrId == null) return 0;
return TweenManager.FilteredOperation(OperationType.Restart, FilterType.TargetOrId, targetOrId, includeDelay, 0);
return TweenManager.FilteredOperation(OperationType.Restart, FilterType.TargetOrId, targetOrId, includeDelay, changeDelayTo);
}
/// <summary>Restarts all tweens with the given target and the given ID, and returns the number of actual tweens played
/// (meaning the tweens that were not already playing or complete)</summary>
public static int Restart(object target, object id, bool includeDelay = true)
/// <param name="includeDelay">If TRUE includes the eventual tweens delays, otherwise skips them</param>
/// <param name="changeDelayTo">If >= 0 changes the startup delay of all involved tweens to this value, otherwise doesn't touch it</param>
public static int Restart(object target, object id, bool includeDelay = true, float changeDelayTo = -1)
{
if (target == null || id == null) return 0;
return TweenManager.FilteredOperation(OperationType.Restart, FilterType.TargetAndId, id, includeDelay, 0, target);
return TweenManager.FilteredOperation(OperationType.Restart, FilterType.TargetAndId, id, includeDelay, changeDelayTo, target);
}
/// <summary>Rewinds and pauses all tweens, then returns the number of actual tweens rewinded

View File

@ -187,7 +187,8 @@ namespace DG.Tweening
/// <summary>Restarts the tween from the beginning</summary>
/// <param name="includeDelay">If TRUE includes the eventual tween delay, otherwise skips it</param>
public static void Restart(this Tween t, bool includeDelay = true)
/// <param name="changeDelayTo">If >= 0 changes the startup delay to this value, otherwise doesn't touch it</param>
public static void Restart(this Tween t, bool includeDelay = true, float changeDelayTo = -1)
{
if (t == null) {
if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return;
@ -197,7 +198,7 @@ namespace DG.Tweening
if (Debugger.logPriority > 1) Debugger.LogNestedTween(t); return;
}
TweenManager.Restart(t, includeDelay);
TweenManager.Restart(t, includeDelay, changeDelayTo);
}
/// <summary>Rewinds and pauses the tween</summary>

View File

@ -662,12 +662,16 @@
<member name="M:DG.Tweening.DOTween.RestartAll(System.Boolean)">
<summary>Restarts all tweens, then returns the number of actual tweens restarted</summary>
</member>
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Boolean)">
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Boolean,System.Single)">
<summary>Restarts all tweens with the given ID or target, then returns the number of actual tweens restarted</summary>
<param name="includeDelay">If TRUE includes the eventual tweens delays, otherwise skips them</param>
<param name="changeDelayTo">If >= 0 changes the startup delay of all involved tweens to this value, otherwise doesn't touch it</param>
</member>
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Object,System.Boolean)">
<member name="M:DG.Tweening.DOTween.Restart(System.Object,System.Object,System.Boolean,System.Single)">
<summary>Restarts all tweens with the given target and the given ID, and returns the number of actual tweens played
(meaning the tweens that were not already playing or complete)</summary>
<param name="includeDelay">If TRUE includes the eventual tweens delays, otherwise skips them</param>
<param name="changeDelayTo">If >= 0 changes the startup delay of all involved tweens to this value, otherwise doesn't touch it</param>
</member>
<member name="M:DG.Tweening.DOTween.RewindAll(System.Boolean)">
<summary>Rewinds and pauses all tweens, then returns the number of actual tweens rewinded
@ -1020,9 +1024,10 @@
<member name="M:DG.Tweening.TweenExtensions.PlayForward(DG.Tweening.Tween)">
<summary>Sets the tween in a forward direction and plays it</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions.Restart(DG.Tweening.Tween,System.Boolean)">
<member name="M:DG.Tweening.TweenExtensions.Restart(DG.Tweening.Tween,System.Boolean,System.Single)">
<summary>Restarts the tween from the beginning</summary>
<param name="includeDelay">If TRUE includes the eventual tween delay, otherwise skips it</param>
<param name="changeDelayTo">If >= 0 changes the startup delay to this value, otherwise doesn't touch it</param>
</member>
<member name="M:DG.Tweening.TweenExtensions.Rewind(DG.Tweening.Tween,System.Boolean)">
<summary>Rewinds and pauses the tween</summary>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.