Exemplo n.º 1
0
void Config::load() {
	CCUserDefault* ud = CCUserDefault::sharedUserDefault();
	m_mute = ud->getBoolForKey(CONFIG_KEY_MUTE);
	m_hasSavedPuzzle = ud->getBoolForKey(CONFIG_KEY_HASSAVEDPUZZLE);
	m_highScore = ud->getIntegerForKey(CONFIG_KEY_HIGHSCORE);
	m_highLevel = ud->getIntegerForKey(CONFIG_KEY_HIGHLEVEL);
	if (m_hasSavedPuzzle) {
		m_savedScore = ud->getIntegerForKey(CONFIG_KEY_SAVEDSCORE);
		m_savedTarget = ud->getIntegerForKey(CONFIG_KEY_SAVEDTARGET);
		m_savedLevel = ud->getIntegerForKey(CONFIG_KEY_SAVEDLEVEL);
		m_savedRow = ud->getIntegerForKey(CONFIG_KEY_SAVEDROW);
		m_savedCol = ud->getIntegerForKey(CONFIG_KEY_SAVEDCOL);
		m_savedPuzzle = ud->getStringForKey(CONFIG_KEY_SAVEDPUZZLE);
	}
}
Exemplo n.º 2
0
void LocalData::readLocalDataToRunTime()
{

	CCUserDefault* userDefault = CCUserDefault::sharedUserDefault();
	RunTimeData::getInstance()->hasMusic = userDefault->getBoolForKey("hasmusic", true);
	std::string levelStr = userDefault->getStringForKey("levelStarStr", "");
	RunTimeData::getInstance()->passedLevel = userDefault->getIntegerForKey("passedLevelNum", 1);
	RunTimeData::getInstance()->startNum = userDefault->getIntegerForKey("totalStarNum", 0);
	RunTimeData::getInstance()->annihilatorNum = userDefault->getIntegerForKey("annihilator", 0);
	RunTimeData::getInstance()->isFirstTime = userDefault->getBoolForKey("isFirstTime", true);
	if (levelStr.length() != 0){
		strcpy(RunTimeData::getInstance()->levelStars, levelStr.c_str());
	}
	RunTimeData::getInstance()->isFirstTime = userDefault->getBoolForKey("guiderecord", true);
}
Exemplo n.º 3
0
bool LevelScene::init()
{
    SkyLayer *pSkyLayer = SkyLayer::create();
    addChild(pSkyLayer);
    
    createLevelsLayer();
    
    CCTexture2D *pTexture = CCTextureCache::sharedTextureCache()->addImage("back.png");
    SpriteButton *pBackButton = SpriteButton::create(pTexture, this, callfuncO_selector(LevelScene::backClicked));
    CCPoint bottomLeft = VisibleRect::leftBottom();
    pBackButton->setPosition(ccp(bottomLeft.x + 70, bottomLeft.y + 60));
    addChild(pBackButton);
    
    //Read preferences
    CCUserDefault *pUserDefaults = CCUserDefault::sharedUserDefault();
    
    float volume = pUserDefaults->getFloatForKey("volume");
    bool sound = pUserDefaults->getBoolForKey("sound");
    
    if (sound) {
        bool isPlaying = SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying();
        
        if (!isPlaying)
            SimpleAudioEngine::sharedEngine()->playBackgroundMusic("sounds/music.wav", true);
        
        SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(volume);
        SimpleAudioEngine::sharedEngine()->setEffectsVolume(volume);
    }
    
    return true;
}
Exemplo n.º 4
0
void MainScene::OnSceneChangedToAppear()
{

    // Audio Setting
    GooRoomClient& client = GooRoomClient::Instance();
    CCUserDefault* userDefault = CCUserDefault::sharedUserDefault();
    client.SetBGMOn(userDefault->getBoolForKey("IsBGMOn", true));
    client.SetEffectOn(userDefault->getBoolForKey("IsEffectOn", true));
    client.SetMessageOn(userDefault->getBoolForKey("IsMessageOn", true));

    const float bgmVolume = GooRoomClient::Instance().IsBGMOn() ? BGM_SOUND_NORMAL : 0.f;
    AudioEngine::Instance()->SetBackgroundVolume(bgmVolume);
    const float effectVolume = GooRoomClient::Instance().IsEffectOn() ? 0.9f : 0.f;
    AudioEngine::Instance()->SetEffectVolume(effectVolume);
    // End Autio Setting

    AudioEngine::Instance()->PlayBackgroundMusic("bgm/mainScene.mp3");
}
Exemplo n.º 5
0
GameConfig* GameConfig::shared()
{
    static GameConfig* config = NULL;
    if(config == NULL)
    {
        config = new GameConfig();

        CCUserDefault* user = CCUserDefault::sharedUserDefault();
        config->tutorialMode = (TutorialProgress)user->getIntegerForKey(CONFIG_TUTORIAL_PROGRESS, TutorialSkip);
        config->mEnableSFX = user->getBoolForKey(CONFIG_SFX_KEY, true);
        config->mEnableBGM = user->getBoolForKey(CONFIG_BGM_KEY, true);
        config->mEnableAndroidHD = user->getBoolForKey(CONFIG_ANDROID_HD_KEY, false);

        config->stageTab = -1;
        config->stageId = -1;

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
        config->useTouchSmooth = true;
#else
        config->useTouchSmooth = false;
#endif
    }
    return config;
}
Exemplo n.º 6
0
bool MenuScene::init()
{
    SkyLayer *pSkyLayer = SkyLayer::create();
    addChild(pSkyLayer);
    
    CCRect visibleRect = VisibleRect::getVisibleRect();
    
    CCSprite *pLogo = CCSprite::create("logo.png");
    pLogo->setPosition(VisibleRect::center());
    addChild(pLogo);
    
    CCTexture2D *pTexture = CCTextureCache::sharedTextureCache()->addImage("play.png");
    pPlayButton = SpriteButton::create(pTexture, this, callfuncO_selector(MenuScene::playClicked));
    pPlayButton->setPosition(ccp(477, 185));
    addChild(pPlayButton);
    
    pTexture = CCTextureCache::sharedTextureCache()->addImage("about.png");
    pInfoButton = SpriteButton::create(pTexture, this, callfuncO_selector(MenuScene::infoClicked));
    pInfoButton->setPosition(ccp(visibleRect.origin.x + 205, visibleRect.origin.y + 60));
    addChild(pInfoButton);
    
    pTexture = CCTextureCache::sharedTextureCache()->addImage("settings.png");
    pSettingsButton = SpriteButton::create(pTexture, this, callfuncO_selector(MenuScene::settingsClicked));
    pSettingsButton->setPosition(ccp(visibleRect.origin.x + 110, visibleRect.origin.y + 60));
    addChild(pSettingsButton);
    
    //Read preferences
    CCUserDefault *pUserDefaults = CCUserDefault::sharedUserDefault();
    
    float volume = pUserDefaults->getFloatForKey("volume");
    bool sound = pUserDefaults->getBoolForKey("sound");
        
    if (sound) {
        bool isPlaying = SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying();
        
        if (!isPlaying)
            SimpleAudioEngine::sharedEngine()->playBackgroundMusic("sounds/music.wav", true);
        
        SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(volume);
        SimpleAudioEngine::sharedEngine()->setEffectsVolume(volume);
    }
   
    return true;
}
Exemplo n.º 7
0
void GameConfig::load()
{
    std::string playerUID = PlayerData::getInstance()->player->uid;

    CCUserDefault* user = CCUserDefault::sharedUserDefault();

    showInstanceStage = user->getBoolForKey((playerUID + "_instance_stage").c_str(),
                                            false);
    showSoulExchange = user->getBoolForKey((playerUID + "_soul_exchange").c_str(),
                                           false);
    showShuffleRelation = user->getBoolForKey((playerUID + "_shuffle_relation").c_str(), false);
    firstTimeNeili = user->getBoolForKey((playerUID + "_first_time_neili").c_str(), true);
    firstTimeShowInstance = user->getBoolForKey((playerUID + "_first_time_instance").c_str(), true);
    firstTimeZhuansheng = user->getBoolForKey((playerUID + "_first_time_zhuansheng").c_str(), true);

    openInstanceStep = user->getIntegerForKey((playerUID + "_open_instance").c_str(), 0);
    openJueDing10 = user->getBoolForKey((playerUID + "_open_jueding10").c_str(), false);

    showDragHint = user->getBoolForKey((playerUID + "_show_drag_hint").c_str(), true);
    showAttrHint = user->getBoolForKey((playerUID + "_show_attr_hint").c_str(), true);
}
Exemplo n.º 8
0
bool GameData::load()
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    CCUserDefault* read = CCUserDefault::sharedUserDefault();
    _isExisted = read->getBoolForKey("IsExisted");
    if (!_isExisted) {
        return false;
    }
    _highScore = read->getIntegerForKey("HighScore");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    _isExisted = JNI_getBool("IsExisted", false);
	if (!_isExisted) {
		return false;
	}
    _highScore = JNI_getInt("HighScore", 0);
