本文整理汇总了C++中CCUserDefault::flush方法的典型用法代码示例。如果您正苦于以下问题:C++ CCUserDefault::flush方法的具体用法?C++ CCUserDefault::flush怎么用?C++ CCUserDefault::flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCUserDefault
的用法示例。
在下文中一共展示了CCUserDefault::flush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTutorialProgress
void GameConfig::setTutorialProgress(PH::TutorialProgress progress)
{
tutorialMode = progress;
CCUserDefault* user = CCUserDefault::sharedUserDefault();
user->setIntegerForKey(CONFIG_TUTORIAL_PROGRESS, tutorialMode);
user->flush();
}
示例2: setBGMEnabled
void GameConfig::setBGMEnabled(bool val)
{
mEnableBGM = val;
CCUserDefault* user = CCUserDefault::sharedUserDefault();
user->setBoolForKey(CONFIG_BGM_KEY, mEnableBGM);
user->flush();
}
示例3: save
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();
}
示例4: onClickedLogin
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);
}
}
示例5: endJudgemnet
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();
}
示例6: saveBasic
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();
}
示例7: setAndroidHDEnabled
void GameConfig::setAndroidHDEnabled(bool val)
{
mEnableAndroidHD = val;
CCUserDefault* user = CCUserDefault::sharedUserDefault();
user->setBoolForKey(CONFIG_ANDROID_HD_KEY, mEnableAndroidHD);
user->flush();
}
示例8: setSFXEnabled
void GameConfig::setSFXEnabled(bool val)
{
mEnableSFX = val;
CCUserDefault* user = CCUserDefault::sharedUserDefault();
user->setBoolForKey(CONFIG_SFX_KEY, mEnableSFX);
user->flush();
}
示例9:
KDvoid Ch3_SavingSimpleData::saveDifficulty ( KDvoid )
{
// Save our difficulty
CCUserDefault* pDefaults = CCUserDefault::sharedUserDefault ( );
pDefaults->setStringForKey ( "simple_data_difficulty", m_sDifficulty.c_str ( ) );
pDefaults->flush ( );
}
示例10: saveSettings
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
}
示例11: writeRuntimeDataToLocal
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();
}
示例12: 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();
}
示例13: saveSettings
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
}
示例14: showHighScoreLabel
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);
}
}
示例15: initWithPage
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;
}