2

我正在尝试在我的 Cocos2D iPhone 游戏中实现 OpenFeint,但这里有一些奇怪的东西我没有找到解决方法。这是我初始化 OpenFeint 时的样子:http: //img842.imageshack.us/img842/8564/screenshot20100926at520.png 这是初始化的代码:

[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:
                          [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft], OpenFeintSettingDashboardOrientation,
                          @"NAME", OpenFeintSettingShortDisplayName,
                          [NSNumber numberWithBool:NO], OpenFeintSettingEnablePushNotifications,
                          [NSNumber numberWithBool:YES], OpenFeintSettingAlwaysAskForApprovalInDebug, 
                          [NSNumber numberWithBool:YES], OpenFeintSettingDisableUserGeneratedContent, nil];
[OpenFeint initializeWithProductKey:@"PRODUCTKEY" andSecret:@"SECRET"
                     andDisplayName:@"NAME" andSettings:settings andDelegates: [OFDelegatesContainer containerWithOpenFeintDelegate:self]];
[[CCDirector sharedDirector] runWithScene: [MainMenuScene node]];
4

4 回答 4

2

我在几个地方看过你的帖子,因为我遇到了和你一样的问题。我刚刚为您找到了一个潜在的解决方案,并认为我会回复。似乎在某些情况下,OpenFeint 无法访问 keywindow,在这种情况下,它会创建自己的窗口,这可能不像您设置的那样。解决方案是通过将 OpenFeint 添加到设置中,让 OpenFeint 明确知道要跟踪哪个窗口。我的设置如下,你可以看到我用我的键控窗口添加了“OpenFeintSettingPresentationWindow”设置。这样做之后,效果非常好。希望这可以帮助!

NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:
                            [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight], OpenFeintSettingDashboardOrientation,
                            window, OpenFeintSettingPresentationWindow,
                            @"ComingSoon", OpenFeintSettingShortDisplayName, 
                            [NSNumber numberWithBool:YES], OpenFeintSettingEnablePushNotifications,
                            nil];
于 2010-09-28T22:45:05.327 回答
1

可能您的二进制文件中的方向设置包错误,删除横向并添加 iPhone 通用设置包。

于 2012-03-13T09:55:26.180 回答
0

我不确定具体是什么问题,但看起来 OpenFeint 正试图以横向显示,但不知何故被旋转,就好像它处于纵向模式一样。oyu 可以仔细检查以确保您的方向对于您的应用程序的主视图控制器都是正确的(或者您在 Cocos2D 中对其进行配置)。OpenFeint 也意识到了这一点?

于 2010-09-26T23:27:25.137 回答
0

cocos2d窗口只需要引用中的窗口即可applicationDidFinishLaunching

于 2011-10-23T03:30:18.903 回答