1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2026-03-26 22:49:03 +08:00

Fixed OnPlay being called immediately (after the first run) in spite of eventual delays

This commit is contained in:
Demigiant 2016-02-09 13:19:52 +01:00
parent 0d75335df2
commit 51ad72269d
45 changed files with 23 additions and 8 deletions

View File

@ -15,4 +15,9 @@ public class TempPro : MonoBehaviour
{
Debug.Log("Tween created > " + anime.tween);
}
public void Output()
{
Debug.Log("HERE");
}
}

View File

@ -12,9 +12,14 @@ public class TempTests : BrainBase
{
public Transform target;
void Start()
IEnumerator Start()
{
Sequence s = DOTween.Sequence()
.Append(target.DOMoveX(2, 2));
Tween t = target.DOMoveX(2, 1).OnPlay(()=>Debug.Log("PLAY")).SetAutoKill(false);
t.SetDelay(1);
yield return new WaitForSeconds(2.5f);
t.Rewind();
t.Play();
}
}

View File

@ -353,6 +353,11 @@ namespace DG.Tweening.Core
continue;
}
if (tDeltaTime <= 0) continue;
// Delay elapsed - call OnPlay if required
if (t.playedOnce && t.onPlay != null) {
// Don't call in case it hasn't started because onStart routine will call it
Tween.OnTweenCallback(t.onPlay);
}
}
// Startup (needs to be here other than in Tween.DoGoto in case of speed-based tweens, to calculate duration correctly)
if (!t.startupDone) {
@ -583,8 +588,8 @@ namespace DG.Tweening.Core
{
if (!t.isPlaying && (!t.isBackwards && !t.isComplete || t.isBackwards && (t.completedLoops > 0 || t.position > 0))) {
t.isPlaying = true;
if (t.playedOnce && t.onPlay != null) {
// Don't call in case it hasn't started because onStart routine will call it
if (t.playedOnce && t.delayComplete && t.onPlay != null) {
// Don't call in case there's a delay to run or if it hasn't started because onStart routine will call it
Tween.OnTweenCallback(t.onPlay);
}
return true;
@ -618,8 +623,8 @@ namespace DG.Tweening.Core
t.isBackwards = false;
Rewind(t, includeDelay);
t.isPlaying = true;
if (wasPaused && t.playedOnce && t.onPlay != null) {
// Don't call in case it hasn't started because onStart routine will call it
if (wasPaused && t.playedOnce && t.delayComplete && t.onPlay != null) {
// Don't call in case there's a delay to run or if it hasn't started because onStart routine will call it
Tween.OnTweenCallback(t.onPlay);
}
return true;

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.1.155";
public static readonly string Version = "1.1.160";
///////////////////////////////////////////////
// Options ////////////////////////////////////

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.