mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-02 21:59:09 +08:00
[csharp] Return true from AnimationState#apply if any animation was applied.
This commit is contained in:
parent
464e9b3362
commit
8fa441e284
@ -159,16 +159,18 @@ namespace Spine {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Poses the skeleton using the track entry animations. There are no side effects other than invoking listeners, so the
|
/// Poses the skeleton using the track entry animations. There are no side effects other than invoking listeners, so the
|
||||||
/// animation state can be applied to multiple skeletons to pose them identically.</summary>
|
/// animation state can be applied to multiple skeletons to pose them identically.</summary>
|
||||||
public void Apply (Skeleton skeleton) {
|
public bool Apply (Skeleton skeleton) {
|
||||||
if (skeleton == null) throw new ArgumentNullException("skeleton", "skeleton cannot be null.");
|
if (skeleton == null) throw new ArgumentNullException("skeleton", "skeleton cannot be null.");
|
||||||
if (animationsChanged) AnimationsChanged();
|
if (animationsChanged) AnimationsChanged();
|
||||||
|
|
||||||
var events = this.events;
|
var events = this.events;
|
||||||
|
|
||||||
|
bool applied = false;
|
||||||
var tracksItems = tracks.Items;
|
var tracksItems = tracks.Items;
|
||||||
for (int i = 0, m = tracks.Count; i < m; i++) {
|
for (int i = 0, m = tracks.Count; i < m; i++) {
|
||||||
TrackEntry current = tracksItems[i];
|
TrackEntry current = tracksItems[i];
|
||||||
if (current == null || current.delay > 0) continue;
|
if (current == null || current.delay > 0) continue;
|
||||||
|
applied = true;
|
||||||
|
|
||||||
// Apply mixing from entries first.
|
// Apply mixing from entries first.
|
||||||
float mix = current.alpha;
|
float mix = current.alpha;
|
||||||
@ -210,6 +212,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
queue.Drain();
|
queue.Drain();
|
||||||
|
return applied;
|
||||||
}
|
}
|
||||||
|
|
||||||
private float ApplyMixingFrom (TrackEntry to, Skeleton skeleton) {
|
private float ApplyMixingFrom (TrackEntry to, Skeleton skeleton) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user