1

我正在创建一个游戏,同时实现 iPhone 5 和非 iPhone 5。在我的应用程序委托中,我有以下内容:

CGSize winSize = [[CCDirector sharedDirector] winSize];
NSLog(@"Height: %f", winSize.height);
if(winSize.height == 568) {
    [[CCDirector sharedDirector] runWithScene:sceneI5];
    NSLog(@"Iphone 5 scene");
} else {
    [[CCDirector sharedDirector] runWithScene:scene];
    NSLog(@"Regular Scene");
}

其中sceneI5 是专为iPhone 5 设计的cocos2D 场景。我注意到两个场景由于某种原因开始运行,即声音播放了两次,首先加载常规启动画面场景,然后紧随其后的是iphone 5 启动画面屏幕已加载。谁能帮我弄清楚为什么会这样?

4

1 回答 1

1

Nevermind, I answered my own question and was a little bit too hasty to post it.

I changed the code in my app delegate to this:

CGSize winSize = [[CCDirector sharedDirector] winSize];
NSLog(@"Height: %f", winSize.height);
if(winSize.height == 568) {
    scene = [SplashScreenI5 scene];
    NSLog(@"Iphone 5 scene");
} else {
    scene = [SplashScreen scene];
    NSLog(@"Regular Scene");
}

[[CCDirector sharedDirector] runWithScene:scene];
于 2013-06-05T16:08:06.613 回答