0

私には 2 つCCScenesの があります。それらを A と B と呼びましょう。シーン A にいるときは、UIViewControllerビデオ プレーヤーでインスタンスを提示します。次に、その UIViewController からシーン B に移動します。これがその方法です。

- (void)videoFinished:(NSNotification *)notification
{
[self presentCurrentActivity];

id object = notification.object;

if ([notification.name isEqualToString:AVPlayerItemDidPlayToEndTimeNotification])
    [RAActivityInfoManager setVideoWatched];

[[NSNotificationCenter defaultCenter] removeObserver:self name:AVPlayerItemDidPlayToEndTimeNotification object:object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:VIDEO_SKIPPED_NOTIFICATION object:nil];

[[CCDirector sharedDirector] dismissViewControllerAnimated:YES completion:nil];
}

- (void)presentCurrentActivity
{
if (currentActivity >= numberOfActivitiesInLesson)
    currentActivity = 1;

NSString *className = self.activityNames[currentActivity];
Class     class     = NSClassFromString(className);

[RAActivityInfoManager addSpriteFramesForClass:class];

SEL selector   = sel_registerName("scene");
CCScene *scene = [class performSelector:selector];

[[CCDirector sharedDirector] replaceScene:scene];
 }

私が必要とするのは、私のUIViewController. しかし、残念なことに、私はいつもシーン A に一瞬連れて行かれ、その後にシーン B が表示されます。私が理解している限りでは、viewController が から削除された後にのみ機能するようにUIViewControllerブロックを表示しています。そのため、viewController がまだオンになっている間に非同期に置き換える方法を見つける必要があります。何か案は?Cocos2DCCDirectorCCScene

4

2 に答える 2

0

cocos2d-iphone 拡張機能 ( https://github.com/cocos2d/cocos2d-iphone-extensions )を使用してこれを機能させるには、運が良いはずです。試してみることができるビデオ プレーヤー クラス (CCVideoPlayer) があります。

于 2013-10-28T15:27:12.687 に答える