0
定義済みのUIViewControllerを使用してcocos2dで作成されたシーンを再起動する必要があります。これどうやってするの?どうすればいいのか教えてください。UIViewControllerを使用してcocos2dでシーンを再起動する方法
定義済みのUIViewControllerを使用してcocos2dで作成されたシーンを再起動する必要があります。これどうやってするの?どうすればいいのか教えてください。UIViewControllerを使用してcocos2dでシーンを再起動する方法
私は、それが動作すると思いますが、それは良くない
- (void) restart
{
[[CCDirector sharedDirector] replaceScene:[[self class] node]];
}
のようなものを呼び出そうとすることができます。 IMHO、このようなスムースを使う方がはるかに良いです。
- (void) restart
{
// remove all your content
[self removeAllChildrenWithCleanup];
// reinitialize your instances
// re-add content again
[self addContent];
}
ありがとうございます。 'replaceScene:[[self class] node]];'は動作します。 – Dalinaum