void GameConfig::setTutorialProgress(PH::TutorialProgress progress) { tutorialMode = progress; CCUserDefault* user = CCUserDefault::sharedUserDefault(); user->setIntegerForKey(CONFIG_TUTORIAL_PROGRESS, tutorialMode); user->flush(); }
void GameConfig::setBGMEnabled(bool val) { mEnableBGM = val; CCUserDefault* user = CCUserDefault::sharedUserDefault(); user->setBoolForKey(CONFIG_BGM_KEY, mEnableBGM); user->flush(); }
void GameConfig::save() { std::string playerUID = PlayerData::getInstance()->player->uid; CCUserDefault* user = CCUserDefault::sharedUserDefault(); user->setBoolForKey((playerUID + "_instance_stage").c_str(), showInstanceStage); user->setBoolForKey((playerUID + "_soul_exchange").c_str(), showSoulExchange); user->setBoolForKey((playerUID + "_shuffle_relation").c_str(), showShuffleRelation); user->setBoolForKey((playerUID + "_first_time_neili").c_str(), firstTimeNeili); user->setBoolForKey((playerUID + "_first_time_instance").c_str(), firstTimeShowInstance); user->setBoolForKey((playerUID + "_first_time_zhuansheng").c_str(), firstTimeZhuansheng); user->setIntegerForKey((playerUID + "_open_instance").c_str(), openInstanceStep); user->setBoolForKey((playerUID + "_open_jueding10").c_str(), openJueDing10); user->setBoolForKey((playerUID + "_show_drag_hint").c_str(), showDragHint); user->setBoolForKey((playerUID + "_show_attr_hint").c_str(), showAttrHint); user->flush(); }
void LoginLayer::onClickedLogin(CCObject *sender, TouchEventType event) { if (event == TOUCH_EVENT_ENDED) { SimpleAudioEngine::sharedEngine()->playEffect(BUTTON_CLICK); _msg->setText(""); LoginMeg tmpMeg; tmpMeg.name = _account->getText(); tmpMeg.pwd = _password->getText(); if (tmpMeg.name.empty()) { _msg->setText("请输入联众账号!"); return; } if (tmpMeg.pwd.empty()) { _msg->setText("请输入账号密码!"); return; } CCUserDefault* userDefault = CCUserDefault::sharedUserDefault(); userDefault->setStringForKey(SAVE_H_ACCOUNT, tmpMeg.name); userDefault->setStringForKey(SAVE_H_PASSWORD, tmpMeg.pwd); userDefault->flush(); CCNotificationCenter::sharedNotificationCenter()->postNotification(EVENT_LOGIN2MEG, &tmpMeg); } }
void MainGameScene::endJudgemnet() { setTouchEnabled(true); for(int i = 1; i <= COL_NUM * ROW_NUM; i++){ Arrow* arrowObj = (Arrow *)this->getChildByTag(i); if( ! arrowObj->getOnFlag()){ //まだ全てONになっていない return; } } //終了 endFlag = true; //ハイスコアであれば保持 CCUserDefault* userDefault = CCUserDefault::sharedUserDefault(); int highScore = userDefault->getFloatForKey(highScoreKey.c_str(),ConstCommon::DEFAULT_HIGH_SCORE_NUM); if( highScore > totalGameCount){ isHighScore = true; userDefault->setFloatForKey(highScoreKey.c_str(), totalGameCount); } //ゲーム回数を記録 int totalAllGameCount = userDefault->getFloatForKey(totalAllGameCountKey.c_str(),0); userDefault->setFloatForKey(totalAllGameCountKey.c_str(), totalAllGameCount+1); userDefault->flush(); //終了アニメーション this->endAnimation(); }
void Memory::saveBasic() { CCUserDefault * def = CCUserDefault::sharedUserDefault(); // Json::Value val(Json::ValueType::objectValue); // val["accountId"] = _accountId; // val["password"] = _passwordHashed; // val["lastServerId"] = _lastServerId; // val["musicOn"] = _musicOn; // val["effectOn"] = _effectOn; // // // Json::Value val2(Json::ValueType::arrayValue); // for (auto tr:_pendingTransactions) // { // Json::Value val3(Json::ValueType::objectValue); // val3["p"] = tr.productId; // val3["t"] = tr.transactionId; // val3["r"] = tr.receipt; // // val2[val2.size()] = val3; // } // val["pendingTransactions"] = val2; // def->setStringForKey("Memory_basic", SSTR(val)); def->flush(); }
void GameConfig::setAndroidHDEnabled(bool val) { mEnableAndroidHD = val; CCUserDefault* user = CCUserDefault::sharedUserDefault(); user->setBoolForKey(CONFIG_ANDROID_HD_KEY, mEnableAndroidHD); user->flush(); }
void GameConfig::setSFXEnabled(bool val) { mEnableSFX = val; CCUserDefault* user = CCUserDefault::sharedUserDefault(); user->setBoolForKey(CONFIG_SFX_KEY, mEnableSFX); user->flush(); }
KDvoid Ch3_SavingSimpleData::saveDifficulty ( KDvoid ) { // Save our difficulty CCUserDefault* pDefaults = CCUserDefault::sharedUserDefault ( ); pDefaults->setStringForKey ( "simple_data_difficulty", m_sDifficulty.c_str ( ) ); pDefaults->flush ( ); }
void GameData::saveSettings() { #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) CCUserDefault* write = CCUserDefault::sharedUserDefault(); write->setBoolForKey("IsExisted", _isExisted); write->setIntegerForKey("HighScore", _highScore); write->flush(); #elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) JNI_setBool("IsExisted", _isExisted); JNI_setInt("HighScore", _highScore); #endif }
void LocalData::writeRuntimeDataToLocal() { CCUserDefault* userDefault = CCUserDefault::sharedUserDefault(); userDefault->setBoolForKey("hasmusic", RunTimeData::getInstance()->hasMusic); userDefault->setBoolForKey("guiderecord", RunTimeData::getInstance()->isFirstTime); userDefault->setStringForKey("levelStarStr", RunTimeData::getInstance()->levelStars); userDefault->setIntegerForKey("passedLevelNum", RunTimeData::getInstance()->passedLevel); userDefault->setIntegerForKey("totalStarNum", RunTimeData::getInstance()->startNum); userDefault->setIntegerForKey("annihilator", RunTimeData::getInstance()->annihilatorNum); userDefault->setBoolForKey("isFirstTime", RunTimeData::getInstance()->isFirstTime); userDefault->flush(); }
void Config::flush() { CCUserDefault* ud = CCUserDefault::sharedUserDefault(); ud->setBoolForKey(CONFIG_KEY_MUTE, m_mute); ud->setBoolForKey(CONFIG_KEY_HASSAVEDPUZZLE, m_hasSavedPuzzle); ud->setIntegerForKey(CONFIG_KEY_HIGHSCORE, m_highScore); ud->setIntegerForKey(CONFIG_KEY_HIGHLEVEL, m_highLevel); ud->setIntegerForKey(CONFIG_KEY_SAVEDSCORE, m_savedScore); ud->setIntegerForKey(CONFIG_KEY_SAVEDTARGET, m_savedTarget); ud->setIntegerForKey(CONFIG_KEY_SAVEDLEVEL, m_savedLevel); ud->setIntegerForKey(CONFIG_KEY_SAVEDROW, m_savedRow); ud->setIntegerForKey(CONFIG_KEY_SAVEDCOL, m_savedCol); ud->setStringForKey(CONFIG_KEY_SAVEDPUZZLE, m_savedPuzzle); ud->flush(); }
void GameData::saveSettings() { #if (ANDROIDSAVEBYUSERDEFAULT == 1 && CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) JNI_setBool("IsBeginner", gd_isBeginner); JNI_setInt("HighScore", gd_highScore); JNI_setInt("Gold", gd_gold); #elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) CCUserDefault* write = CCUserDefault::sharedUserDefault(); write->setBoolForKey("IsBeginner", gd_isBeginner); write->setIntegerForKey("HighScore", gd_highScore); write->setIntegerForKey("Gold", gd_gold); write->flush(); #endif }
void GameScene::showHighScoreLabel() { CCUserDefault* userDefault = CCUserDefault::sharedUserDefault(); const char* highScorekey = "hightscore"; float highScore = userDefault->getFloatForKey(highScorekey, 99.9); if (gametime != 0) { if (gametime > highScore) { return; } else { highScore = gametime; userDefault->setFloatForKey(highScorekey, highScore); userDefault->flush(); } } const int tagHighScoreLabel = 200; CCString* highScoreString = CCString::createWithFormat("%8.1fs", highScore); CCLabelTTF* highScoreLabel = (CCLabelTTF*)this->getChildByTag(tagHighScoreLabel); if (highScoreLabel) { highScoreLabel->setString(highScoreString->getCString()); } else { CCSize winSize = CCDirector::sharedDirector()->getWinSize(); highScoreLabel = CCLabelTTF::create(highScoreString->getCString(), "Arial", 24.0); highScoreLabel->setPosition(ccp(winSize.width*0.9, winSize.height*0.7)); highScoreLabel->setTag(tagHighScoreLabel); this->addChild(highScoreLabel); } }
bool LevelSelectScene::initWithPage(int pageNum) { CCSize winSize = CCDirector::sharedDirector()->getWinSize(); // 初期化色を変更 if (!CCLayerColor::initWithColor(ccc4(0xF8,0xEC,0xDE,0xFF))) //RGBA { return false; } this->page_num = pageNum; CCUserDefault* userDefault = CCUserDefault::sharedUserDefault(); // is_tutorial string tutorialKey = ConstCommon::getTutorialKey(); bool tutorClear = userDefault->getBoolForKey(tutorialKey.c_str()); if( ! tutorClear){ userDefault->setBoolForKey(tutorialKey.c_str(), true); userDefault->flush(); } //start button CCArray* pLevelArr = new CCArray; //page1->1〜15 ... page2->16〜30 for (int i=1 + ((page_num - 1)* 15); i <= 15 + ((page_num - 1)* 15); i++) { //create Level Button pLevelArr->addObject(createLevelImage(i)); } CCMenu* pMenu = CCMenu::createWithArray(pLevelArr); pMenu->setPosition(CCPointZero); pMenu->setTag(tagLevelSelectMenuDialog); if(this->page_num != 2){ CCMenuItemImage* nextItem = CCMenuItemImage::create("next.png","next.png.png" ,this, menu_selector(LevelSelectScene::showNextPage)); nextItem->setPosition(ccp(winSize.width * 0.8, winSize.height * 0.2)); nextItem->setScale(0.2); pMenu->addChild(nextItem); } if(this->page_num != 1){ CCMenuItemImage* prevItem = CCMenuItemImage::create("prev.png","prev.png" ,this, menu_selector(LevelSelectScene::showPrevPage)); prevItem->setPosition(ccp(winSize.width * 0.2, winSize.height * 0.2)); prevItem->setScale(0.2); pMenu->addChild(prevItem); } this->addChild(pMenu); CCString* stageSelectStr = CCString::createWithFormat("STAGE SELECT"); CCLabelTTF* stageSelectLabel = CCLabelTTF::create(stageSelectStr->getCString(), "Copperplate", 70.0); stageSelectLabel->setColor(ccc3(0, 0, 0)); stageSelectLabel->setPosition(ccp(winSize.width * 0.5, winSize.height * 0.95)); this->addChild(stageSelectLabel); return true; }
void SGWelComeLayer::requestFinished(int msgid, CCObject *data) { CCLOG("收到数据"); switch (msgid) { case MSG_HTTP_FAST_LOGIN: { std::string serverip = CCUserDefault::sharedUserDefault()->getStringForKey("serverip"); short serverpost = (short)CCUserDefault::sharedUserDefault()->getIntegerForKey("serverpost"); //记录服务器ip和端口号 SGMainManager::shareMain()->setServerInfo(CCString::create(serverip.c_str()) , serverpost); //连接socket SGSocketClient::sharedSocketClient()->startConn(serverip.c_str() , serverpost); } break; case MSG_HTTP_LOGIN: { int isLogin = SGMainManager::shareMain()->getIsFBLogin(); if (isLogin != 1 || !SGMainManager::shareMain()->getIsFbAutologin()) { std::string serverip = CCUserDefault::sharedUserDefault()->getStringForKey("serverip"); int serverpost = CCUserDefault::sharedUserDefault()->getIntegerForKey("serverpost"); SGSocketClient::sharedSocketClient()->startConn(serverip.c_str() ,(short)serverpost); } else { SGMainManager::shareMain()->setIsFbAutologin(false); } } break; case MSg_HTTP_SERVERLIST: { SGServerListLayer *box = SGServerListLayer::create(this, (CCArray *)data, SGServerListLayerComeFromFirst); SGMainManager::shareMain()->showBox(box,false); } break; case MSG_HTTP_UPDATE_SERVER_STATE: { CCDictionary *dict = (CCDictionary*)data; CCString *serverIp = (CCString*)dict->objectForKey("serverIp"); CCString *serverPost = (CCString*)dict->objectForKey("serverPost"); CCString *serverId = (CCString*)dict->objectForKey("serverId"); CCString *serverShowId = (CCString*)dict->objectForKey("serverShowId"); CCString* serverName = (CCString*)dict->objectForKey("serverName"); //保存即将登陆的服务器的描述 serverDes = ((CCString * )dict->objectForKey("serverDes") )->m_sString; //save ip and post of server CCUserDefault::sharedUserDefault()->setIntegerForKey("serverid",serverId->intValue()); CCUserDefault::sharedUserDefault()->setIntegerForKey("serverShowId", serverShowId->intValue()); CCUserDefault::sharedUserDefault()->setStringForKey("serverip", serverIp->getCString()); CCUserDefault::sharedUserDefault()->setIntegerForKey("serverpost", serverPost->intValue()); CCUserDefault::sharedUserDefault()->setStringForKey("servername", serverName->getCString()); CCUserDefault::sharedUserDefault()->flush(); CCLog("最新服务器 ip=%s\n post=%s\n id=%s\n name=%s",serverIp->getCString(),serverPost->getCString(),serverId->getCString(),serverName->getCString()); changeServerbtn->setFont(serverName->getCString()); CCUserDefault::sharedUserDefault()->setStringForKey("servername", serverName->getCString()); //如果是维护中 则不再登陆。 short serverState = (short)( ( (CCString *)dict->objectForKey("serverState") )->intValue() ); if (1 != serverState) { ; } //提示不能登陆的详细信息。 else { SGMainManager::shareMain()->showMessage(serverDes.c_str()); } //MM: 即使维护中,也尝试登录,101用户会自动放过。 this->realLogin(); } break; case MSg_HTTP_LASTESTSERVER: { CCDictionary *dict = (CCDictionary*)data; CCString *serverIp = (CCString*)dict->objectForKey("serverIp"); CCString *serverPost = (CCString*)dict->objectForKey("serverPost"); CCString *serverId = (CCString*)dict->objectForKey("serverId"); CCString* serverName = (CCString*)dict->objectForKey("serverName"); //保存即将登陆的服务器的描述 serverDes = ((CCString * )dict->objectForKey("serverDes") )->m_sString; //save ip and post of server CCUserDefault::sharedUserDefault()->setIntegerForKey("serverid",serverId->intValue()); CCUserDefault::sharedUserDefault()->setStringForKey("serverip", serverIp->getCString()); CCUserDefault::sharedUserDefault()->setIntegerForKey("serverpost", serverPost->intValue()); CCUserDefault::sharedUserDefault()->setStringForKey("servername", serverName->getCString()); CCUserDefault::sharedUserDefault()->flush(); CCLog("最新服务器 ip=%s\n post=%s\n id=%s\n name=%s",serverIp->getCString(),serverPost->getCString(),serverId->getCString(),serverName->getCString()); changeServerbtn->setFont(serverName->getCString()); CCUserDefault::sharedUserDefault()->setStringForKey("servername", serverName->getCString()); } break; case MSG_HTTP_GET_CHANNEL_USER_ID: { CCDictionary* dict = (CCDictionary*) data; CCUserDefault* ccud = CCUserDefault::sharedUserDefault(); CCString* actId = (CCString*) dict->objectForKey("sdkAccountId"); ccud->setStringForKey("userId", actId->m_sString); ccud->setStringForKey("username", actId->m_sString); ccud->setStringForKey("password", actId->m_sString); ccud->setIntegerForKey("channelId", GlobalConfig::gi()->getRealChannelId()); #if (GCCT_CHINA_UC_ADR_THIRD == GAME_CHANNEL_TYPE) //uc adr //MM: 将本次s_sid作为loginkey,登入使用。 ccud->setStringForKey("loginKey", UCSdk::s_sid); #elif (GCCT_CHINA_KUAIYONG_IOS_THIRD == GAME_CHANNEL_TYPE) //MM: 将快用的tokenKey作为loginkey,登入使用。 ccud->setStringForKey("loginKey", ( (KuaiYongIosImp*) SdkController::gi()->getSdkImp() )->kyToken ); #else #endif CCString* nickName = (CCString*) dict->objectForKey("sdkNickName"); ccud->setStringForKey("sdk_user_nick_name", nickName->m_sString); //还有一个"sdkCreator"字段,但是未起作用,所以没有在这里添加。 registerBtn->setFont(nickName->getCString()); //将按钮文本变为其uc账号昵称。 ccud->setBoolForKey("isExist", true); ccud->setBoolForKey("isAccount", true); ccud->flush(); //MMD: SDKIF SDK登陆成功!仅当21号http消息完成后,才设置SDK登陆成功标志,其他情况一概无视。 ExtClassOfSDK::sharedSDKInstance()->setIsLoginSDK(true); //添加的针对非注册体系下的td数据设置,目前有uc在使用。 ExtClassOfSDK::sharedSDKInstance()->setTdData(actId->m_sString, nickName->m_sString); } break; default: break; } SGMainManager::shareMain()->getMainScene()->plat->removeConnection(); }
void Memory::save() { CCUserDefault * def = CCUserDefault::sharedUserDefault(); // Json::Value val(Json::ValueType::objectValue); // val["userId"] = _userId; // val["token"] = _token; // val["tokenExpireAt"] = _tokenExpireAt; // val["isNicknameSettingPrompted"] = _isNicknameSettingPrompted; // val["shouldShowCardDetail"] = _shouldShowCardDetail; // val["firstDailyLoginUse"] = _firstDailyLoginUse; // val["firstBlessingUse"] = _firstBlessingUse; // val["speedForBattle"] = _speedForBattle; // val["isAutoMove"] = _isAutoMove; // val["isFirstEnergyNotEnough"] = _isFirstEnergyNotEnough; // val["popUpSevenDayViewTime"] = _popUpSevenDayViewTime; // val["lastPopupEvents"] = _lastPopupEvents; // val["lastEventsHash"] = _lastEventsHash; // val["maxChatId"] = _maxChatId; // val["maxChatIdRead"] = _maxChatIdRead; // val["maxAppIdRead"] = _maxAppIdRead; // val["isDuelCountDown"] = _isDuelCountDown; // val["isFirstEnterPartnerView"] = _isFirstEnterPartnerView; // val["mountBattleStatus"] = _mountBattleStatus; // val["hasMountGuide"] = _hasMountGuide; // // Json::Value mopup(Json::ValueType::arrayValue); // // for (auto iter : _mopupStagesVec) // { // Json::Value valMop(Json::ValueType::objectValue); // valMop["c"] = iter.campaignId; // valMop["s"] = iter.stageIndx; // valMop["t"] = iter.type; // // mopup[mopup.size()] = valMop; // } // val["mopupStagesVec"] = mopup; // // Json::Value val2(Json::ValueType::arrayValue); // for (auto iter : _activitiesPassed) // { // Json::Value val3(Json::ValueType::objectValue); // val3["c"] = iter.campaignId; // val3["s"] = iter.stageId; // // val2[val2.size()] = val3; // } // val["activitiesPassed"] = val2; // // // Json::Value val3(Json::ValueType::arrayValue); // for (auto iter : _activitiesFirstOpenId) // { // Json::Value val4(Json::ValueType::objectValue); // val4["c"] = iter; // val3[val3.size()] = val4; // } // val["activitiesFirstOpenId"] = val3; // //save guild chat messages // saveGuildChatMessages(val); // // std::string strKey = SSTR("Memory_" << _lastServerId); // def->setStringForKey(strKey.c_str(), SSTR(val)); def->flush(); }
void Level::setCurrentLevel(int number) { CCUserDefault* db = CCUserDefault::sharedUserDefault(); db->setIntegerForKey(CURRENT_LEVEL_KEY, number); db->flush(); }
// Initialize our Main Menu Layer, and add the initial main menu with the title screen, play button and about button. bool GameOverLayer::init() { // Initialize the parent if (!CCLayer::init()) return false; // Load the high scores CCUserDefault *store = CCUserDefault::sharedUserDefault(); int bestScore = store->getIntegerForKey("best-score", 0); int bestDistance = store->getIntegerForKey("best-distance", 0); int bestDifficulty = store->getIntegerForKey("best-difficulty", 0); bool newRecord = false; if (GameManager::sharedGameManager()->getScore() > bestScore && GameManager::sharedGameManager()->getDistance() > bestDistance) { bestScore = GameManager::sharedGameManager()->getScore(); bestDistance = GameManager::sharedGameManager()->getDistance(); bestDifficulty = GameManager::sharedGameManager()->getDifficulty(); store->setIntegerForKey("best-score", bestScore); store->setIntegerForKey("best-distance", bestDistance); store->setIntegerForKey("best-difficulty", bestDifficulty); store->flush(); newRecord = true; } // Set the screen size to the full dimensions of the device (full screen) this->setContentSize(SCREEN_SIZE); float labelScaleText = 1.2f; if (GameManager::sharedGameManager()->getDeviceType() == kDeviceTypeAndroid854x480 || GameManager::sharedGameManager()->getDeviceType() == kDeviceTypeAndroid800x480 || GameManager::sharedGameManager()->getDeviceType() == kDeviceTypeAndroid800x400 || GameManager::sharedGameManager()->getDeviceType() == kDeviceTypeAndroid720x480) { labelScaleText = 0.9f; } else if (GameManager::sharedGameManager()->getDeviceSize() == kDeviceSizeNormal) { labelScaleText = 1.0f; } else if (GameManager::sharedGameManager()->getDeviceSize() == kDeviceSizeSmall) { labelScaleText = 0.5f; } CCSprite *gameOverTitle = CCSprite::createWithSpriteFrameName("game_over.png"); gameOverTitle->setScale(0.9f); gameOverTitle->setPosition(ccp(SCREEN_WIDTH/2, SCREEN_HEIGHT*0.8)); this->addChild(gameOverTitle); CCString *score = CCString::createWithFormat("YOUR SCORE: %i", GameManager::sharedGameManager()->getScore()); CCLabelBMFont *scoreLabel = CCLabelBMFont::create(score->getCString(), "myGlyphs.fnt"); scoreLabel->setScale(labelScaleText); scoreLabel->setPosition(ccp(SCREEN_WIDTH/2, SCREEN_HEIGHT*0.65)); this->addChild(scoreLabel); CCString *distance = CCString::createWithFormat("YOUR DISTANCE: %i", GameManager::sharedGameManager()->getDistance()); CCLabelBMFont *distanceLabel = CCLabelBMFont::create(distance->getCString(), "myGlyphs.fnt"); distanceLabel->setScale(labelScaleText); distanceLabel->setPosition(ccp(SCREEN_WIDTH/2, SCREEN_HEIGHT*0.59)); this->addChild(distanceLabel); CCString *ydifficulty; switch (GameManager::sharedGameManager()->getDifficulty()) { case 3: ydifficulty = CCString::create("HARD"); break; case 2: ydifficulty = CCString::create("MEDIUM"); break; default: ydifficulty = CCString::create("EASY"); } CCString *difficulty = CCString::createWithFormat("YOUR DIFFICULTY: %s", ydifficulty->getCString()); CCLabelBMFont *difficultyLabel = CCLabelBMFont::create(difficulty->getCString(), "myGlyphs.fnt"); difficultyLabel->setScale(labelScaleText); difficultyLabel->setPosition(ccp(SCREEN_WIDTH/2, SCREEN_HEIGHT*0.53)); this->addChild(difficultyLabel); CCString *highScore = CCString::createWithFormat("HIGH SCORE: %i", bestScore); CCLabelBMFont *highScoreLabel = CCLabelBMFont::create(highScore->getCString(), "myGlyphs.fnt"); highScoreLabel->setScale(labelScaleText); highScoreLabel->setPosition(ccp(SCREEN_WIDTH/2, SCREEN_HEIGHT*0.43)); this->addChild(highScoreLabel); CCString *highDistance = CCString::createWithFormat("BEST DISTANCE: %i", bestDistance); CCLabelBMFont *highDistanceLabel = CCLabelBMFont::create(highDistance->getCString(), "myGlyphs.fnt"); highDistanceLabel->setScale(labelScaleText); highDistanceLabel->setPosition(ccp(SCREEN_WIDTH/2, SCREEN_HEIGHT*0.37)); this->addChild(highDistanceLabel); CCString *bdifficulty; switch (bestDifficulty) { case 3: bdifficulty = CCString::create("HARD"); break; case 2: bdifficulty = CCString::create("MEDIUM"); break; default: bdifficulty = CCString::create("EASY"); } CCString *highDifficulty = CCString::createWithFormat("DIFFICULTY: %s", bdifficulty->getCString()); CCLabelBMFont *highDifficultyLabel = CCLabelBMFont::create(highDifficulty->getCString(), "myGlyphs.fnt"); highDifficultyLabel->setScale(labelScaleText); highDifficultyLabel->setPosition(ccp(SCREEN_WIDTH/2, SCREEN_HEIGHT*0.31)); this->addChild(highDifficultyLabel); // Play again button createPlayAgainButton(); // Play Game Over Sound CocosDenshion::SimpleAudioEngine::sharedEngine()->setEffectsVolume(1.0f); CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("sfx_gameover.mp3", false); // Do new record animation if (newRecord) { // TODO } // Initialization was successful return true; }