#endif
    
    return true;
}
Exemplo n.º 9
0
bool GameData::load()
{
    
#if (ANDROIDSAVEBYUSERDEFAULT == 1 && CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    gd_isBeginner = JNI_getBool("IsBeginner", true);
	if (gd_isBeginner) {
		return false;
	}
    gd_highScore = JNI_getInt("HighScore", 0);
    gd_gold = JNI_getInt("Gold", 0);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    CCUserDefault* read = CCUserDefault::sharedUserDefault();
    gd_isBeginner = read->getBoolForKey("IsBeginner", true);
    if (gd_isBeginner) {
        return false;
    }
    gd_highScore = read->getIntegerForKey("HighScore", 0);
    gd_gold = read->getIntegerForKey("Gold", 0);
#endif
    
    return true;
}
Exemplo n.º 10
0
bool TitleScene::init()
{
    
    //debug
    this->debugBoot = false;
    
    // 初期化色を変更
    if (!CCLayerColor::initWithColor(ccc4(0xFF,0xEF,0xFF,0xFF))) //RGBA
    {
        return false;
    }
    
    //GameCenterにログイン
    Cocos2dExt::NativeCodeLauncher::loginGameCenter();
    
    //一回もクリアしたことなければチュートリアル表示
     CCUserDefault*  userDefault = CCUserDefault::sharedUserDefault();
    string tutorialKey = ConstCommon::getTutorialKey();
    this->firstTimeGame = ! userDefault->getBoolForKey(tutorialKey.c_str());

    
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    
    CCSprite* pA = CCSprite::create("logo_A.png");
    float originSize = ((size.width * 0.937) / 6) / pA->getContentSize().width;
    
    pA->setPosition(ccp(size.width * 0.1, size.height * 0.8));
    //pA->setScale(0.6);
    pA->setScale(originSize);
    pA->runAction(Animation::titleCharaAction(originSize));
    this->addChild(pA);
    
    CCSprite* pR = CCSprite::create("logo_R.png");
    pR->setPosition(ccp(size.width * 0.26, size.height * 0.8));
    //pR->setScale(0.6);
    pR->setScale(originSize);
    pR->runAction(CCSequence::create(CCDelayTime::create(0.05),Animation::titleCharaAction(originSize),NULL));
    this->addChild(pR);
    
    CCSprite* pR2 = CCSprite::create("logo_R.png");
    pR2->setPosition(ccp(size.width * 0.42, size.height * 0.8));
    //pR2->setScale(0.6);
    pR2->setScale(originSize);
    pR2->runAction(CCSequence::create(CCDelayTime::create(0.1),Animation::titleCharaAction(originSize),NULL));
    this->addChild(pR2);
    
    CCSprite* pO = CCSprite::create("logo_O.png");
    pO->setPosition(ccp(size.width * 0.58, size.height * 0.8));
    //pO->setScale(0.6);
    pO->setScale(originSize);
    pO->runAction(CCSequence::create(CCDelayTime::create(0.15),Animation::titleCharaAction(originSize),NULL));
    this->addChild(pO);
    
    CCSprite* pW = CCSprite::create("logo_W.png");
    pW->setPosition(ccp(size.width * 0.74, size.height * 0.8));
    //pW->setScale(0.6);
    pW->setScale(originSize);
    pW->runAction(CCSequence::create(CCDelayTime::create(0.2),Animation::titleCharaAction(originSize),NULL));
    this->addChild(pW);
    
    CCSprite* pS = CCSprite::create("logo_S.png");
    pS->setPosition(ccp(size.width * 0.9, size.height * 0.8));
    //pS->setScale(0.6);
    pS->setScale(originSize);
    pS->runAction(CCSequence::create(CCDelayTime::create(0.25),Animation::titleCharaAction(originSize),NULL));
    this->addChild(pS);


    
    
    
    //start button
    CCMenuItemImage* pStartItem;
    pStartItem = CCMenuItemImage::create("button1.png", "button1.png",this,menu_selector(TitleScene::menuStartCallback));
    pStartItem->setPosition(ccp(size.width * 0.5, size.height * 0.3));
    pStartItem->setScale((size.width * 0.4) / pStartItem->getContentSize().width);
    
    CCLabelTTF* startLabel;
    startLabel = CCLabelTTF::create("PLAY", "Arial", 30.0);
    
    CCSize pStartItemSize = pStartItem->getContentSize();
    startLabel->setPosition(ccp(pStartItemSize.width / 2 ,pStartItemSize.height / 2));
    pStartItem->addChild(startLabel);


    
    CCMenu* pMenu = CCMenu::create(pStartItem,NULL);
    pMenu->setPosition(CCPointZero);
    this->addChild(pMenu);
    
    
    if(! this->firstTimeGame){
        //チュートリアルを再度受けられるようにボタン生成
        //start button
        CCMenuItemImage* pTutorItem;
        pTutorItem = CCMenuItemImage::create("button2.png", "button2.png",this,menu_selector(TitleScene::menuTutorCallback));
        pTutorItem->setPosition(ccp(size.width * 0.5, size.height * 0.4));
        pTutorItem->setScale((size.width * 0.4) / pTutorItem->getContentSize().width);
        
        CCLabelTTF* tutorLabel;
        tutorLabel = CCLabelTTF::create("TUTORIAL", "Arial", 30.0);
        
        CCSize pTutorItemSize = pTutorItem->getContentSize();
        tutorLabel->setPosition(ccp(pTutorItemSize.width / 2 ,pTutorItemSize.height / 2));
        pTutorItem->addChild(tutorLabel);
        pMenu->addChild(pTutorItem);
        
        //ランキングのボタン生成
        if(CC_TARGET_PLATFORM == CC_PLATFORM_IOS){
            CCMenuItemImage* pRankingItem;
            pRankingItem = CCMenuItemImage::create("button3.png", "button3.png",this,menu_selector(TitleScene::menuRankingCallback));
            pRankingItem->setPosition(ccp(size.width * 0.5, size.height * 0.5));
            pRankingItem->setScale((size.width * 0.4) / pRankingItem->getContentSize().width);
            
            CCLabelTTF* rankingLabel;
            rankingLabel = CCLabelTTF::create("ACHIVEMENT", "Arial", 30.0);
            
            CCSize pRankingItemSize = pRankingItem->getContentSize();
            rankingLabel->setPosition(ccp(pRankingItemSize.width / 2 ,pRankingItemSize.height / 2));
            pRankingItem->addChild(rankingLabel);
            pMenu->addChild(pRankingItem);

        }

    }
    
    //debug
    if(this->debugBoot){
        CCMenuItemImage* pDebugBootItem;
        pDebugBootItem = CCMenuItemImage::create("button3.png", "button3.png",this,menu_selector(TitleScene::menuDebugBootCallback));
        pDebugBootItem->setPosition(ccp(size.width * 0.5, size.height * 0.2));
        pDebugBootItem->setScale((size.width * 0.4) / pDebugBootItem->getContentSize().width);
        
        CCLabelTTF* debugBootLabel;
        debugBootLabel = CCLabelTTF::create("DEBUG BOOT", "Arial", 30.0);
        
        debugBootLabel->setPosition(ccp(pDebugBootItem->getContentSize().width / 2 ,pDebugBootItem->getContentSize().height / 2));
        pDebugBootItem->addChild(debugBootLabel);
        pMenu->addChild(pDebugBootItem);

    }
    
    return true;
    
}
Exemplo n.º 11
0
void SGWelComeLayer::loginstart()
{
    isstart= false;
    
    testSomething(); //MM: 保留
    
    //发送进入欢迎界面的消息 add by:zyc.
    SGMainManager::sendOperatorRecord(100010);
    
//    ((SGButton *)this->getChildByTag(1))->stopAllActions();
//    this->removeChildByTag(1, true);
    CCSize s = CCDirector::sharedDirector()->getWinSize();
    CCLayerColor *layer = CCLayerColor::create(ccc4(0, 0, 0, 50));
    this->addChild(layer, -1);

    std::string sbPng = "";
    
    if ( GAME_ACCOUNT_TYPE == GCAT_XDYOU ) //MM: xdyou支持快速登入功能。
    {
        if (GameConfig::isExist())
        {
            sbPng = "login_ksksbtn.png";
        }
        else
        {
            sbPng = "login_ksksOncebtn.png";
        }
    }
    else if ( GAME_ACCOUNT_TYPE == GCAT_GO2PLAY ) //MM: go2play的快速登陆比较坑爹,需要单独标志位标记。//cgp come here
    {
        CCUserDefault* ccud = CCUserDefault::sharedUserDefault();
        bool isFast = ccud->getBoolForKey("isFastLogin");
        if (GameConfig::isExist())
        {
            if (isFast)
            {
                sbPng = "login_ksksOncebtn.png";
            }
            else
            {
                sbPng = "login_ksksbtn.png";
            }
        }
        else
        {
            sbPng = "login_ksksOncebtn.png";
        }
    }
    else //MM: 非xdyou和go2play的账号体系,不管是否有过登陆历史,一概无视,重新登陆,即图片为“进入游戏”,而不是“快速开始”。
    {
        sbPng = "login_ksksbtn.png";
    }
    startBtn = SGButton::create(sbPng.c_str(), NULL, this, menu_selector(SGWelComeLayer::fastStartHandler),CCPointZero,false,true);
    
    this->addBtn(startBtn);
    
    startBtn->setScale(0.8);
    canStart = true;
    
	//不同渠道显示不同文本。
	CCString *no = NULL;
	if ( (GAME_ACCOUNT_TYPE == GCAT_XDYOU) || (GAME_ACCOUNT_TYPE == GCAT_GO2PLAY) )
	{
		no = CCString::create(str_WdelcomeLayer_str1);
	}
	else
	{
		no = CCString::create(str_WdelcomeLayer_str2);
	}
    
    SGCCLabelTTF *notice = SGCCLabelTTF::create(no->getCString(), FONT_BOXINFO,FONTSIZE(13));
    this->addChild(notice,100);
    
    CCSprite *noticeBg = CCSprite::createWithSpriteFrameName("loginMsgbg.png");
    this->addChild(noticeBg,90);
    noticeBg->setScale(0.8);
    
    changeServerbtn = SGButton::createFromLocal("loginbtnText.png", "", this, menu_selector(SGWelComeLayer::changeIDHandler), CCPointZero, FONT_BOXINFO, ccWHITE, 26, false, true);
    changeServerbtn->setFontColor(ccWHITE);
    changeServerbtn->setScale(0.8);
    this->addBtn(changeServerbtn);
    
    //帐号注册
	if (GAME_ACCOUNT_TYPE == GCAT_XDYOU)
	{
		registerBtn = SGButton::createFromLocal("loginbtnText.png",
												" ",
												this,
												menu_selector(SGWelComeLayer::registerHandler), CCPointZero, FONT_BOXINFO, ccWHITE, 26, false, true);
	}
	//如果渠道SDK不是朋游,帐号部分不可见
	else if (GAME_ACCOUNT_TYPE == GCAT_TONGBUTUI)
	{
		//registerBtn->setVisible(false);
		registerBtn = SGButton::createFromLocal("loginbtnText.png", str_WdelcomeLayer_str3, this, menu_selector(SGWelComeLayer::exchangeHandler), CCPointZero, FONT_BOXINFO, ccWHITE, 26, false, true);
	}
    else if   (GAME_ACCOUNT_TYPE == GCAT_PP)//下边部分使用registerBtn太多,暂时初始化,设为不可见
	{
        
		registerBtn = SGButton::createFromLocal("loginbtnText.png", str_WdelcomeLayer_str3, this, menu_selector(SGWelComeLayer::exchangeHandler), CCPointZero, FONT_BOXINFO, ccWHITE, 26, false, true);
	}
    else
    {//cgp come
		registerBtn = SGButton::createFromLocal("loginbtnText.png",
												" ",
												this,
												menu_selector(SGWelComeLayer::registerHandler), CCPointZero, FONT_BOXINFO, ccRED, 26, false, true);
    }
    registerBtn->setScale(0.8);
    
	//如果渠道
    bool isAccount = CCUserDefault::sharedUserDefault()->getBoolForKey("isAccount");
    if (GameConfig::isExist())  //cgp come here
    {
        std::string str = CCUserDefault::sharedUserDefault()->getStringForKey("servername");
        changeServerbtn->setFont(str.c_str());
        
        if (isAccount)
        {
            std::string un = CCUserDefault::sharedUserDefault()->getStringForKey("username");
            
            if (un.size() > NMAELIMIT) {
                un = un.substr(0,NMAELIMIT-3);
                un.append("...");
            }
			if (GAME_ACCOUNT_TYPE == GCAT_XDYOU)
			{
                if (strcmp(un.c_str(), "") == 0 )
                {
                    registerBtn->setFont(str_ServerItem_str17);
                }
                else
                {
                    bool savedFbState = CCUserDefault::sharedUserDefault()->getBoolForKey("XdFBLoginState");
                    if (savedFbState)
                    {
                        //已用facebook登入
                        registerBtn->setFont(str_ServerItem_str17);
                    }
                    else
                    {
                        //只有不是facebook登陆的账号,才显示。
                        if (un.find("XD_THIRDPAR") == std::string::npos)
                        {
                            registerBtn->setFont(un.c_str());
                        }
                    }
                }
				
			}
			else if (GAME_ACCOUNT_TYPE == GCAT_TONGBUTUI)
			{
				registerBtn->setFont(str_WdelcomeLayer_str3);
			}
            
            
        }
        else
        {
			//如果是兄弟游戏
			if (GAME_ACCOUNT_TYPE == GCAT_XDYOU)
			{
				registerBtn->setFont(str_WdelcomeLayer_str4);
			}
            
            guestBidBtn = SGButton::create("binding_account.png",
                                           NULL,
                                           this,
                                           menu_selector(SGWelComeLayer::bindGuestHandler), CCPointZero,false, true);
			
			//如果是渠道SDK, 不显示绑定
			if (GAME_ACCOUNT_TYPE == GCAT_XDYOU)
			{
				guestBidBtn->setVisible(false);
			}
			
            this->addBtn(guestBidBtn);
        }
    }
    else
    {
		if (GAME_ACCOUNT_TYPE == GCAT_XDYOU)
		{
			registerBtn->setFont(str_WdelcomeLayer_str5);
		}
        //获取最新服务器
        SGHttpClient::shareHttpClient()->getlastestServer(this);
    }
    this->addBtn(registerBtn);
    
    //MMD: SDKIF 截断处理,只要不是XDYOU账号体系,一概显示为“点击登入”。
    if (GAME_ACCOUNT_TYPE != GCAT_XDYOU)
    {
        //有时候会被提掉线,但是SDK账号还登录着的,所以必须让其显示正确的username。
        if (ExtClassOfSDK::sharedSDKInstance()->isLoginSDK())
        {
#if (GCCT_CHINA_UC_ADR_THIRD == GAME_CHANNEL_TYPE || GAME_CHANNEL_TYPE == GCCT_CHINA_KUAIYONG_IOS_THIRD) //uc和快用特殊,如果可能,显示nickname。
            registerBtn->setFont(CCUserDefault::sharedUserDefault()->getStringForKey("sdk_user_nick_name", "sanguo user").c_str());
#else
            registerBtn->setFont(CCUserDefault::sharedUserDefault()->getStringForKey("username", "sdk_user").c_str());
#endif
        }
        else
        {
#if (GCCT_CHINA_UC_ADR_THIRD == GAME_CHANNEL_TYPE || GAME_CHANNEL_TYPE == GCCT_CHINA_KUAIYONG_IOS_THIRD) //uc和快用特殊,只显示点击登入,由自动逻辑登入。
            registerBtn->setFont(str_ServerItem_str17);
#else
            if (GameConfig::isExist())  //cgp come here
            {
                registerBtn->setFont(CCUserDefault::sharedUserDefault()->getStringForKey("username", "sdk_user").c_str());
            }
            else
            {
                registerBtn->setFont(str_ServerItem_str17);
            }
#endif
        }
    }
    
    registerBtn->setFontColor(ccWHITE);
    
    const int nSpace = 15;
    if (s.height == 960)
    {
        registerBtn->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 379-nSpace-nSpace)));
        changeServerbtn->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 285-1-nSpace)));
        startBtn->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 180.5-1)));
        notice->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 90)));
    }
    else //if(s.height == 1136)
    {
//        registerBtn->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 380+100-nSpace-nSpace)));
//        changeServerbtn->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 285+100-nSpace)));
//        startBtn->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 180.5+100)));
//        notice->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 90+100)));
#define cgpLoginSpace -50
        registerBtn->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 300 + cgpLoginSpace-nSpace-nSpace)));
        changeServerbtn->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 240 + cgpLoginSpace-nSpace)));
        startBtn->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 150 + cgpLoginSpace)));
        notice->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 60 + cgpLoginSpace)));
        registerBtn->setScale(0.8);
        changeServerbtn->setScale(0.8);
        startBtn->setScale(0.6);
        notice->setScale(1.0);
        
        
    }
