本文整理汇总了C++中MenuItemToggle::runAction方法的典型用法代码示例。如果您正苦于以下问题:C++ MenuItemToggle::runAction方法的具体用法?C++ MenuItemToggle::runAction怎么用?C++ MenuItemToggle::runAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItemToggle
的用法示例。
在下文中一共展示了MenuItemToggle::runAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fieldGuideInformati
//图鉴内容开关
void HeroInformationMenuLayer::fieldGuideInformati(Ref *sender){
MenuItemToggle * t = (MenuItemToggle *)sender;
if (t->getSelectedIndex() == 1) {
t->setEnabled(false);
illustratedHhandbook->setZOrder(100);
auto fieldImage = t->getSubItems().at(0);
auto fieldGuideMove = MoveBy::create(0.5, Vec2(vSize.width / 5, 0));
auto fieldGuideRotation = RotateBy::create(0.5, -90);
auto fieldGuideScale = ScaleBy::create(0.5, vSize.width / (fieldImage->getContentSize().width * 2));
auto fieldGuideCall = CallFunc::create([=](){
t->setEnabled(true);
});
auto seqAction = Spawn::create(fieldGuideMove, fieldGuideRotation, fieldGuideScale, NULL);
auto sequenceAC = Sequence::create(seqAction, fieldGuideCall, NULL);
t->runAction(sequenceAC);
}
if (t->getSelectedIndex() == 0) {
t->setEnabled(false);
auto fieldImage = t->getSubItems().at(0);
float scale = vSize.width / (fieldImage->getContentSize().width * 2);
auto fieldGuideMove = MoveBy::create(0.5, Vec2(-vSize.width / 5, 0));
auto fieldGuideRotation = RotateBy::create(0.5, 90);
auto fieldGuideScale = ScaleBy::create(0.5, fieldImage->getContentSize().width / (fieldImage->getContentSize().width * scale));
auto spaAction = Spawn::create(fieldGuideMove, fieldGuideRotation, fieldGuideScale, NULL);
auto callAction = CallFunc::create([=](){
illustratedHhandbook->setZOrder(0);
t->setEnabled(true);
});
auto seqAction = Sequence::create(spaAction, callAction, NULL);
t->runAction(seqAction);
}
}