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


C++ CCUserDefault::flush方法代码示例

本文整理汇总了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();
}
开发者ID:Geminichel,项目名称:ph-open,代码行数:7,代码来源:Common.cpp

示例2: setBGMEnabled

void GameConfig::setBGMEnabled(bool val)
{
    mEnableBGM = val;
    CCUserDefault* user = CCUserDefault::sharedUserDefault();
    user->setBoolForKey(CONFIG_BGM_KEY, mEnableBGM);
    user->flush();
}
开发者ID:Geminichel,项目名称:ph-open,代码行数:7,代码来源:Common.cpp

示例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();
}
开发者ID:Geminichel,项目名称:ph-open,代码行数:27,代码来源:Common.cpp

示例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);
    }
}
开发者ID:mrktj,项目名称:SlotGame,代码行数:31,代码来源:LoginLayer.cpp

示例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();
    
}
开发者ID:k-tetsuhiro,项目名称:app02,代码行数:34,代码来源:MainGameScene.cpp

示例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();
}
开发者ID:xu561865,项目名称:demo_2,代码行数:28,代码来源:Memory.cpp

示例7: setAndroidHDEnabled

void GameConfig::setAndroidHDEnabled(bool val)
{
    mEnableAndroidHD = val;
    CCUserDefault* user = CCUserDefault::sharedUserDefault();
    user->setBoolForKey(CONFIG_ANDROID_HD_KEY, mEnableAndroidHD);
    user->flush();
}
开发者ID:Geminichel,项目名称:ph-open,代码行数:7,代码来源:Common.cpp

示例8: setSFXEnabled

void GameConfig::setSFXEnabled(bool val)
{
    mEnableSFX = val;
    CCUserDefault* user = CCUserDefault::sharedUserDefault();
    user->setBoolForKey(CONFIG_SFX_KEY, mEnableSFX);
    user->flush();
}
开发者ID:Geminichel,项目名称:ph-open,代码行数:7,代码来源:Common.cpp

示例9:

KDvoid Ch3_SavingSimpleData::saveDifficulty ( KDvoid )
{
	// Save our difficulty
	CCUserDefault*		pDefaults = CCUserDefault::sharedUserDefault ( );

	pDefaults->setStringForKey ( "simple_data_difficulty", m_sDifficulty.c_str ( ) );
	pDefaults->flush ( );
}
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:8,代码来源:Ch3_SavingSimpleData.cpp

示例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
}
开发者ID:Michael-Z,项目名称:MyFlappyBird-1,代码行数:12,代码来源:GameData.cpp

示例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();
}
开发者ID:BoenYang,项目名称:GameProject,代码行数:12,代码来源:LocalData.cpp

示例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();
}
开发者ID:Asheng321,项目名称:PopStar,代码行数:14,代码来源:Config.cpp

示例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
    
}
开发者ID:Michael-Z,项目名称:MyBird,代码行数:16,代码来源:GameData.cpp

示例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);
    }
    
}
开发者ID:Yarimizu14,项目名称:nyan25,代码行数:42,代码来源:GameScene.cpp

示例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;
    
}
开发者ID:k-tetsuhiro,项目名称:app02,代码行数:64,代码来源:LevelSelectScene.cpp


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