本文整理汇总了C++中MenuItemSprite::setEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ MenuItemSprite::setEnabled方法的具体用法?C++ MenuItemSprite::setEnabled怎么用?C++ MenuItemSprite::setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItemSprite
的用法示例。
在下文中一共展示了MenuItemSprite::setEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createLayersContent
void ConfirmLayer::createLayersContent() {
GameModel* gameModel = GameModel::getInstance();
Face* backgroundFade = new Face();
backgroundFade->initWithFile(ANI_BACKGROUND_FADE);
backgroundFade->setPosition(Point(gameModel->getDisplayResolutionSize().width / 2, gameModel->getDisplayResolutionSize().height / 2));
backgroundFade->setOpacity(0);
this->mainLayer->addChild(backgroundFade);
this->backgroundFade = backgroundFade;
{
FiniteTimeAction* fadeIn = FadeIn::create(0.5f);
backgroundFade->registerState(STATE_FADE_IN, fadeIn);
FiniteTimeAction* fadeOut = FadeOut::create(0.5f);
backgroundFade->registerState(STATE_FADE_OUT, fadeOut);
}
Face* menuFace = new Face();
menuFace->initWithSpriteFrameName(ANI_BOX_CONFIRM);
menuFace->setPosition(Point(gameModel->getDisplayResolutionSize().width / 2, -500));
this->mainLayer->addChild(menuFace);
this->menuFace = menuFace;
Size menuFaceSize = menuFace->getContentSize();
UGMenu* optionMenu = UGMenu::create();
optionMenu->setPosition(Point::ZERO);
menuFace->addChild(optionMenu);
{
Label* confirmLabel = Label::createWithBMFont(FONT_GAME_SMALL, TXT_CONFIRM_TEXT);
confirmLabel->setPosition(menuFaceSize.width / 2, menuFaceSize.height / 2);
this->menuFace->addChild(confirmLabel);
}
{
FiniteTimeAction* move1 = MoveTo::create(0, menuFace->getPosition());
FiniteTimeAction* move2 = MoveTo::create(0.5f, Point(gameModel->getDisplayResolutionSize().width / 2, gameModel->getDisplayResolutionSize().height / 2));
FiniteTimeAction* move3 = CallFunc::create(CC_CALLBACK_0(ConfirmLayer::onOptionBoardMoveUpDone, this));
FiniteTimeAction* move123 = Sequence::create(move1, move2, move3, NULL);
menuFace->registerState(STATE_MOVE_UP, move123);
FiniteTimeAction* move4 = MoveTo::create(0, Point(gameModel->getDisplayResolutionSize().width / 2, gameModel->getDisplayResolutionSize().height / 2));
FiniteTimeAction* move5 = MoveTo::create(0.5f, menuFace->getPosition());
FiniteTimeAction* move6 = CallFunc::create(CC_CALLBACK_0(ConfirmLayer::onOptionBoardMoveDownDone, this));
FiniteTimeAction* move456 = Sequence::create(move4, move5, move6, NULL);
menuFace->registerState(STATE_MOVE_DOWN, move456);
MenuItemSprite* okButton = Utils::createButton((char*) TXT_OK, 16, ANI_BUTTON_SMALL, ANI_BUTTON_SMALL);
okButton->setCallback(CC_CALLBACK_1(ConfirmLayer::onOkButtonClick, this));
okButton->setPosition(Point(menuFaceSize.width / 2 - 129, 0));
okButton->setEnabled(false);
optionMenu->addChild(okButton);
this->okButton = okButton;
MenuItemSprite* cancelButton = Utils::createButton((char*) TXT_CANCEL, 16, ANI_BUTTON_SMALL, ANI_BUTTON_SMALL);
cancelButton->setCallback(CC_CALLBACK_1(ConfirmLayer::onCancelButtonClick, this));
cancelButton->setPosition(Point(menuFaceSize.width / 2 + 129, 0));
cancelButton->setEnabled(false);
optionMenu->addChild(cancelButton);
this->cancelButton = cancelButton;
}
}