//    else
//    {
//        registerBtn->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 380 +39.2-nSpace-nSpace)));
//        //fermEffect->setPosition(ccp(s.width/2, 145+40));
//        changeServerbtn->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 285+39-nSpace)));
//        startBtn->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 180.5+40)));
//        notice->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, 90+40)));
//    }
    
    if (noticeBg)
    {
        noticeBg->setPosition(notice->getPosition());
        notice->setVisible(false);
        noticeBg->setVisible(false);
    }
    if (guestBidBtn != NULL) {
        guestBidBtn->setPosition(ccp(registerBtn->getPositionX() - registerBtn->getContentSize().width/2 -36 ,
                                     registerBtn->getPositionY() + guestBidBtn->getContentSize().height / 16));
        guestBidBtn->runAction(CCRepeatForever::create(CCSequence::create(CCScaleTo::create(0.6,0.8),CCScaleTo::create(0.6,1.0),NULL)));
    }
    
#if (FACEBOOK_OPEN_STATUS == FACEBOOK_ON)
    
    facebookBt = SGButton::create("sharefacebook-3.png",
                                         NULL,
                                         this,
                                         menu_selector(SGWelComeLayer::startFacebookLogin),
                                         ccp(0, 0),
                                         false,
                                         true);
    
    facebookBt->setPosition(ccp(registerBtn->getPositionX() + registerBtn->getContentSize().width/2 + facebookBt->getContentSize().width/2 , registerBtn->getPositionY() + facebookBt->getContentSize().height / 8));
    this->addBtn(facebookBt);
    facebookBt->setScale(0.8);
    
    facebookLogOut = SGButton::createFromLocal("zhuxiaoFB.png", "", this, menu_selector(SGWelComeLayer::logOutFB), ccp(-45,0), FONT_BOXINFO, ccWHITE, 26, false, true);
    
    facebookLogOut->setPosition(registerBtn->getPosition());
    this->addBtn(facebookLogOut);
    facebookLogOut->setVisible(false);
#if (GAME_ACCOUNT_TYPE == GCAT_XDYOU)
    updateViewForFB();
#elif (GAME_ACCOUNT_TYPE == GCAT_GO2PLAY)
    CCUserDefault* ccud = CCUserDefault::sharedUserDefault();
    bool shallFastFb = ccud->getBoolForKey("isSdkFBLogin", false);
    if (shallFastFb)
    {
        UserAndExtInfo uei;
        SdkController::gi()->getSdkImp()->sdkFBLogin(uei);
    }
#endif
#endif
    
    //针对uc渠道的特殊处理,启动完成后,直接试图登陆账号。
#if (GCCT_CHINA_UC_ADR_THIRD == GAME_CHANNEL_TYPE)
    if (GameConfig::isExist())
    {
        if (!UCSdk::s_logined)
        {
            ExtClassOfSDK::sharedSDKInstance()->channelRegister();
        }
    }
#endif
}
Exemplo n.º 12
0
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;
    
}