我有这两个场景,一个菜单场景和一个主要的游戏场景。 主要的游戏场景有两个singelton层,它是我所有游戏内容的发展地点。切换场景冻结触摸
我使用replaceScene方法从游戏场景切换回菜单场景,但当切换回游戏场景时,控件或触摸被冻结。
这里是游戏主场景代码:
#import "BJPlayfieldScene.h"
@implementation BJPlayfieldScene
+(id)scene {
return([ [ self alloc ] init ]);
}
-(id) init
{
if((self=[super init])) {
//Background Layer
[self addChild:[BackgroundLayer sharedBackground] z:0];
//playfiled layer
[self addChild:[BJPlayfieldLayer sharedfieldlayer] z:5];
}
return self;
}
@end
,然后将代码切换回和第四:
[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:[IntroLayer scene]]];
和
[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:
[BJPlayfieldScene scene ] ]];
任何想法?
多谢
帧速率显示稳定在30.0左右,所以我怀疑触摸离开场景后禁用,因为self.touchEnabled = YES;在我的init方法中,它永远不会再被调用,因为它是一个singelton。我试图从外部启用它,但没有运气。或者问题可能在其他地方一起。 –