void ChoiceLayer::choicesCallback(Ref* sender, Control::EventType event) { ControlButton *pressedBtn = (ControlButton*)sender; _selectedTag = pressedBtn->getTag(); CCLOG("Select tag : %d", _selectedTag); for (auto child : getChildren()) child->setOpacity(0); }
void SpineTest::changeAnime(Object *sender, Control::EventType type) { if(mAnime == NULL) { log("mAnime is NULL"); return; } // ControlButton *button = dynamic_cast<ControlButton *>(sender); if(button == NULL) { return; } // int tag = button->getTag(); switch(tag) { case kTagButtonWalk: { log("walk"); mAnime->setAnimation(0, "walk", true); break; } case kTagButtonJump: { log("jump"); mAnime->setAnimation(0, "jump", true); break; } case kTagButtonHurt: { log("hurt"); mAnime->setAnimation(0, "hurt", true); break; } case kTagButtonIdle: { log("idle"); mAnime->setAnimation(0, "idle", true); break; } } }
void TDDSubMenu::touchUpInsideAction(Ref *sender, Control::EventType controlEvent) { ControlButton *button = (ControlButton *)sender; log("Button is clicked"); int tag = button->getTag(); switch(tag) { case kActionTagToggle: { toggleMenu(); break; } case kActionTagBack: { closeTest(); break; } } }