I using cocos2d-x. 2.2
And last version spine runtime.
In the past, i used check is animation complete like this.
public bool checkDone () {
if (state.Animation == null) return true;
return state.Time / state.Animation.Duration >= 3; // True after 3 loops.
}
or
if (1 == AnimationState_isComplete(effect->states[0]) && false == effect->states[0]->loop) {
//is done
}
But, now it was changed like this.
void ExampleLayer::animationStateEvent (CCSkeletonAnimation* node, int trackIndex, EventType type, Event* event, int loopCount) {
TrackEntry* entry = AnimationState_getCurrent(node->state, trackIndex);
const char* animationName = (entry && entry->animation) ? entry->animation->name : 0;
switch (type) {
case ANIMATION_START:
CCLog("%d start: %s", trackIndex, animationName);
break;
case ANIMATION_END:
CCLog("%d end: %s", trackIndex, animationName);
break;
case ANIMATION_COMPLETE:
CCLog("%d complete: %s, %d", trackIndex, animationName, loopCount);
break;
case ANIMATION_EVENT:
CCLog("%d event: %s, %s: %d, %f, %s", trackIndex, animationName, event->data->name, event->intValue, event->floatValue, event->stringValue);
break;
}
fflush(stdout);
}
This way is good to check event. But i don't know animation's complete status.
How to check?