- Modifié
Issues with Event Management
It seems to be a problem with the event system. When the ‘current time’ is equal to the ’event key frame time’ the event is launched twice. I think this is cause, at first time, the ‘event key frame time’ is into the interval [last time, current time] and at the next step (last current time is now last time) the ‘event key frame time’ is at the interval again [last time, current time].
Could you take a look on this?
I "patched" this error adding a for loop that removes multiple events with the same name inside last for of this method (in EventTimeline class):
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> firedEvents, float alpha) {
[...]
for (; frameIndex < frameCount && time >= frames[frameIndex]; frameIndex++){
/*
*HERE I CHECK IF AN EVENT WITH THE SAME NAME IS ADDED TO FIREDEVENTS
*/
firedEvents.add(events[frameIndex]);
}
}
EventTimelineTests in spine-libgdx test the event firing stuff pretty extensively. The event with a time > lastTime and <= current time is fired. I don't see it firing twice when the current time is the same as an event time. Can you show what inputs into EventTimeline#apply cause an event to fire twice? I need the lastTime and time parameters for apply as well as the float[] frames.