<非互換項目>
- CCMenu,CCMenuItemが無くなっており、メニュー操作については完全に書き換えになります。(^_^;)
<対応方法>
- CCMenuItemの代わりには新規クラスであるCCButtonで置き換える。
- CCMenuの代わりには新規クラスであるCCLayoutで置き換える。
└ CCLayoutの利用な必須では無くメニューアイテム自動配置機能の代替。
// メニューボタン生成
_menuItemGamePlay = [CCMenuItemImage itemWithNormalImage:@"Button_GamePlay.png"
selectedImage:@"Button_GamePlay_Sel.png"
target:self
selector:@selector(tappedGamePlayButton:)];
CCMenuItem *menuItemNextStage = [CCMenuItemImage itemWithNormalImage:@"Button_NextStage.png"
selectedImage:@"Button_NextStage_Sel.png"
target:self
selector:@selector(tappedNextShapeButton:)];
CCMenuItem *menuItemPriorStage = [CCMenuItemImage itemWithNormalImage:@"Button_PriorStage.png"
selectedImage:@"Button_PriorStage_Sel.png"
target:self
selector:@selector(tappedPriorShapeButton:)];
_menuItemHowToPlay = [CCMenuItemImage itemWithNormalImage:@"Button_HowToPlay.png"
selectedImage:@"Button_HowToPlay_Sel.png"
target:self
selector:@selector(tappedHowToPlayButton:)];
// メニュー生成
CCMenu *topMenu = [CCMenu menuWithItems:_menuItemGamePlay, menuItemNextStage, menuItemPriorStage,
_menuItemHowToPlay, nil];
// メニュー位置設定
topMenu.position = CGPointZero;
_menuItemGamePlay.position = ccp(self.contentSize.width/2, self.contentSize.height/2-290);
menuItemNextStage.position = ccp(self.contentSize.width/2+384, self.contentSize.height/2-291);
menuItemPriorStage.position = ccp(self.contentSize.width/2-384, self.contentSize.height/2-291);
_menuItemHowToPlay.position = ccp(38, self.contentSize.height - 38);
[self addChild:topMenu z:1];
// メニューボタン生成
_btnGamePlay = [CCButton buttonWithTitle:@""
spriteFrame:[CCSpriteFrame frameWithImageNamed:@"Button_GamePlay.png"]
highlightedSpriteFrame:[CCSpriteFrame frameWithImageNamed:@"Button_GamePlay_Sel.png"]
disabledSpriteFrame:nil];
[_btnGamePlay setTarget:self selector:@selector(tappedGamePlayButton:)];
CCButton *btnNextStage = [CCButton buttonWithTitle:@""
spriteFrame:[CCSpriteFrame frameWithImageNamed:@"Button_NextStage.png"]
highlightedSpriteFrame:[CCSpriteFrame frameWithImageNamed:@"Button_NextStage_Sel.png"]
disabledSpriteFrame:nil];
[btnNextStage setTarget:self selector:@selector(tappedNextShapeButton:)];
CCButton *btnPriorStage = [CCButton buttonWithTitle:@""
spriteFrame:[CCSpriteFrame frameWithImageNamed:@"Button_PriorStage.png"]
highlightedSpriteFrame:[CCSpriteFrame frameWithImageNamed:@"Button_PriorStage_Sel.png"]
disabledSpriteFrame:nil];
[btnPriorStage setTarget:self selector:@selector(tappedPriorShapeButton:)];
_btnHowToPlay = [CCButton buttonWithTitle:@""
spriteFrame:[CCSpriteFrame frameWithImageNamed:@"Button_HowToPlay.png"]
highlightedSpriteFrame:[CCSpriteFrame frameWithImageNamed:@"Button_HowToPlay_Sel.png"]
disabledSpriteFrame:nil];
[_btnHowToPlay setTarget:self selector:@selector(tappedHowToPlayButton:)];
// メニューボタン登録
[self addChild:_btnGamePlay z:1];
[self addChild:btnNextStage z:1];
[self addChild:btnPriorStage z:1];
[self addChild:_btnHowToPlay z:1];
// メニューボタン位置設定
_btnGamePlay.position = ccp(self.contentSize.width/2, self.contentSize.height/2-290);
btnNextStage.position = ccp(self.contentSize.width/2+384, self.contentSize.height/2-291);
btnPriorStage.position = ccp(self.contentSize.width/2-384, self.contentSize.height/2-291);
_btnHowToPlay.position = ccp(38, self.contentSize.height - 38);
<所感>
- ほとんど全てのプログラムで利用していたであろうメニュークラス(CCMenu,CCMenuItem)の改変ですので影響範囲が広く、改変内容も互換性の無い変更(文字列置換では対応できない)ですので、多くのプログラマが「なんでやねん」と突っ込んでいるのではないでしょうかw
- この改変もSpriteBuilder対応なんでしょうかね!? ここまで既存クラスを変更しまくったんですから、その分はSpriteBuilderから恩恵を受けたいものです。
ではまた〜
0 件のコメント:
コメントを投稿