TableViewCell* UIBuyBuildingLayer::tableCellAtIndex( TableView *table, ssize_t idx )
{
	auto string = String::createWithFormat("%ld", idx);
	auto cell = dynamic_cast<CustomTableViewCell*>(table->dequeueCell());
	if (!cell)
	{
		cell = CustomTableViewCell::create();
		cell->setCilckTarget(CC_CALLBACK_1(UIBuyBuildingLayer::onCardClick,this));
	}   
	auto buycfg = BuyListConfig::getBuyListFromType( (OpenBuilding::BuyBuildingType)_curtag).at(idx);
	auto con = Configuration::getInstance();

	auto texture = Director::getInstance()->getTextureCache()->addImage(BuildingCommon::getPicFromId(buycfg->buildcfg->id));
	cell->getInfoPic()->setTexture(texture,BuildingCommon::getPicFromId(buycfg->buildcfg->id).c_str());

    cell->getTitle()->setString(buycfg->buildcfg->name);
	auto str = String::createWithFormat("%d",buycfg->buildcfg->cost_value);
	cell->getLableCost()->setString(str->getCString());
	str = String::createWithFormat("%d s",buycfg->buildcfg->cost_time);
	cell->getTimeLable()->setString(str->getCString());
	str = String::createWithFormat("%d/%d",buycfg->current,buycfg->opencfg->getLimitCountFormLevel(BuildingFunc::getInstance()->getMainLevel()));
	cell->getHasBuildLable()->setString(str->getCString());

	//Check is Disable
	if (buycfg->current >= buycfg->opencfg->getLimitCountFormLevel(BuildingFunc::getInstance()->getMainLevel()))
	{  
		auto level = 1;
		for (auto i = level;i <= 10; i++)
		{
			if ( buycfg->opencfg->getLimitCountFormLevel(i) > buycfg->current )
			{   
				level = i;
				break;
			}
		}
       if (level != 1)
       {
		   auto str = String::createWithFormat(con->getValue("levelcanmake").asString().c_str(),level);
		   cell->setDisable(true,str->getCString());
       }
	   else
	   {
		   cell->setDisable(true);
	   }
	}
	else
	{
		cell->setDisable(false);
	}
     
	return cell;
}
Exemple #2
0
void MdssRot::setTransform(const utils::eTransform& rot, const bool& rotUsed)
{
    int flags = utils::getMdpOrient(rot);
    if (flags != -1)
        setRotations(flags);
    //getMdpOrient will switch the flips if the source is 90 rotated.
    //Clients in Android dont factor in 90 rotation while deciding the flip.
    mOrientation = static_cast<utils::eTransform>(flags);
    ALOGE_IF(DEBUG_OVERLAY, "%s: rot=%d", __FUNCTION__, flags);

    setDisable();
    if(rotUsed) {
        setEnable();
    }
}
inline void MdssRot::setRotatorUsed(const bool& rotUsed) {
    setDisable();
    if(rotUsed) {
        setEnable();
    }
}
Exemple #4
0
void ArmyEngine::setStateDisable(const std::string& attr_key) {
	auto stateManager = StateManager::getInstance();
	stateManager->setDisable(attr_key);
}