Skip to content

Commit 871df4d

Browse files
committed
Fix property reseting
Visibility reset
1 parent 2ddcc43 commit 871df4d

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

cocos2d-ui/CCBReader/CCAnimationManager.m

Lines changed: 20 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,32 @@ - (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+
// Build First Key Frame Sequence
519+
[self runActionsForNode:node sequenceProperty:seqProp tweenDuration:tweenDuration startKeyFrame:0];
520+
}
512521
}
513522

514-
515523

516524
}
517525

526+
// Set the running scene
527+
_runningSequence = [self sequenceFromSequenceId:seqId];
528+
_runningSequence.time = 0.0f;
529+
518530
_paused = NO;
519531
}
520532

0 commit comments

Comments
 (0)