0

なぜ機能しないのかわかりません。

使用事例 :

  1. テスト 1:ゲームを起動し、最初のシーンから [再生] ボタン (presentScene) をクリックして、2 番目のシーンに移動します。問題ない。
  2. テスト 2:ゲームを起動し、最初のシーンからオプション ボタン (presentViewController) をクリックします。Optin コントローラーで、クリックして却下するViewControllerAnimated. プレイボタンをクリックしたい場合、画面に変化はありませんが、ゲームは遅れています。シーンが画面に表示されたままで、トランジションがない理由がわかりません。

エラー出力はありません。

コード コントローラー:

- (void)viewDidLoad
{
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showParam) name:kNotificationShowParam object:nil];
    //...
    SKView * skView = (SKView *)self.view;
    SKScene * scene = [[MenuScene alloc ]initWithSize:skView.bounds.size];
    scene.scaleMode = SKSceneScaleModeAspectFill;
    [skView presentScene:scene];
}

- (void)showParam
{
    ParamViewController *ParamView = [[crazyButterflyParamViewController alloc]init];
    [self presentViewController: ParamView animated: YES completion:^ {
    }];
}

コード ParamController:

//method on button
-(void)goToMenu
{
    [self.view.window.rootViewController dismissViewControllerAnimated:YES completion:^{
    }];
}

コードメニューシーン:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    for (UITouch* touch in touches)
    {
        if ([_button containsPoint:[touch locationInNode:_button.parent]])
        {
            SKTransition *transition = [SKTransition fadeWithDuration:0.4];
            SKScene *scene = [[GameScene alloc] initWithSize:self.size];
            scene.scaleMode = SKSceneScaleModeAspectFill;
            [self.scene.view presentScene:scene transition:transition];
            break;
        }


        if ([_buttonParam containsPoint:[touch locationInNode:_buttonParam.parent]])
        {
            [[NSNotificationCenter defaultCenter] postNotificationName:kNotificationShowParam object:nil];
            break;
        }
    }
}
4

1 に答える 1