mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-21 01:36:05 +08:00
[BUGFIX] Fixed DOTween.TweensById not working correctly with string and int IDs
This commit is contained in:
parent
bdd94e8320
commit
7ec7f52144
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: d3e15b806a8368742ba6f10e794d7b76
|
guid: d3e15b806a8368742ba6f10e794d7b76
|
||||||
timeCreated: 1549566641
|
timeCreated: 1549961173
|
||||||
licenseType: Pro
|
licenseType: Pro
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
|
|||||||
Binary file not shown.
@ -11,12 +11,19 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
public class TempTests : BrainBase
|
public class TempTests : BrainBase
|
||||||
{
|
{
|
||||||
public Transform target;
|
public Transform[] targets;
|
||||||
|
|
||||||
IEnumerator Start()
|
IEnumerator Start()
|
||||||
{
|
{
|
||||||
target.DOMoveX(4, 10);
|
yield return new WaitForSeconds(1);
|
||||||
yield return new WaitForSeconds(2);
|
for (int i = 0; i < targets.Length; ++i) {
|
||||||
DOTween.timeScale = -1;
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
@ -836,9 +836,27 @@ namespace DG.Tweening.Core
|
|||||||
if (totActiveTweens <= 0) return null;
|
if (totActiveTweens <= 0) return null;
|
||||||
int len = totActiveTweens;
|
int len = totActiveTweens;
|
||||||
if (fillableList == null) fillableList = new List<Tween>(len);
|
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) {
|
for (int i = 0; i < len; ++i) {
|
||||||
Tween t = _activeTweens[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 (!playingOnly || t.isPlaying) fillableList.Add(t);
|
||||||
}
|
}
|
||||||
if (fillableList.Count > 0) return fillableList;
|
if (fillableList.Count > 0) return fillableList;
|
||||||
|
|||||||
@ -32,7 +32,7 @@ namespace DG.Tweening
|
|||||||
public class DOTween
|
public class DOTween
|
||||||
{
|
{
|
||||||
/// <summary>DOTween's version</summary>
|
/// <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 ////////////////////////////////////
|
// Options ////////////////////////////////////
|
||||||
|
|||||||
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