本文整理汇总了C++中CCMenuItemSprite::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemSprite::setColor方法的具体用法?C++ CCMenuItemSprite::setColor怎么用?C++ CCMenuItemSprite::setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItemSprite
的用法示例。
在下文中一共展示了CCMenuItemSprite::setColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateMe
void LayerGoods::updateMe()
{
UserInfo *user_info = Topwo::getInstance()->getTopwoData()->getUserInfo();
CCMenu* menu = static_cast<CCMenu*>(this->getChildByTag(0));
//体魄
int goods_level = 0;
CCMenuItemSprite* item = NULL;
CCSprite* sprite = NULL;
CCLabelAtlas* la = NULL;
for (int i = 1; i <= 5; i++)
{
if (i == 1)
{
goods_level = getGoodsLevel(user_info->getCurrentGoodsLevelTiPo());
}
else if (i == 2)
{
goods_level = getGoodsLevel(user_info->getCurrentGoodsLevelMeiLi());
}
else if (i == 3)
{
goods_level = getGoodsLevel(user_info->getCurrentGoodsLevelZhiLi());
}
else if (i == 4)
{
goods_level = getGoodsLevel(user_info->getCurrentGoodsLevelEQ());
}
else if (i == 5)
{
goods_level = getGoodsLevel(user_info->getCurrentGoodsLevelGanXing());
}
item = static_cast<CCMenuItemSprite*>(menu->getChildByTag(i));
if (goods_level >= 9)
{
item->setEnabled(false);
item->setColor(ccc3(128, 128, 128));
}
sprite = static_cast<CCSprite*>(this->getChildByTag(i));
la = static_cast<CCLabelAtlas*>(sprite->getChildByTag(0));
la->setString(CCString::createWithFormat("%d", goods_level)->getCString());
la = static_cast<CCLabelAtlas*>(sprite->getChildByTag(1));
la->setString(CCString::createWithFormat("%d", getGoodsBonus(goods_level))->getCString());
la = static_cast<CCLabelAtlas*>(sprite->getChildByTag(2));
la->setString(CCString::createWithFormat("%d", getGoodsPrice(goods_level))->getCString());
}
SceneMain* scene_main = static_cast<SceneMain*>(CCDirector::sharedDirector()->getRunningScene()->getChildByTag(0));
scene_main->updateMe();
}