void GeneralGroupLogic::GeneralBottonClicked( CCObject* pSender ) { UIButton* pButton = DynamicCast<UIButton*>(pSender); int widgetTag = pButton->getWidgetTag(); EGeneralType type = m_generalData[widgetTag]; GeneralFactory::Get().CreateGeneral(this, type, ccp(240,200)); pButton->setTouchEnable(false); pButton->setPressState(WidgetStateDisabled); if (m_buttonCdMap.find(pButton) == m_buttonCdMap.end()) m_buttonCdMap.insert(std::pair<UIButton*, float>(pButton, 0.0f)); }
void ShopLayer::tapMenuCallBack( CCObject* pSender ) { UIButton* button = dynamic_cast<UIButton*>(pSender); Layout* root = dynamic_cast<Layout*>(m_pUILayer->getWidgetByTag(SHOP_LAYOUT_TAG_ROOT)); UIButton* equipBtn = dynamic_cast<UIButton*>(root->getChildByTag(SHOP_LAYOUT_TAG_EQUIP)); UIButton* tejiaBtn = dynamic_cast<UIButton*>(root->getChildByTag(SHOP_LAYOUT_TAG_TEJIA)); UIButton* diamondBtn = dynamic_cast<UIButton*>(root->getChildByTag(SHOP_LAYOUT_TAG_DIAMOND)); UIButton* yaoshuiBtn = dynamic_cast<UIButton*>(root->getChildByTag(SHOP_LAYOUT_TAG_YAOSHUI)); UIButton* otherBtn = dynamic_cast<UIButton*>(root->getChildByTag(SHOP_LAYOUT_TAG_OTHER)); equipBtn->active(); tejiaBtn->active(); diamondBtn->active(); yaoshuiBtn->active(); otherBtn->active(); switch (button->getWidgetTag()) { case SHOP_LAYOUT_TAG_EQUIP: { m_curTapMenu = SHOP_LAYOUT_TAG_EQUIP; equipBtn->disable(); updateScroV(false); }break; case SHOP_LAYOUT_TAG_TEJIA: { m_curTapMenu = SHOP_LAYOUT_TAG_TEJIA; tejiaBtn->disable(); updateScroV(true); }break; case SHOP_LAYOUT_TAG_DIAMOND: { m_curTapMenu = SHOP_LAYOUT_TAG_DIAMOND; diamondBtn->disable(); updateScroV(false); }break; case SHOP_LAYOUT_TAG_YAOSHUI: { m_curTapMenu = SHOP_LAYOUT_TAG_YAOSHUI; yaoshuiBtn->disable(); updateScroV(false); }break; case SHOP_LAYOUT_TAG_OTHER: { m_curTapMenu = SHOP_LAYOUT_TAG_OTHER; otherBtn->disable(); updateScroV(false); }break; } // UIScrollView* scroV = dynamic_cast<UIScrollView*>(m_layerLayout->getChildByName("ScrollView")); // Layout* scroPanel[6]; // for (int i = 0; i < 6; i++) // { // scroPanel[i] = dynamic_cast<UIButton*>(scroV->getChildByName(CCString::createWithFormat("Panel_%d", i)->getCString())); // scroPanel[i]->setBackGroundColor(ccc3(150,200,255)); // } }