cocos2d-objc icon indicating copy to clipboard operation
cocos2d-objc copied to clipboard

CCResonderManager(?) issue

Open slxl opened this issue 10 years ago • 0 comments

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:

  1. Create a new project in SpriteBuilder.
  2. 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
  1. Make a tap on button, release it (scene transition will begin)
  2. And immediately tap it again and hold.
  3. Wait until scene transition is finished.
  4. Pick up finger then
  5. Tap again
  6. 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];

slxl avatar Jan 17 '15 16:01 slxl