当前位置: 首页>>代码示例>>C++>>正文


C++ CCMenuItemLabel::getLabel方法代码示例

本文整理汇总了C++中CCMenuItemLabel::getLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemLabel::getLabel方法的具体用法?C++ CCMenuItemLabel::getLabel怎么用?C++ CCMenuItemLabel::getLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCMenuItemLabel的用法示例。


在下文中一共展示了CCMenuItemLabel::getLabel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: musicButtonTapped

void Options::musicButtonTapped(CCObject*object)
{
    SimpleAudioEngine::sharedEngine()->playEffect("Select.wav", false);
    CCMenuItemLabel *SoundFX = (CCMenuItemLabel*)object;
    CCLabelTTF *label = (CCLabelTTF *)SoundFX->getLabel();
    
    if(SaveLoad::m_SaveData.musicVolume <= 0.0f)
    {
        SaveLoad::m_SaveData.musicVolume = 1.0f;
        label->setString("Music:  ON");
        AudioManager::g_MasterMusicAudio = 1.0f;
    }
    else
    {
        SaveLoad::m_SaveData.musicVolume = 0.0f;
        label->setString("Music:  OFF");
        AudioManager::g_MasterMusicAudio = 0.0f;
    }
    AudioManager::AudioOn();
    SaveLoad::Save();
}
开发者ID:ryanmcbride,项目名称:CrashTestMonkeysDroid,代码行数:21,代码来源:Options.cpp

示例2: eventMenuCallback

void AccountLayer::eventMenuCallback(CCObject* pSender) {
    CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)pSender;
    char buf[64];
    int i = pMenuItem->getTag();
    
    CCLog("DeviceId:%s", TDCCTalkingDataGA::getDeviceId());

    sprintf(buf, s_EventMenuItem[i].id.c_str(), ++_indexes[i]);
    CCLabelTTF* label = (CCLabelTTF*)pMenuItem->getLabel();
    label->setString(buf);
    switch (i) {
    case CREATE_USER_ID:
    	mTDGAaccount = TDCCAccount::setAccount(label->getString());
        break;
            
    case ADD_LEVEL:
        if (mTDGAaccount) mTDGAaccount->setLevel(_indexes[i]);
        break;
            
    case UPDATE_GAME_SERVER:
        if (mTDGAaccount) mTDGAaccount->setGameServer(label->getString());
        break;
            
    case UPDATE_USER_NAME:
        if (mTDGAaccount) mTDGAaccount->setAccountName(label->getString());
        break;

    case UPDATE_GENDER:
    	if (mTDGAaccount) mTDGAaccount->setGender(mTDGAaccount->kGenderMale);
    	break;

    case UPDATE_TYPE:
    	if (mTDGAaccount) mTDGAaccount->setAccountType(mTDGAaccount->kAccountType1);
    	break;

    default:
        break;
    }
}
开发者ID:CaiZhongda,项目名称:game-analytics-cocos2dx,代码行数:39,代码来源:AccountScene.cpp

示例3: menuItemCallback

void TestAircraft::menuItemCallback(CCObject* menuItem)
{
	CCMenuItemLabel* menuItemLabel = dynamic_cast<CCMenuItemLabel*>(menuItem);

	CCSize screenSize = CCDirector::sharedDirector()->getWinSize();

	if(menuItemLabel)
	{
		CCLabelTTF* label = dynamic_cast<CCLabelTTF*>(menuItemLabel->getLabel());

		if(!label)
			return;

		string labelString = label->getString();

		if(labelString == "straight")
		{
			// straight
			{
				Aircraft* enemy = Aircraft::createEnemyStraight();
				addChild(enemy);
				enemy->setPosition(screenSize.width/2, screenSize.height/2 + 150);
			}
		}
		else if(labelString == "omni")
		{
			// enemy omni
			{
				Aircraft* omni = Aircraft::createEnemyOmni();
				addChild(omni);
				omni->setPosition(screenSize.width/2, screenSize.height/2 + 150);
			}
		}
		else if(labelString == "ray gun")
		{
			// ray gun
			{
				Aircraft* enemy = Aircraft::createEnemyRayGun();
				addChild(enemy);
				enemy->setPosition(screenSize.width/2, screenSize.height/2 + 150);
			}
		}
		else if(labelString == "tank")
		{
			// tank
			{
				Aircraft* enemy = Aircraft::createEnemyTank();
				addChild(enemy);
				enemy->setPosition(screenSize.width/2, screenSize.height/2 + 150);
			}
		}

		else if(labelString == "boss00")
		{

			// enemy boss
			Aircraft* boss = Aircraft::createBoss00();
			addChild(boss);
			boss->setPosition(screenSize.width/2, screenSize.height/2 + 150);
		}

		else if(labelString == "boss01")
		{
			// boss 01
			{
				Aircraft* enemy = Aircraft::createBoss01();
				addChild(enemy);
				enemy->setPosition(screenSize.width/2, screenSize.height/2 + 150);
			}
		}

		else if(labelString == "hero")
		{
			Aircraft* hero = Aircraft::createHeroAircraft();
			addChild(hero);
			hero->setPosition(screenSize.width/2, screenSize.height/2);
			GameController::sharedInstance()->setPlayerAircraft(hero);
		}
	}
}
开发者ID:1194451658,项目名称:chromium-bsu-x,代码行数:80,代码来源:TestAircraft.cpp


注:本文中的CCMenuItemLabel::getLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。