mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-21 01:36:05 +08:00
Fix for last nested OnComplete not being called in case of very short Sequences
This commit is contained in:
parent
2f0c080c62
commit
c3c28dd915
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22a87305a04c84e40964cdfae301554e
|
||||
timeCreated: 1449422216
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using DG.Tweening;
|
||||
|
||||
public class SequenceNestedCallbacks : BrainBase
|
||||
{
|
||||
public Transform target;
|
||||
|
||||
void Start()
|
||||
{
|
||||
Sequence sMain = DOTween.Sequence()
|
||||
.OnComplete(()=> Debug.Log("MAIN > Complete"));
|
||||
sMain.AppendInterval(0.001f)
|
||||
.Append(target.DOMoveX(2, 0.0010001f).SetRelative().OnComplete(()=> Debug.Log("S0 > Complete")));
|
||||
// sMain.Append(target.DOMoveY(2, 1).SetRelative().OnComplete(()=> Debug.Log("S1 > Complete")))
|
||||
// .Append(target.DOMoveZ(2, 1).SetRelative().OnComplete(()=> Debug.Log("S2 > Complete")))
|
||||
// .Join(target.DORotate(new Vector3(0, 90, 0), 1).SetRelative().OnComplete(()=> Debug.Log("S3 > Complete")));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee18465850f6532438bf51d3ea80c633
|
||||
timeCreated: 1449568736
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1554865e60840d441a085cc476158135
|
||||
timeCreated: 1449568728
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -9,12 +9,12 @@ using UnityEngine.UI;
|
||||
|
||||
public class TempTests : BrainBase
|
||||
{
|
||||
public RectTransform rectTrans;
|
||||
public Transform target;
|
||||
|
||||
void Start()
|
||||
IEnumerator Start()
|
||||
{
|
||||
DOTween.Sequence().SetDelay(2)
|
||||
// .AppendInterval(2)
|
||||
.Append(rectTrans.DOAnchorPosX(100, 1).SetRelative());
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
|
||||
target.DOMoveY(2, 5).SetRelative().SetEase(Ease.InOutFlash, 8, 1);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@ -535,11 +535,11 @@ namespace DG.Tweening.Core
|
||||
}
|
||||
|
||||
// Forces the tween to startup and initialize all its data
|
||||
internal static void ForceInit(Tween t)
|
||||
internal static void ForceInit(Tween t, bool isSequenced = false)
|
||||
{
|
||||
if (t.startupDone) return;
|
||||
|
||||
if (!t.Startup()) {
|
||||
if (!t.Startup() && !isSequenced) {
|
||||
// Startup failed: kill tween
|
||||
if (isUpdateLoop) t.active = false; // Just mark it for killing, so the update loop will take care of it
|
||||
else RemoveActiveTween(t);
|
||||
|
||||
@ -32,7 +32,7 @@ namespace DG.Tweening
|
||||
public class DOTween
|
||||
{
|
||||
/// <summary>DOTween's version</summary>
|
||||
public static readonly string Version = "1.1.135";
|
||||
public static readonly string Version = "1.1.140";
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Options ////////////////////////////////////
|
||||
|
||||
@ -282,7 +282,6 @@ namespace DG.Tweening
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Debug
|
||||
int len = s._sequencedObjs.Count;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (!s.active) return true; // Killed by some internal callback
|
||||
@ -301,6 +300,12 @@ namespace DG.Tweening
|
||||
// float gotoPos = (float)((decimal)toPos - (decimal)sequentiable.sequencedPosition);
|
||||
if (gotoPos < 0) gotoPos = 0;
|
||||
Tween t = (Tween)sequentiable;
|
||||
// Fix for final nested tween not calling OnComplete in some cases
|
||||
if (toPos >= sequentiable.sequencedEndPosition) {
|
||||
if (!t.startupDone) TweenManager.ForceInit(t, true);
|
||||
if (gotoPos < t.fullDuration) gotoPos = t.fullDuration;
|
||||
}
|
||||
//
|
||||
t.isBackwards = false;
|
||||
if (TweenManager.Goto(t, gotoPos, false, updateMode)) return true;
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user