mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[csharp] port of commit 4a351ce: Fixed delay being negative, causing the track time to jump. See #2837.
This commit is contained in:
parent
262a0d270f
commit
c516c9a5cd
@ -750,10 +750,11 @@ namespace Spine {
|
|||||||
if (last == null) {
|
if (last == null) {
|
||||||
SetCurrent(trackIndex, entry, true);
|
SetCurrent(trackIndex, entry, true);
|
||||||
queue.Drain();
|
queue.Drain();
|
||||||
|
if (delay < 0) delay = 0;
|
||||||
} else {
|
} else {
|
||||||
last.next = entry;
|
last.next = entry;
|
||||||
entry.previous = last;
|
entry.previous = last;
|
||||||
if (delay <= 0) delay += last.TrackComplete - entry.mixDuration;
|
if (delay <= 0) delay = Math.Max(delay + last.TrackComplete - entry.mixDuration, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.delay = delay;
|
entry.delay = delay;
|
||||||
@ -799,7 +800,7 @@ namespace Spine {
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public TrackEntry AddEmptyAnimation (int trackIndex, float mixDuration, float delay) {
|
public TrackEntry AddEmptyAnimation (int trackIndex, float mixDuration, float delay) {
|
||||||
TrackEntry entry = AddAnimation(trackIndex, AnimationState.EmptyAnimation, false, delay);
|
TrackEntry entry = AddAnimation(trackIndex, AnimationState.EmptyAnimation, false, delay);
|
||||||
if (delay <= 0) entry.delay += entry.mixDuration - mixDuration;
|
if (delay <= 0) entry.delay = Math.Max(entry.delay + entry.mixDuration - mixDuration, 0);
|
||||||
entry.mixDuration = mixDuration;
|
entry.mixDuration = mixDuration;
|
||||||
entry.trackEnd = mixDuration;
|
entry.trackEnd = mixDuration;
|
||||||
return entry;
|
return entry;
|
||||||
@ -1049,17 +1050,24 @@ namespace Spine {
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>
|
/// <para>
|
||||||
/// Seconds to postpone playing the animation. When this track entry is the current track entry, <c>Delay</c>
|
/// Seconds to postpone playing the animation. Must be >= 0. When this track entry is the current track entry,
|
||||||
/// postpones incrementing the <see cref="TrackEntry.TrackTime"/>. When this track entry is queued, <c>Delay</c> is the time from
|
/// <c>Delay</c> postpones incrementing the <see cref="TrackEntry.TrackTime"/>. When this track entry is queued,
|
||||||
/// the start of the previous animation to when this track entry will become the current track entry (ie when the previous
|
/// <c>Delay</c> is the time from the start of the previous animation to when this track entry will become the current
|
||||||
/// track entry <see cref="TrackEntry.TrackTime"/> >= this track entry's <c>Delay</c>).</para>
|
/// track entry (ie when the previous track entry <see cref="TrackEntry.TrackTime"/> >= this track entry's
|
||||||
|
/// <c>Delay</c>).</para>
|
||||||
/// <para>
|
/// <para>
|
||||||
/// <see cref="TrackEntry.TimeScale"/> affects the delay.</para>
|
/// <see cref="TrackEntry.TimeScale"/> affects the delay.</para>
|
||||||
/// <para>
|
/// <para>
|
||||||
/// When using <see cref="AnimationState.AddAnimation(int, Animation, bool, float)"/> with a <c>delay</c> <= 0, the delay
|
/// When passing <c>delay</c> <= 0 <see cref="AnimationState.AddAnimation(int, Animation, bool, float)"/>, this
|
||||||
/// is set using the mix duration from the <see cref="AnimationStateData"/>. If <see cref="mixDuration"/> is set afterward, the delay
|
/// <c>delay</c> is set using a mix duration from the <see cref="AnimationStateData"/>. To change the <see cref="mixDuration"/>
|
||||||
/// may need to be adjusted.</para></summary>
|
/// afterward, use <see cref="SetMixDuration(float, float)"/> so this <c>delay</c> is adjusted.</para></summary>
|
||||||
public float Delay { get { return delay; } set { delay = value; } }
|
public float Delay {
|
||||||
|
get { return delay; }
|
||||||
|
set {
|
||||||
|
if (delay < 0) throw new ArgumentException("delay must be >= 0.", "delay");
|
||||||
|
delay = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Current time in seconds this track entry has been the current track entry. The track time determines
|
/// Current time in seconds this track entry has been the current track entry. The track time determines
|
||||||
@ -1261,7 +1269,12 @@ namespace Spine {
|
|||||||
/// entry is looping, its next loop completion is used instead of its duration.</param>
|
/// entry is looping, its next loop completion is used instead of its duration.</param>
|
||||||
public void SetMixDuration (float mixDuration, float delay) {
|
public void SetMixDuration (float mixDuration, float delay) {
|
||||||
this.mixDuration = mixDuration;
|
this.mixDuration = mixDuration;
|
||||||
if (previous != null && delay <= 0) delay += previous.TrackComplete - mixDuration;
|
if (delay <= 0) {
|
||||||
|
if (previous != null)
|
||||||
|
delay = Math.Max(delay + previous.TrackComplete - mixDuration, 0);
|
||||||
|
else
|
||||||
|
delay = 0;
|
||||||
|
}
|
||||||
this.delay = delay;
|
this.delay = delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.spine-csharp",
|
"name": "com.esotericsoftware.spine.spine-csharp",
|
||||||
"displayName": "spine-csharp Runtime",
|
"displayName": "spine-csharp Runtime",
|
||||||
"description": "This plugin provides the spine-csharp core runtime.",
|
"description": "This plugin provides the spine-csharp core runtime.",
|
||||||
"version": "4.2.36",
|
"version": "4.3.2",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user