1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 09:16:02 +08:00

[BUGFIX] Fixed DOTween.TweensById not working correctly with string and int IDs

This commit is contained in:
Demigiant 2019-02-20 10:37:40 +01:00
parent bdd94e8320
commit 7ec7f52144
19 changed files with 32 additions and 7 deletions

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: d3e15b806a8368742ba6f10e794d7b76
timeCreated: 1549566641
timeCreated: 1549961173
licenseType: Pro
TextureImporter:
fileIDToRecycleName: {}

View File

@ -11,12 +11,19 @@ using UnityEngine.UI;
public class TempTests : BrainBase
{
public Transform target;
public Transform[] targets;
IEnumerator Start()
{
target.DOMoveX(4, 10);
yield return new WaitForSeconds(2);
DOTween.timeScale = -1;
yield return new WaitForSeconds(1);
for (int i = 0; i < targets.Length; ++i) {
targets[i].DOMove(new Vector3(UnityEngine.Random.Range(-2f, 2f), UnityEngine.Random.Range(-2f, 2f), 0), 20)
.SetId(i % 2 == 0 ? "a" : "b");
}
yield return new WaitForSeconds(1);
List<Tween> ts = DOTween.TweensById("a");
foreach (Tween t in ts) {
t.Pause();
}
}
}

View File

@ -836,9 +836,27 @@ namespace DG.Tweening.Core
if (totActiveTweens <= 0) return null;
int len = totActiveTweens;
if (fillableList == null) fillableList = new List<Tween>(len);
// Determine ID to use
bool useStringId = false;
string stringId = null;
bool useIntId = false;
int intId = 0;
if (id is string) {
useStringId = true;
stringId = (string)id;
} else if (id is int) {
useIntId = true;
intId = (int)id;
}
//
for (int i = 0; i < len; ++i) {
Tween t = _activeTweens[i];
if (t == null || !Equals(id, t.id)) continue;
if (t == null) continue;
if (useStringId) {
if (t.stringId == null || t.stringId != stringId) continue;
} else if (useIntId) {
if (t.intId != intId) continue;
} else if (t.id == null || !Equals(id, t.id)) continue;
if (!playingOnly || t.isPlaying) fillableList.Add(t);
}
if (fillableList.Count > 0) return fillableList;

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.2.175"; // Last version before modules: 1.1.755
public static readonly string Version = "1.2.180"; // Last version before modules: 1.1.755
///////////////////////////////////////////////
// Options ////////////////////////////////////

Binary file not shown.