mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-15 19:41:36 +08:00
parent
108ea5a70d
commit
10c941a28b
@ -296,7 +296,7 @@ typedef struct spEventTimeline {
|
||||
|
||||
spEventTimeline* spEventTimeline_create (int framesCount);
|
||||
|
||||
void spEventTimeline_setFrame (spEventTimeline* self, int frameIndex, float time, spEvent* event);
|
||||
void spEventTimeline_setFrame (spEventTimeline* self, int frameIndex, spEvent* event);
|
||||
|
||||
#ifdef SPINE_SHORT_NAMES
|
||||
typedef spEventTimeline EventTimeline;
|
||||
|
||||
@ -57,7 +57,7 @@ void spAnimation_apply (const spAnimation* self, spSkeleton* skeleton, float las
|
||||
|
||||
if (loop && self->duration) {
|
||||
time = FMOD(time, self->duration);
|
||||
lastTime = FMOD(lastTime, self->duration);
|
||||
if (lastTime > 0) lastTime = FMOD(lastTime, self->duration);
|
||||
}
|
||||
|
||||
for (i = 0; i < n; ++i)
|
||||
@ -70,7 +70,7 @@ void spAnimation_mix (const spAnimation* self, spSkeleton* skeleton, float lastT
|
||||
|
||||
if (loop && self->duration) {
|
||||
time = FMOD(time, self->duration);
|
||||
lastTime = FMOD(lastTime, self->duration);
|
||||
if (lastTime > 0) lastTime = FMOD(lastTime, self->duration);
|
||||
}
|
||||
|
||||
for (i = 0; i < n; ++i)
|
||||
@ -578,8 +578,8 @@ spEventTimeline* spEventTimeline_create (int framesCount) {
|
||||
return self;
|
||||
}
|
||||
|
||||
void spEventTimeline_setFrame (spEventTimeline* self, int frameIndex, float time, spEvent* event) {
|
||||
self->frames[frameIndex] = time;
|
||||
void spEventTimeline_setFrame (spEventTimeline* self, int frameIndex, spEvent* event) {
|
||||
self->frames[frameIndex] = event->time;
|
||||
|
||||
FREE(self->events[frameIndex]);
|
||||
self->events[frameIndex] = event;
|
||||
|
||||
@ -370,19 +370,18 @@ static spAnimation* _spSkeletonJson_readAnimation (spSkeletonJson* self, Json* r
|
||||
for (frame = events->child, i = 0; frame; frame = frame->next, ++i) {
|
||||
spEvent* event;
|
||||
const char* stringValue;
|
||||
float time = Json_getFloat(frame, "time", 0);
|
||||
spEventData* eventData = spSkeletonData_findEvent(skeletonData, Json_getString(frame, "name", 0));
|
||||
if (!eventData) {
|
||||
spAnimation_dispose(animation);
|
||||
_spSkeletonJson_setError(self, 0, "Event not found: ", Json_getString(frame, "name", 0));
|
||||
return 0;
|
||||
}
|
||||
event = spEvent_create(time, eventData);
|
||||
event = spEvent_create(Json_getFloat(frame, "time", 0), eventData);
|
||||
event->intValue = Json_getInt(frame, "int", eventData->intValue);
|
||||
event->floatValue = Json_getFloat(frame, "float", eventData->floatValue);
|
||||
stringValue = Json_getString(frame, "string", eventData->stringValue);
|
||||
if (stringValue) MALLOC_STR(event->stringValue, stringValue);
|
||||
spEventTimeline_setFrame(timeline, i, time, event);
|
||||
spEventTimeline_setFrame(timeline, i, event);
|
||||
}
|
||||
animation->timelines[animation->timelinesCount++] = SUPER_CAST(spTimeline, timeline);
|
||||
duration = timeline->frames[events->size - 1];
|
||||
|
||||
@ -58,7 +58,7 @@ namespace Spine {
|
||||
|
||||
if (loop && duration != 0) {
|
||||
time %= duration;
|
||||
lastTime %= duration;
|
||||
if (lastTime > 0) lastTime %= duration;
|
||||
}
|
||||
|
||||
ExposedList<Timeline> timelines = this.timelines;
|
||||
@ -75,7 +75,7 @@ namespace Spine {
|
||||
|
||||
if (loop && duration != 0) {
|
||||
time %= duration;
|
||||
lastTime %= duration;
|
||||
if (lastTime > 0) lastTime %= duration;
|
||||
}
|
||||
|
||||
ExposedList<Timeline> timelines = this.timelines;
|
||||
@ -470,8 +470,8 @@ namespace Spine {
|
||||
}
|
||||
|
||||
/// <summary>Sets the time and value of the specified keyframe.</summary>
|
||||
public void SetFrame (int frameIndex, float time, Event e) {
|
||||
frames[frameIndex] = time;
|
||||
public void SetFrame (int frameIndex, Event e) {
|
||||
frames[frameIndex] = e.Time;
|
||||
events[frameIndex] = e;
|
||||
}
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ namespace Spine {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Updates the world transform for each bone and applies IK constraints.</summary>
|
||||
/// <summary>Updates the world transform for each bone and applies constraints.</summary>
|
||||
public void UpdateWorldTransform () {
|
||||
ExposedList<IUpdatable> updateCache = this.updateCache;
|
||||
for (int i = 0, n = updateCache.Count; i < n; i++)
|
||||
|
||||
@ -626,12 +626,11 @@ namespace Spine {
|
||||
foreach (Dictionary<String, Object> eventMap in eventsMap) {
|
||||
EventData eventData = skeletonData.FindEvent((String)eventMap["name"]);
|
||||
if (eventData == null) throw new Exception("Event not found: " + eventMap["name"]);
|
||||
float time = (float)eventMap["time"];
|
||||
var e = new Event(time, eventData);
|
||||
var e = new Event((float)eventMap["time"], eventData);
|
||||
e.Int = GetInt(eventMap, "int", eventData.Int);
|
||||
e.Float = GetFloat(eventMap, "float", eventData.Float);
|
||||
e.String = GetString(eventMap, "string", eventData.String);
|
||||
timeline.SetFrame(frameIndex++, time, e);
|
||||
timeline.SetFrame(frameIndex++, e);
|
||||
}
|
||||
timelines.Add(timeline);
|
||||
duration = Math.Max(duration, timeline.frames[timeline.FrameCount - 1]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user