mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-09 16:48:43 +08:00
[csharp] Port of commits 81baef0 and 4efd63f: Fixed crash when a pingpong sequence has 1 frame. Use linked mesh sequence properties when inheriting a sequence timeline.
This commit is contained in:
parent
4efd63f89c
commit
5b6c220bf6
@ -2642,6 +2642,8 @@ namespace Spine {
|
||||
if ((vertexAttachment == null)
|
||||
|| vertexAttachment.TimelineAttachment != attachment) return;
|
||||
}
|
||||
Sequence sequence = ((IHasTextureRegion)slotAttachment).Sequence;
|
||||
if (sequence == null) return;
|
||||
|
||||
float[] frames = this.frames;
|
||||
if (time < frames[0]) { // Time is before first frame.
|
||||
@ -2654,7 +2656,7 @@ namespace Spine {
|
||||
int modeAndIndex = (int)frames[i + MODE];
|
||||
float delay = frames[i + DELAY];
|
||||
|
||||
int index = modeAndIndex >> 4, count = attachment.Sequence.Regions.Length;
|
||||
int index = modeAndIndex >> 4, count = sequence.Regions.Length;
|
||||
SequenceMode mode = (SequenceMode)(modeAndIndex & 0xf);
|
||||
if (mode != SequenceMode.Hold) {
|
||||
index += (int)((time - before) / delay + 0.00001f);
|
||||
@ -2667,7 +2669,7 @@ namespace Spine {
|
||||
break;
|
||||
case SequenceMode.Pingpong: {
|
||||
int n = (count << 1) - 2;
|
||||
index %= n;
|
||||
index = n == 0 ? 0 : index % n;
|
||||
if (index >= count) index = n - index;
|
||||
break;
|
||||
}
|
||||
@ -2679,7 +2681,7 @@ namespace Spine {
|
||||
break;
|
||||
case SequenceMode.PingpongReverse: {
|
||||
int n = (count << 1) - 2;
|
||||
index = (index + count - 1) % n;
|
||||
index = n == 0 ? 0 : (index + count - 1) % n;
|
||||
if (index >= count) index = n - index;
|
||||
break;
|
||||
} // end case
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user