i've got a "Scene" class that adds several layers. I would like to add a last layer at the end of the game (to show the different scores) from one of the layer (so this layer would call the Scene class with a delegate, and the Scene class should add this new layer: "LevelCompleteLayer").
But the method in the Scene class does not receive the call. Would you know why? The other delegates (between the layers) work fine, but this one (from the layer to the Scene) does not.
Here's the code :
//in Level1Scene.h :
@interface Level1Scene : CCScene <CompleteLayerDelegate>{
//in Level1Scene.mh :
@implementation Level1Scene
@synthesize levelComplete;
-(void)showLevelCompleteLayer {
CCLOG(@"delegateCompleteLayer showLevelCompleteLayer!!!");//does not show up
[self addChild:levelComplete z:5000];//is not added
}
-(id)init {
if ((self = [super init])) {
ScoreLayer *scoreLayer = [ScoreLayer node];
layer = [[Level1Layer alloc] initWithBackgroundImage:background.backgroundImage];
levelComplete = [[LevelComplete alloc] init];
layer.delegate = scoreLayer;//works fine
layer.delegateCompleteLayer = self; //does not respond
scoreLayer.delegate = layer;//works fine
//...
}
return self;
}
//in Level1Layer.m :
[delegateCompleteLayer showLevelCompleteLayer];
//in GameProtocols.h :
@protocol CompleteLayerDelegate
-(void)showLevelCompleteLayer;
@end
Thanks for your help