void SparDiskPanel::setSelectSparBox(SparBox* sparBox)
{
	if(sparBox == nullptr)
	{
		_selectSparBox = sparBox;
		_introPan->setVisible(false);
		return;
	}
	if(sparBox->getSpar() == 0)
	{
		_introPan->setVisible(false);
	}
	else
	{
		_introPan->setVisible(true);		
	}
	if(_selectSparBox != sparBox)
	{
		if(_selectSparBox != nullptr)
			_selectSparBox->setFocusd(false);
		_selectSparBox = sparBox;
		_selectSparBox->setFocusd(true);
		updateIntro();
	}
}
Exemple #2
0
void User::setShareRewardsLock(int index, int value)
{
	_shareRewardsLock[index] = value;

	auto node = PopPanel::getInstance()->hasPanelByName("shareAward");
	if(node != nullptr)
	{
		auto shareAwardPanel = dynamic_cast<ShareAwardPanel*>(node);
		shareAwardPanel->updateIntro();
	}

	// 坚持是否都获得
	bool open = false;
	for(int i = 0; i < 2; i++)
	{
		if(_shareRewardsLock[i] == 0)
		{
			open = true;
			break;
		}
	}
	if(open == false)
		setShareRewardOpen(false);

	// 保存
	ValueMap map = saveModel();
	FileUtils::getInstance()->writeToFile(map,_path);
}
void SparDiskPanel::onRefine(cocos2d::Ref *ref, Widget::TouchEventType touchType)
{
	if (touchType == Widget::TouchEventType::ENDED) 
	{
		auto typeId = _introSpar;
		if(typeId <= 0)return;
		auto spar = _sparDisk->getSpar(typeId);
		auto owner = dynamic_cast<Player*>(_sparDisk->getOwner());
		if(owner == nullptr) return;
		auto sparPatchNum = owner->getItemBag()->getPropSizeByType(2002005);
		if(sparPatchNum >= spar->getCostPatchNum())
		{
			PopPanel::getInstance()->confirm("upConfirm","type:Text---text:"+spar->getUpConfirm(),PromptPanel::TYPE_DONE_CANCEL,[=](){
				owner->usePropByType(2002005,spar->getCostPatchNum());
				PopPanel::getInstance()->note("cantUpConfirm","type:Text---text:"+a2u("¹§Ï²Ä㣬¾§Ê¯ÌáÁ¶³É¹¦"), 1.0f, false, true);
				spar->upLevel();
				_sparDisk->updateAddData();
				updateIntro();
			},nullptr,true,true);
		}
		else
		{
			PopPanel::getInstance()->note("cantUpConfirm","type:Text---text:"+a2u("ËéƬÊýÁ¿²»×ã")+cocos2d::Value(spar->getCostPatchNum()).asString()+a2u("¸ö"), 1.0f, false, true);
		}
	}
}