Skip to content

Commit 49e7439

Browse files
committed
Merge branch 'develop' of github.com:cocos2d/cocos2d-iphone into develop
2 parents 0b9edff + a543437 commit 49e7439

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

cocos2d-ui/CCBReader/CCAnimationManager.m

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ - (CCBSequence*)sequenceFromSequenceId:(int)seqId {
171171
- (CCActionInterval*)actionFromKeyframe0:(CCBKeyframe*)kf0 andKeyframe1:(CCBKeyframe*)kf1 propertyName:(NSString*)name node:(CCNode*)node {
172172
float duration = kf1.time - kf0.time;
173173

174+
if(kf0.easingType==kCCBKeyframeEasingInstant) {
175+
duration = 0;
176+
}
177+
174178
if ([name isEqualToString:@"rotation"]) {
175179
return [CCActionRotateTo actionWithDuration:duration angle:[kf1.value floatValue] simple:YES];
176180
} else if ([name isEqualToString:@"position"]) {
@@ -207,12 +211,12 @@ - (CCActionInterval*)actionFromKeyframe0:(CCBKeyframe*)kf0 andKeyframe1:(CCBKeyf
207211
return [CCActionTintTo actionWithDuration:duration color:color];
208212
} else if ([name isEqualToString:@"visible"]) {
209213
if ([kf1.value boolValue]) {
210-
return [CCActionSequence actionOne:[CCActionDelay actionWithDuration:duration] two:[CCActionShow action]];
214+
return [CCActionShow action];
211215
} else {
212-
return [CCActionSequence actionOne:[CCActionDelay actionWithDuration:duration] two:[CCActionHide action]];
216+
return [CCActionHide action];
213217
}
214218
} else if ([name isEqualToString:@"spriteFrame"]) {
215-
return [CCActionSequence actionOne:[CCActionDelay actionWithDuration:duration] two:[CCActionSpriteFrame actionWithSpriteFrame:kf1.value]];
219+
return [CCActionSpriteFrame actionWithSpriteFrame:kf1.value];
216220
} else {
217221
CCLOG(@"CCBReader: Failed to create animation for property: %@", name);
218222
}
@@ -356,7 +360,7 @@ - (void)runActionsForNode:(CCNode*)node sequenceProperty:(CCBSequenceProperty*)s
356360
if(numKeyframes<1) return;
357361

358362
// Action Sequence Builder
359-
NSMutableArray* actions = [NSMutableArray array];
363+
NSMutableArray* actions = [NSMutableArray array];
360364
int endFrame = startFrame+1;
361365

362366
if(endFrame==numKeyframes || endFrame<0)
@@ -855,14 +859,13 @@ - (CCActionSequence*)createActionForNode:(CCNode*)node sequenceProperty:(CCBSequ
855859

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

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-
865862
if (action) {
863+
864+
// Instant
865+
if(startKF.easingType==kCCBKeyframeEasingInstant) {
866+
[actions addObject:[CCActionDelay actionWithDuration:endKF.time-startKF.time]];
867+
}
868+
866869
// Apply Easing
867870
action = [self easeAction:action easingType:startKF.easingType easingOpt:startKF.easingOpt];
868871
[actions addObject:action];

cocos2d-ui/CCBReader/CCBReader.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,14 @@ - (CCNode*) readNodeGraphParent:(CCNode*)parent
12451245

12461246
Class class = NSClassFromString(className);
12471247
if (!class)
1248+
{
1249+
// Class was not found. Maybe it's a Swift class?
1250+
// See http://stackoverflow.com/questions/24030814/swift-language-nsclassfromstring
1251+
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
1252+
NSString *classStringName = [NSString stringWithFormat:@"_TtC%d%@%d%@", appName.length, appName, className.length, className];
1253+
class = NSClassFromString(classStringName);
1254+
}
1255+
if (!class)
12481256
{
12491257
#if DEBUG
12501258
NSLog(@"*** [CLASS] ERROR HINT: Did you set a custom class for a CCNode? Please check if the specified class name is spelled correctly and available in your project.");

cocos2d/CCEffectRenderer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ -(void)drawSprite:(CCSprite *)sprite withEffect:(CCEffect *)effect uniforms:(NSM
206206
}
207207
else
208208
{
209-
BOOL inverted;
209+
bool inverted;
210210

211211
GLKMatrix4 renderTargetProjection = GLKMatrix4MakeOrtho(0.0f, _contentSize.width, 0.0f, _contentSize.height, -1024.0f, 1024.0f);
212212
GLKMatrix4 invRenderTargetProjection = GLKMatrix4Invert(renderTargetProjection, &inverted);

0 commit comments

Comments
 (0)