示例#1
0
void CityListLayer::onPressCityBtn(CCObject* sender)
{
	if (playerMoving)
	{
		return;
	}

	CCMenuItem* menuItem = dynamic_cast<CCMenuItem*>(sender);
	if(menuItem)
	{
		CCNode* node = menuItem->getParent();
		CCMenu* menu = dynamic_cast<CCMenu*>(node);
		if(menu)
		{
			CCNode* parent = menu->getParent();
			IconButton* button = dynamic_cast<IconButton*>(parent);
			if(button)
			{
				playerMoving = true;
				int index = button->GetButtonIndex();	

				targetCityId = cityInfoList[index - 1].cityId;
				moveToCity(targetCityId, 0);
							
			}
		}
	}
}
示例#2
0
	bool UIScrollPage::dispatchTutorialMsg(CCObject* pObject,unsigned int type)
	{
		UIMenu* menu = NULL;
		CCMenuItem* menuItem = dynamic_cast<CCMenuItem*>(pObject);
		if(menuItem)
		{
			CCNode* node = menuItem->getParent();
			menu = dynamic_cast<UIMenu*>(node);			
		}
		else
		{
			menu = dynamic_cast<UIMenu*>(pObject);
		}

		if(menu)
		{
			CCNode* parent = menu->getParent();
			IconButton* button = dynamic_cast<IconButton*>(parent);
			char name[50];
			sprintf(name,"%s_%d",this->m_strName.c_str(),button->GetButtonIndex());
			return TutorialsManager::Get()->HandleOneEvent(name,type);
		}

		return true;
	}
示例#3
0
void FrontCoverLayer::onClickedOneSever(CCObject* pSender)
{
	CCMenuItem* menuItem = dynamic_cast<CCMenuItem*>(pSender);
	if(menuItem)
	{
		CCNode* node = menuItem->getParent();
		CCMenu* menu = dynamic_cast<CCMenu*>(node);
		if(menu)
		{
			CCNode* parent = menu->getParent();
			IconButton* button = dynamic_cast<IconButton*>(parent);
			if(button)
			{
				int buttonIndex = button->GetButtonIndex();
				// to do
				SeverInfo* info = m_severList[buttonIndex];
				if(info)
				{
					USERINFO data = UserData::GetUserInfo();
					sprintf(data.ip,"%s",info->severIp);
					sprintf(data.lastServerName,"%s",info->name);
					data.port = info->port;
					UserData::SetUserInfo(data);
					//onCLickedSeverCloseBt(pSender);
					XLogicManager::sharedManager()->logIn();
				}
			}
		}
	}
}