cocos2d-objc
cocos2d-objc copied to clipboard
CCResonderManager(?) issue
I'm using SpriteBuilder 1.3.6 with Xcode 6.1.1 (6A2008a) Bug is reproduced on lots of iPhones/iPads with iOS7/iOS8
Steps to reproduce:
- Create a new project in SpriteBuilder.
- Add two similar scenes (below is a code only for one - scenes absolutely identical, only class names differs)
#import "FirstScene.h"
#import "SecondScene.h"
@implementation FirstScene
#pragma mark - Class methods
+ (CCScene *)scene {
return [[self alloc] init];
}
#pragma mark - Initialization
- (id)init {
if (!(self = [super init])) {
return(nil);
}
self.contentSize = CGSizeMake([[CCDirector sharedDirector] viewSize].width, [[CCDirector sharedDirector] viewSize].height);
// Scene black background
CCNodeColor *background = [CCNodeColor nodeWithColor:[CCColor blackColor]
width:self.contentSize.width
height:self.contentSize.height];
[self addChild:background];
// done
return self;
}
#pragma mark - Scene events
- (void)onEnter {
[super onEnter];
CCLabelTTF *titleLabel = [CCLabelTTF labelWithString:@"its a first scene"
fontName:@"Helvetica"
fontSize:15];
[titleLabel setColor:[CCColor whiteColor]];
[titleLabel setPositionType:CCPositionTypeNormalized];
[titleLabel setPosition:ccp(0.5, 0.7)];
[self addChild:titleLabel];
CCButton *swapScene = [CCButton buttonWithTitle:@"Load second scene"];
[swapScene setPositionType:CCPositionTypeNormalized];
[swapScene setPosition:ccp(0.5, 0.4)];
[swapScene setTarget:self selector:@selector(swapScene:)];
[self addChild:swapScene];
}
#pragma mark - Buttons processing
- (void)swapScene:(id)sender {
CCScene *scene = [SecondScene scene];
[[CCDirector sharedDirector] replaceScene:scene withTransition:[CCTransition transitionFadeWithDuration:0.5]];
}
@end
- Make a tap on button, release it (scene transition will begin)
- And immediately tap it again and hold.
- Wait until scene transition is finished.
- Pick up finger then
- Tap again
- Taps doesn't work on new scene.
What I found a) When you taps second time, then in CCRespondingManager.m, buildResponderList method, line 103
[self buildResponderList:[CCDirector sharedDirector].runningScene];
contains a CCTransition class instance in runningScene property
b) When transition is finished and you try to tap on second scene _responderList for the scene is always empty on each next tap
c) everything became fine when I removed transition
[[CCDirector sharedDirector] replaceScene:scene];