Skip to content

Commit c6e4f0a

Browse files
committed
Merge branch 'v3.1' into develop
Conflicts: cocos2d/CCEffectRenderer.m
2 parents 195bf2d + dae7af8 commit c6e4f0a

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

cocos2d-ui/CCBReader/CCAnimationManager.m

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ - (void)setAnimatedProperty:(NSString*)name forNode:(CCNode*)node toValue:(id)va
254254
} else if ([name isEqualToString:@"skew"]) {
255255
node.skewX = [[value objectAtIndex:0] floatValue];
256256
node.skewY = [[value objectAtIndex:1] floatValue];
257+
} else if ([name isEqualToString:@"visible"]) {
258+
[(CCSprite*)node setVisible:[value boolValue]];
257259
} else if ([name isEqualToString:@"spriteFrame"]) {
258260
[(CCSprite*)node setSpriteFrame:value];
259261
} else {
@@ -463,11 +465,6 @@ - (void)runAnimationsForSequenceId:(int)seqId tweenDuration:(float) tweenDuratio
463465
_paused = YES;
464466
[self clearAllActions];
465467

466-
// Set the running scene
467-
_runningSequence = [self sequenceFromSequenceId:seqId];
468-
_runningSequence.time = 0.0f;
469-
_runningSequence.tween = tweenDuration;
470-
471468
[self addSequenceCallBacks:seqId tweenDuration:tweenDuration startTime:0];
472469

473470
// Contains all Sequence Propertys / Keyframe
@@ -493,7 +490,7 @@ - (void)runAnimationsForSequenceId:(int)seqId tweenDuration:(float) tweenDuratio
493490
}
494491

495492

496-
if(_lastSequence.sequenceId!=seqId) {
493+
if(_lastSequence.sequenceId!=seqId || _runningSequence.sequenceId!=seqId) {
497494
_loop = NO;
498495

499496
// Reset the nodes that may have been changed by other timelines
@@ -504,17 +501,30 @@ - (void)runAnimationsForSequenceId:(int)seqId tweenDuration:(float) tweenDuratio
504501

505502
id value = [nodeBaseValues objectForKey:propName];
506503

507-
if (value) {
504+
if (value!=nil) {
508505
[self setAnimatedProperty:propName forNode:node toValue:value tweenDuration:tweenDuration];
509506
}
510507
}
511508
}
509+
510+
// Reset nodes that have sequence node properties, build first keyframe action sequence.
511+
for (NSString* propName in seqNodeProps) {
512+
CCBSequenceProperty* seqProp = [seqNodeProps objectForKey:propName];
513+
[seqNodePropNames addObject:propName];
514+
515+
// Reset Node State to First KeyFrame
516+
[self setKeyFrameForNode:node sequenceProperty:seqProp tweenDuration:tweenDuration keyFrame:0];
517+
518+
}
512519
}
513520

514-
515521

516522
}
517523

524+
// Set the running scene
525+
_runningSequence = [self sequenceFromSequenceId:seqId];
526+
_runningSequence.time = 0.0f;
527+
518528
_paused = NO;
519529
}
520530

@@ -845,6 +855,13 @@ - (CCActionSequence*)createActionForNode:(CCNode*)node sequenceProperty:(CCBSequ
845855

846856
CCActionInterval* action = [self actionFromKeyframe0:startKF andKeyframe1:endKF propertyName:seqProp.name node:node];
847857

858+
// Create delay to fix instant easing on non instant actions
859+
if(startKF.easingType==kCCBKeyframeEasingInstant &&
860+
![seqProp.name isEqualToString:@"spriteFrame"] &&
861+
![seqProp.name isEqualToString:@"visible"]) {
862+
[actions addObject:[CCActionDelay actionWithDuration:action.duration]];
863+
}
864+
848865
if (action) {
849866
// Apply Easing
850867
action = [self easeAction:action easingType:startKF.easingType easingOpt:startKF.easingOpt];

0 commit comments

Comments
 (0)