예제 #1
0
void CSharpTollgate::onBattle(CCObject* pSender)
{
	PlayEffectSound(SFX_Button);

	CButton *btn = (CButton*)pSender;
	CStage *stage = (CStage*)btn->getUserData();
	int zorder = btn->getZOrder();
	if (stage&&stage->isOpen)
	{
		BattleManage->setLastStageId(stage->id); 
		if (stage->star>=1)
			BattleManage->setFirstStage(false);
		//DataCenter::sharedData()->getWar()->setTollgate(*stage); 
		BattleManage->setStageType(zorder);
		BattleManage->setNormal(false);
		BattleManage->setChapterIndex(m_chapter);
		BattleManage->setChapterCount(m_openChapter);

		CTollgatePreview *preview = CTollgatePreview::create();
		preview->setStar(stage->star);
		preview->setIsLastStageInChapter(stage->id==m_stageList.at(m_stageList.size()-1).id&&stage->star<=0);
		LayerManager::instance()->push(preview);
		preview->setStage(stage->id, stage->name.c_str());
		CStageInfoRes *ir = DATAPOOL->getStageInfoById(stage->id);		
		preview->setNormal(false);
		if (ir)
		{
			preview->showStageInfo(*ir);
		}
		else
		{
			CPlayerControl::getInstance().sendStageInfo(stage->id);
		}
	}
}
예제 #2
0
void CCommandLayer::onSelectCity(CCObject* pSender)
{
	CButton *btn = (CButton*)pSender;
// 	m_selectCellImg->setPosition(btn->getParent()->convertToWorldSpace(btn->getPosition()));
	m_selectCellImg->removeFromParent();

	btn->addChild(m_selectCellImg);
	m_selectCellImg->setVisible(true);
	m_selectCellImg->setPosition(ccp(btn->getContentSize().width/2,btn->getContentSize().height/2));

	m_selectCity = (CCity*)btn->getUserData();
	updateSelectCity(m_selectCity);
}