void ShopLayer::updateBuyLayout(CCObject* pSender,bool isVis) { UIButton* btn = dynamic_cast<UIButton*>(pSender); UILabel* nameLab = dynamic_cast<UILabel*>(m_buyLayout->getChildByName("propNameLabel")); nameLab->setText(dynamic_cast<UILabel*>(btn->getChildByName("nameLabel"))->getStringValue()); UIImageView* discountImg = dynamic_cast<UIImageView*>(m_buyLayout->getChildByName("discountImg")); discountImg->setVisible(isVis); m_onePri = atoi(dynamic_cast<UILabel*>(btn->getChildByName("priLabel"))->getStringValue()); m_onePriLabel->setText(CCString::createWithFormat("%d",m_onePri)->getCString()); m_buyNum = 1; m_totalPriLabel->setText(CCString::createWithFormat("%d",m_onePri*m_buyNum)->getCString()); }
void ShopLayer::updateScroV(bool isVis) { UIScrollView* scroV = dynamic_cast<UIScrollView*>(m_layerLayout->getChildByName("ScrollView")); for (int i = 0; i < 8; i++) { UIButton* scroPanel = dynamic_cast<UIButton*>(scroV->getChildByName(CCString::createWithFormat("Panel_%d", i)->getCString())); UIImageView* discountImg = dynamic_cast<UIImageView*>(scroPanel->getChildByName("discountImg")); discountImg->setVisible(isVis); } }