Пример #1
0
MenuItemToggle * MenuItemToggle::createWithCallback(const ccMenuCallback &callback, const Vector<MenuItem*>& menuItems)
{
    MenuItemToggle *ret = new (std::nothrow) MenuItemToggle();
    ret->MenuItem::initWithCallback(callback);
    ret->_subItems = menuItems;
    ret->_selectedIndex = UINT_MAX;
    ret->setSelectedIndex(0);
    return ret;
}
Пример #2
0
// XXX: deprecated
MenuItemToggle * MenuItemToggle::createWithTarget(Ref* target, SEL_MenuHandler selector, const Vector<MenuItem*>& menuItems)
{
    MenuItemToggle *ret = new (std::nothrow) MenuItemToggle();
    ret->MenuItem::initWithTarget(target, selector);
    ret->_subItems = menuItems;
    ret->_selectedIndex = UINT_MAX;
    ret->setSelectedIndex(0);
    return ret;
}
Пример #3
0
MenuItemToggle * MenuItemToggle::createWithCallback(const ccMenuCallback &callback, Array* menuItems)
{
    MenuItemToggle *pRet = new MenuItemToggle();
    pRet->MenuItem::initWithCallback(callback);
    pRet->_subItems = Array::create();
    pRet->_subItems->retain();

    for (unsigned int z=0; z < menuItems->count(); z++)
    {
        MenuItem* menuItem = (MenuItem*)menuItems->objectAtIndex(z);
        pRet->_subItems->addObject(menuItem);
    }

    pRet->_selectedIndex = UINT_MAX;
    pRet->setSelectedIndex(0);
    return pRet;
}
Пример #4
0
// XXX: deprecated
MenuItemToggle * MenuItemToggle::createWithTarget(Object* target, SEL_MenuHandler selector, Array* menuItems)
{
    MenuItemToggle *pRet = new MenuItemToggle();
    pRet->MenuItem::initWithTarget(target, selector);
    pRet->_subItems = Array::create();
    pRet->_subItems->retain();
    
    for (unsigned int z=0; z < menuItems->count(); z++)
    {
        MenuItem* menuItem = (MenuItem*)menuItems->objectAtIndex(z);
        pRet->_subItems->addObject(menuItem);
    }
    
    pRet->_selectedIndex = UINT_MAX;
    pRet->setSelectedIndex(0);
    return pRet;
}
Пример #5
0
MenuItemToggle * MenuItemToggle::createWithCallback(const ccMenuCallback &callback, const Vector<MenuItem*>& menuItems)
{
    MenuItemToggle *ret = new (std::nothrow) MenuItemToggle();
    ret->MenuItem::initWithCallback(callback);
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
    auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
    if (sEngine)
    {
        for (const auto &item : menuItems)
        {
            if (item)
            {
                sEngine->retainScriptObject(ret, item);
            }
        }
    }
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
    ret->_subItems = menuItems;
    ret->_selectedIndex = UINT_MAX;
    ret->setSelectedIndex(0);
    return ret;
}
Пример #6
0
// FIXME:: deprecated
MenuItemToggle * MenuItemToggle::createWithTarget(Ref* target, SEL_MenuHandler selector, const Vector<MenuItem*>& menuItems)
{
    MenuItemToggle *ret = new (std::nothrow) MenuItemToggle();
    ret->MenuItem::initWithCallback(std::bind(selector, target, std::placeholders::_1));
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
    auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
    if (sEngine)
    {
        for (const auto &item : menuItems)
        {
            if (item)
            {
                sEngine->retainScriptObject(ret, item);
            }
        }
    }
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
    ret->_subItems = menuItems;
    ret->_selectedIndex = UINT_MAX;
    ret->setSelectedIndex(0);
    return ret;
}
Пример #7
0
bool StartScene::init()
{
	if ( !Layer::init() )
	{
		return false;
	}
	//加载游戏场景中的资源
	SpriteFrameCache::getInstance()->addSpriteFramesWithFile("material_info.plist");
	SpriteFrameCache::getInstance()->addSpriteFramesWithFile("task_title.plist");

	Audio::getInstance()->playBGM(BACKGORUNDMUSIC);
	Size visibleSize = Director::getInstance()->getVisibleSize();

	Sprite* gamebg = Sprite::create("game_bg.png");
	gamebg->setAnchorPoint(ccp(0.5,0.5));
	gamebg->setPosition(ccp(visibleSize.width/2,visibleSize.height/2));
	this->addChild(gamebg,-1);

	Sprite* boy = Sprite::create("game_start_boy.png");
	boy->setPosition(ccp(570,280));
	this->addChild(boy,1);

	Sprite* title = Sprite::create("game_title.png");
	title->setAnchorPoint(ccp(0,1));
	title->setPosition(ccp(10,380));
	this->addChild(title,2);

	Sprite* clock = Sprite::create("game_clock.png");
	clock->setPosition(ccp(85,135));
	this->addChild(clock);

	Sprite* star1 = Sprite::create("game_star.png");
	star1->setPosition(ccp(50,60));
	RotateBy* rotate = RotateBy::create(6,360);
	star1->runAction(RepeatForever::create(rotate));
	this->addChild(star1);

	Sprite* star2 = Sprite::create("game_star.png");
	star2->setPosition(ccp(600,100));
	ScaleTo* scale1 = ScaleTo::create(1,0.8);
	ScaleTo* scale2 = ScaleTo::create(1,1.0);
	Sequence* seq = Sequence::create(scale1,scale2,NULL);
	star2->runAction(RepeatForever::create(seq));
	this->addChild(star2);

	BlinkTitle* btitle = BlinkTitle::create("start_game_txt.png");;
	btitle->setPosition(visibleSize.width/2,100);
	this->addChild(btitle,2); 

	MenuItemImage* start = MenuItemImage::create("start_game_txt.png","start_game_txt.png",CC_CALLBACK_0(StartScene::startGame,this));
	Menu* menu = Menu::create(start,NULL);
	menu->setPosition(ccp(visibleSize.width/2,100));
	this->addChild(menu,1);

	MenuItemImage* musicBtnOn = MenuItemImage::create("bg_music_open.png","bg_music_open.png");
	MenuItemImage* musicBtnOff = MenuItemImage::create("bg_music_close.png","bg_music_close.png");
	MenuItemToggle* musicTog = MenuItemToggle::createWithTarget(this,menu_selector(StartScene::getMusicState),musicBtnOn,musicBtnOff,NULL);
	if (GAMEDATA::getInstance()->getMusicState())
	{
		musicTog->setSelectedIndex(0);
	}
	else
	{
		musicTog->setSelectedIndex(1);
	}
	Menu* musicMenu = Menu::create(musicTog,NULL);
	musicMenu->setPosition(745,450);
	this->addChild(musicMenu);

	helpButton = nullptr;
	MenuItemImage* helpItem = MenuItemImage::create("help.png","help.png",CC_CALLBACK_0(StartScene::showHelpView,this));
	Menu* help = Menu::create(helpItem,NULL);
	help->setPosition(685,450);
	this->addChild(help);

	MenuItemImage* image = MenuItemImage::create("more_game.png","more_game.png",CC_CALLBACK_0(StartScene::showMoreGame,this));
	moreGame = Menu::create(image, nullptr);
	moreGame->setPosition(720, 40);
	this->addChild(moreGame);
	moreGame->setVisible(false);
	schedule(schedule_selector(StartScene::updateScene), 1.0f, kRepeatForever,0);

#if(CC_TARGET_PLATFORM==CC_PLATFORM_ANDROID)
	//签到没有东西可送先关闭
	/*if(!CallAndroidMethod::getInstance()->isSignToday()){
	SignIn* sg = SignIn::getInstance();
	sg->setAnchorPoint(ccp(0.5,0.5));
	this->addChild(sg,3);
	}else{
	schedule(schedule_selector(StartScene::autoStartGame), 3.0f, 0, 0);
	}*/
#endif
	auto listener = EventListenerKeyboard::create();
	listener->onKeyReleased = [=](EventKeyboard::KeyCode code, Event * e){
		switch (code)
		{
		case cocos2d::EventKeyboard::KeyCode::KEY_NONE:
			break;
		case cocos2d::EventKeyboard::KeyCode::KEY_BACK:
			//quitDialog->setVisible(true);
			showQuit();
			break;
		default:
			break;
		}
	};
	Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this);
	//showQuit();//初始化游戏退出界面
	return true;
}
Пример #8
0
bool MenuLayer::init(){
	if (!Layer::init()){
		return false;
	}
	Audio::getInstance()->prepare();
	canStartGame = false;
	showSignInPrize = false;
	isShowSuper = false;
	isShowMagnetic = false;
	isShowPotential = false;
	SpriteFrameCache::getInstance()->addSpriteFramesWithFile("sign_day_prop.plist");
	SpriteFrameCache::getInstance()->addSpriteFramesWithFile("prop_light.plist");
	SpriteFrameCache::getInstance()->addSpriteFramesWithFile("run.plist");
	SpriteFrameCache::getInstance()->addSpriteFramesWithFile("dialog.plist");
	SpriteFrameCache::getInstance()->addSpriteFramesWithFile("lobby.plist");
	Size visibleSize = Director::getInstance()->getVisibleSize();

	m_backgroundLayer = BackgroundLayer::create();
	this->addChild(m_backgroundLayer, -1);

	auto bg = TMXTiledMap::create("map_0.tmx");
	this->addChild(bg);


	Vector<SpriteFrame*> m_runFrames;
	SpriteFrame* frame1;
	for (int i = 0; i < 9; i++){
		frame1 = SpriteFrameCache::getInstance()->getSpriteFrameByName(String::createWithFormat("run_%d.png", i + 1)->_string);
		m_runFrames.pushBack(frame1);
	}
	auto animation1 = Animation::createWithSpriteFrames(m_runFrames, 0.06f);
	auto runAnimate = RepeatForever::create(Animate::create(animation1));

	if (GAMEDATA::getInstance()->getPlayerLevel() < 29){
		auto missionBg = Sprite::createWithSpriteFrameName("mission_bg.png");
		missionBg->setPosition(218, 318);
		missionBg->setScaleX(1.2f);
		this->addChild(missionBg);

		auto mission = LabelBMFont::create(ChineseWord(String::createWithFormat("mission_%d",
			GAMEDATA::getInstance()->getPlayerLevel())->_string.c_str()), "mission.fnt");
		mission->setPosition(218, 330);
		this->addChild(mission);
	}

	auto player = Sprite::createWithSpriteFrameName("run_1.png");
	player->setPosition(123, 227);
	this->addChild(player);
	//player->runAction(runAnimate);

	auto level = Sprite::createWithSpriteFrameName("lobby_level.png");
	level->setPosition(404, 412);
	this->addChild(level);

	auto gold = Sprite::createWithSpriteFrameName("lobby_gold.png");
	gold->setPosition(638, 412);
	this->addChild(gold);

	auto goldNum = ResultGold::getInstance();
	ResultGold::getInstance()->refreshPropNum();
	this->addChild(goldNum, 2);

	auto superBg = Sprite::createWithSpriteFrameName("lobby_prop_bg.png");
	superBg->setPosition(576, 340);
	this->addChild(superBg);

	auto superProgressBg = Sprite::createWithSpriteFrameName("lobby_progress_bg.png");
	superProgressBg->setPosition(516, 340);
	this->addChild(superProgressBg);

	auto superTxt = Sprite::createWithSpriteFrameName("lobby_super_time_txt.png");
	superTxt->setPosition(495, 355);
	this->addChild(superTxt);

	superIcon = Sprite::createWithSpriteFrameName("lobby_prop_super.png");
	superIcon->setPosition(416.5, 340);
	this->addChild(superIcon);

	auto listener1 = EventListenerTouchOneByOne::create();
	listener1->onTouchBegan = CC_CALLBACK_2(MenuLayer::upgradeSuper, this);
	_eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, superBg);

	auto magneticBg = Sprite::createWithSpriteFrameName("lobby_prop_bg.png");
	magneticBg->setPosition(576, 255);
	this->addChild(magneticBg);

	auto magneticProgressBg = Sprite::createWithSpriteFrameName("lobby_progress_bg.png");
	magneticProgressBg->setPosition(516, 255);
	this->addChild(magneticProgressBg);

	auto magneticTxt = Sprite::createWithSpriteFrameName("lobby_magnetic_time_txt.png");
	magneticTxt->setPosition(495, 270);
	this->addChild(magneticTxt);

	magneticIcon = Sprite::createWithSpriteFrameName("lobby_prop_magnetic.png");
	magneticIcon->setPosition(416.5, 255);
	this->addChild(magneticIcon);

	auto listener2 = EventListenerTouchOneByOne::create();
	listener2->onTouchBegan = CC_CALLBACK_2(MenuLayer::upgradeMagnetic, this);
	_eventDispatcher->addEventListenerWithSceneGraphPriority(listener2, magneticBg);


	auto potentialBg = Sprite::createWithSpriteFrameName("lobby_prop_bg.png");
	potentialBg->setPosition(576, 170);
	this->addChild(potentialBg);

	auto potentialProgressBg = Sprite::createWithSpriteFrameName("lobby_progress_bg.png");
	potentialProgressBg->setPosition(516, 170);
	this->addChild(potentialProgressBg);

	auto potentialTxt = Sprite::createWithSpriteFrameName("lobby_potential_time_txt.png");
	potentialTxt->setPosition(495, 185);
	this->addChild(potentialTxt);

	potentialIcon = Sprite::createWithSpriteFrameName("lobby_prop_potential.png");
	potentialIcon->setPosition(416.5, 170);
	this->addChild(potentialIcon);

	auto listener3 = EventListenerTouchOneByOne::create();
	listener3->onTouchBegan = CC_CALLBACK_2(MenuLayer::upgradePotential, this);
	_eventDispatcher->addEventListenerWithSceneGraphPriority(listener3, potentialBg);

	auto startGameBtn = MenuItemImage::create(
		"lobby_start_game_bg_normal.png",
		"lobby_start_game_bg_click.png",
		CC_CALLBACK_0(MenuLayer::startGame, this));
	auto startGameMenu = Menu::create(startGameBtn, NULL);
	startGameMenu->setPosition(580, 70);
	this->addChild(startGameMenu);

	auto startGameTxt = MenuItemImage::create(
		"lobby_start_game_normal.png",
		"lobby_start_game_click.png",
		CC_CALLBACK_0(MenuLayer::startGame, this));
	auto startGameTxtMenu = Menu::create(startGameTxt, NULL);
	startGameTxtMenu->setPosition(580, 70);
	this->addChild(startGameTxtMenu);

	Sprite* super_not_select = Sprite::create("prop_not_select.png");
	super_not_select->setPosition(ccp(432, 320));
	this->addChild(super_not_select);

	Sprite* magnetic_not_select = Sprite::create("prop_not_select.png");
	magnetic_not_select->setPosition(ccp(432, 236));
	this->addChild(magnetic_not_select);

	Sprite* potential_not_select = Sprite::create("prop_not_select.png");
	potential_not_select->setPosition(ccp(432, 150));
	this->addChild(potential_not_select);

	prop_select_icon = Sprite::create("prop_select.png");
	prop_select_icon->setVisible(false);
	this->addChild(prop_select_icon, 2);

	if (GAMEDATA::getInstance()->isSuperSelect()){
		prop_select_icon->setPosition(ccp(432, 320));
		prop_select_icon->setVisible(true);
	}
	else if (GAMEDATA::getInstance()->isMagneticSelect()){
		prop_select_icon->setPosition(ccp(432, 236));
		prop_select_icon->setVisible(true);
	}
	else if (GAMEDATA::getInstance()->isPotentialSelect()){
		prop_select_icon->setPosition(ccp(432, 150));
		prop_select_icon->setVisible(true);
	}

	auto quitLayer = QuitLayer::create();
	quitLayer->setTag(1008);
	quitLayer->setVisible(false);
	this->addChild(quitLayer, 30);


	auto listener = EventListenerKeyboard::create();
	listener->onKeyReleased = [=](EventKeyboard::KeyCode code, Event * e){
		switch (code)
		{
		case cocos2d::EventKeyboard::KeyCode::KEY_NONE:
			break;
		case cocos2d::EventKeyboard::KeyCode::KEY_BACK:
			showQuit();
			break;
		default:
			break;
		}
	};

	Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this);

	signIn = SignIn::create();
	signIn->setVisible(false);
	this->addChild(signIn, 100);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
	canStartGame = true;
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)	
	if(GAMEDATA::getInstance()->isHasPaySignIn()){
		if(CallAndroidMethod::getInstance()->isSignToday()){
			canStartGame = true;
		}else{
			Audio::getInstance()->playSound("Music/sign_in.ogg");
			signIn->setVisible(true);
			canStartGame = true;
		}
	}else{
		if(!GAMEDATA::getInstance()->getHasShowSignInPay() && !CallAndroidMethod::getInstance()->isHasShowSignInPay()){
			CallAndroidMethod::getInstance()->pay(8);
			GAMEDATA::getInstance()->setHasShowSignInPay(true);
		}else{
			canStartGame = true;
		}
	}
#endif

	auto moreGameBtn = MenuItemImage::create(
		"more_game_btn_normal.png", "more_game_btn_click.png", CC_CALLBACK_0(MenuLayer::showMoreGame, this)
		);
	moreGameMenu = Menu::create(moreGameBtn, NULL);
	moreGameMenu->setPosition(740, 65);
	moreGameMenu->setAnchorPoint(Point(0.5, 0.5));
	moreGameMenu->setVisible(false);
	this->addChild(moreGameMenu);

	Audio::getInstance()->playBGM("Music/lobby_bg.ogg");

	MenuItemImage* musicBtnOn = MenuItemImage::create("bg_music_open.png", "bg_music_open.png");
	MenuItemImage* musicBtnOff = MenuItemImage::create("bg_music_close.png", "bg_music_close.png");
	MenuItemToggle* musicTog = MenuItemToggle::createWithTarget(this, menu_selector(MenuLayer::getMusicState), musicBtnOn, musicBtnOff, NULL);
	if (CocosDenshion::SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying())
	{
		musicTog->setSelectedIndex(0);
	}
	else
	{
		musicTog->setSelectedIndex(1);
	}
	auto musicMenu = Menu::create(musicTog, NULL);
	musicMenu->setPosition(60, 65);
	MenuItemImage* soundEffectOn = MenuItemImage::create("sound_effect_open.png", "sound_effect_open.png");
	MenuItemImage* soundEffectOff = MenuItemImage::create("sound_effect_close.png", "sound_effect_close.png");
	MenuItemToggle* soundEffectTog = MenuItemToggle::createWithTarget(this, menu_selector(MenuLayer::getSoudState), soundEffectOn, soundEffectOff, NULL);
	if (GAMEDATA::getInstance()->getSoundState())
	{
		soundEffectTog->setSelectedIndex(0);
	}
	else
	{
		soundEffectTog->setSelectedIndex(1);
	}
	auto soundEffectMenu = Menu::create(soundEffectTog, NULL);
	soundEffectMenu->setPosition(130, 65);
	this->addChild(musicMenu);
	this->addChild(soundEffectMenu);

	signInPrize = SignInPrize::create();
	this->addChild(signInPrize, 200);
	signInPrize->setVisible(false);

	//if (GAMEDATA::getInstance()->isFirstLogin() && Player::skillState <= 4){
		//GAMEDATA::getInstance()->setFirstLogin(false);
		//GameStateInfo::getInstance()->setGameState(Game_Pause);
		//CallAndroidMethod::getInstance()->pay(1);
	//}

	this->scheduleUpdate();
	return true;
}
Пример #9
0
bool Developer::init()
{
	if( !Layer::init() ){
		return false;
	}

	UserDefault *defaults  = UserDefault::getInstance();
	
	// 添加背景图片
    auto sprite = Sprite::create("scene_abo.png");
	sprite->setPosition(Point(GAME_SCREEN_WIDTH/2,GAME_SCREEN_HEIGHT/2));
	sprite->setScaleX(GAME_SCREEN_WIDTH / sprite->getContentSize().width);
	sprite->setScaleY(GAME_SCREEN_HEIGHT / sprite->getContentSize().height);

    this->addChild(sprite);

	// 添加返回主菜单按钮
	auto backItem = MenuItemImage::create(
                                           "btn_ret.png",
                                           "btn_ret.png",
										   CC_CALLBACK_1(Developer::menuBackCallback, this));
    
	backItem->setPosition(Vec2(backItem->getContentSize().width/2,GAME_SCREEN_HEIGHT-backItem->getContentSize().height/2));
    
	
    MenuItemImage *_turnOn,*_turnOff;  
    _turnOn = MenuItemImage::create(  
        "btn_musOn.png",  
        "btn_musOn.png");  
    _turnOff = MenuItemImage::create(  
        "btn_musOff.png",  
        "btn_musOff.png");  

	MenuItemImage *_trnOn,*_trnOff;
	_trnOn = MenuItemImage::create(  
        "btn_musOn.png",  
        "btn_musOn.png");  
    _trnOff = MenuItemImage::create(  
        "btn_musOff.png",  
        "btn_musOff.png");

	// 音乐开关
    MenuItemToggle *musicItem = MenuItemToggle::createWithCallback(CC_CALLBACK_1(Developer::menuMusicCallback, this), _turnOn,_turnOff, NULL);       
	musicItem->setPosition(Point(GAME_SCREEN_WIDTH/1.4,GAME_SCREEN_HEIGHT/1.8));  
	
	// 音效开关
    MenuItemToggle *soundItem = MenuItemToggle::createWithCallback(CC_CALLBACK_1(Developer::menuSoundCallback, this), _trnOn,_trnOff, NULL);       
	soundItem->setPosition(Point(GAME_SCREEN_WIDTH/1.4,GAME_SCREEN_HEIGHT/1.4));  

	auto menu = Menu::create(backItem,musicItem,soundItem, NULL);
    menu->setPosition(Vec2::ZERO);
	this -> addChild( menu );

	TTFConfig config("Marker Felt.ttf",28);
	// 关于
	auto labelAbout = Label::createWithTTF(config, "追梦赤子心");
	labelAbout -> setPosition(Point( GAME_SCREEN_WIDTH/2 , GAME_SCREEN_HEIGHT/1.2));
	labelAbout->setColor(Color3B(35,35,35));
	this->addChild(labelAbout);

	if (defaults->getBoolForKey(MUSIC_KEY)) {                                      
        musicItem->setSelectedIndex(0);                                  
    } 
	else {  
        musicItem->setSelectedIndex(1);                                  
    }

	if (defaults->getBoolForKey(SOUND_KEY)) {                                      
        soundItem->setSelectedIndex(0);                                  
    } 
	else {  
        soundItem->setSelectedIndex(1);                                  
    }
	return true;
}
Пример #10
0
bool GamePauseLayer::init(TopMenu* topNode){
	if(!Layer::init()){
		return false;
	}
	Size visibleSize = Director::getInstance()->getVisibleSize();

	Sprite* background = Sprite::create("bg_mainscene.jpg");
	background->setPosition(visibleSize.width/2,visibleSize.height/2);
	this->addChild(background,0);

	Sprite* prop_des = Sprite::create("props_describe.png");
	prop_des->setPosition(60,650);
	prop_des->setAnchorPoint(Point(0,0.5));
	this->addChild(prop_des,0);

	MenuItemImage* payBtn = MenuItemImage::create(
		"game_pause_buy_gold.png","game_pause_buy_gold.png",CC_CALLBACK_0(GamePauseLayer::payProps,this)
		);
	Menu* payMenu = Menu::create(payBtn, NULL);
	payMenu->alignItemsHorizontally();
	payMenu->setPosition(240,400);
	this->addChild(payMenu,0);
	MenuItemImage* exitBtn = MenuItemImage::create(
		"exit_normal.png","exit_click.png",CC_CALLBACK_0(GamePauseLayer::goBack,this)
		);

	auto scaleSmall = ScaleTo::create(0.8,0.9);
	auto scaleBig = ScaleTo::create(0.8,1);
	auto delay = DelayTime::create(0);
	auto seq2 = Sequence::create(scaleSmall,delay,scaleBig,delay->clone(),NULL);
	payBtn->runAction(RepeatForever::create(seq2));

	MenuItemImage* soundBtnOn = MenuItemImage::create("sound_effect_on.png","sound_effect_on.png");
	MenuItemImage* soundBtnOff = MenuItemImage::create("sound_effect_close.png","sound_effect_close.png");  
	MenuItemToggle* soundTog = MenuItemToggle::createWithTarget(this,menu_selector(GamePauseLayer::getSoudState),soundBtnOn,soundBtnOff,NULL);  
	if (GAMEDATA::getInstance()->getSoundEffect())  
        {  
            soundTog->setSelectedIndex(0);  
        }   
        else  
        {  
            soundTog->setSelectedIndex(1);  
        }  
	MenuItemImage* musicBtnOn = MenuItemImage::create("bg_music_open.png","bg_music_open.png");
	MenuItemImage* musicBtnOff = MenuItemImage::create("bg_music_close.png","bg_music_close.png");  
	MenuItemToggle* musicTog = MenuItemToggle::createWithTarget(this,menu_selector(GamePauseLayer::getMusicState),musicBtnOn,musicBtnOff,NULL);  
	 if (CocosDenshion::SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying())  
        {  
            musicTog->setSelectedIndex(0);  
        }   
        else  
        {  
            musicTog->setSelectedIndex(1);  
        }  

	Menu* otherMenu = Menu::create(soundTog,musicTog,exitBtn, NULL);
	otherMenu->alignItemsHorizontallyWithPadding (25);
	otherMenu->setPosition(visibleSize.width/2+65,visibleSize.height/2-250);
	this->addChild(otherMenu,2);

		MenuItemImage* resumeBtn = MenuItemImage::create(
		"continue_normal.png","continue_click.png",CC_CALLBACK_0(GamePauseLayer::ResumeGame,this)
		);
	auto scale1 = ScaleTo::create(1,1.25);
	auto scale2 = ScaleTo::create(1,1);
	auto seq =Sequence::create(scale1,scale2,nullptr);
	resumeBtn->runAction(RepeatForever::create(seq));
	Menu* resumeMenu = Menu::create(resumeBtn, NULL);
	resumeMenu->alignItemsHorizontallyWithPadding (50);
	resumeMenu->setPosition(visibleSize.width/2-130,visibleSize.height/2-250);
	this->addChild(resumeMenu,2);
	return true;
}
Пример #11
0
bool MenuLayer::init(){
	if(!Layer::init()){
		return false;
	}

	hasShowQuitPay = false;
	auto bg = Sprite::create("bg_mainscene.jpg");
	bg->setPosition(240,400);
	this->addChild(bg);

	title = BlinkTitle::create("title.png");
	title->setPosition(240,560);
	title->setScale(0.8);
	title->setVisible(true);
	this->addChild(title);

	auto startGameBtn = Sprite::create("start_game.png");
	startGameBtn->setPosition(240,282);
	this->addChild(startGameBtn);
	auto scaleSmall = ScaleTo::create(0.8,0.7);
	auto scaleBig = ScaleTo::create(0.8,1);
	auto delay = DelayTime::create(0);
	auto seq = Sequence::create(scaleSmall,delay,scaleBig,delay->clone(),NULL);
	startGameBtn->runAction(RepeatForever::create(seq));

	auto startGamelistener = EventListenerTouchOneByOne::create();
	startGamelistener->onTouchBegan = CC_CALLBACK_2(MenuLayer::startGame,this);
	Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(startGamelistener,startGameBtn);

	Audio::getInstance()->playBGM();

	ParticleSnow* effect = ParticleSnow::create();
	effect->setTotalParticles(100);
	this->addChild(effect);

	int level = GAMEDATA::getInstance()->getUserLevel();
	auto aboutBtn = MenuItemImage::create(
		"about_btn_normal.png","about_btn_click.png",CC_CALLBACK_0(MenuLayer::showAbout,this)
		);
	auto aboutMenu = Menu::create(aboutBtn, NULL);
	aboutMenu->setPosition(427,50);
	this->addChild(aboutMenu);

	int per = (int)((float)GAMEDATA::getInstance()->getCurExpNum()/GAMEDATA::getInstance()->getFullExpNum(level)*100);

	auto levelTxt = Sprite::create("level.png");
	levelTxt->setAnchorPoint(Point(0,0.5));
	levelTxt->setPosition(30,40);
	this->addChild(levelTxt);

	auto levelNum = LabelAtlas::create(String::createWithFormat("%d",level)->_string,"level_num.png",15,22,48);
	levelNum->setAnchorPoint(Point(0,0.5));
	levelNum->setPosition(64,40);
	this->addChild(levelNum);

	auto line = Sprite::create("line.png");
	line->setAnchorPoint(Point(0,0.5));
	auto perNum = LabelAtlas::create(String::createWithFormat("%d",per)->_string,"level_num.png",15,22,48);
	perNum->setAnchorPoint(Point(0,0.5));
	auto perTxt = Sprite::create("per.png");
	perTxt->setAnchorPoint(Point(0,0.5));
	this->addChild(line);
	this->addChild(perNum);
	this->addChild(perTxt);
	if(level < 10){
		line->setPosition(81,40);
		perNum->setPosition(90,40);
		if(per < 10){
			perTxt->setPosition(105,40);
		}else{
			perTxt->setPosition(120,40);
		}
	}else if(level < 100){
		line->setPosition(96,40);
		perNum->setPosition(105,40);
		if(per < 10){
			perTxt->setPosition(120,40);
		}else{
			perTxt->setPosition(135,40);
		}
	}else{
		line->setPosition(111,40);
		perNum->setPosition(120,40);
		if(per < 10){
			perTxt->setPosition(135,40);
		}else{
			perTxt->setPosition(150,40);
		}
	}

	auto goldBuyBtn = MenuItemImage::create(
		"gold_buy_normal.png","gold_buy_click.png",CC_CALLBACK_0(MenuLayer::pay,this)
		);
	auto goldBuyMenu = Menu::create(goldBuyBtn, NULL);
	goldBuyMenu->setPosition(53,760);
	goldBuyMenu->setAnchorPoint(Point(0,0.5));
	this->addChild(goldBuyMenu);

	gold = Gold::getInstance();
	this->addChild(gold);

	MenuItemImage* musicBtnOn = MenuItemImage::create("bg_music_open.png","bg_music_open.png");
	MenuItemImage* musicBtnOff = MenuItemImage::create("bg_music_close.png","bg_music_close.png");
	MenuItemToggle* musicTog = MenuItemToggle::createWithTarget(this,menu_selector(MenuLayer::getMusicState),musicBtnOn,musicBtnOff,NULL);
	 if (CocosDenshion::SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying())
		{
			musicTog->setSelectedIndex(0);
		}
		else
		{
			musicTog->setSelectedIndex(1);
		}
	auto musicMenu = Menu::create(musicTog,NULL);
	musicMenu->setPosition(349,760);
	MenuItemImage* soundEffectOn = MenuItemImage::create("sound_effect_on.png","sound_effect_on.png");
	MenuItemImage* soundEffectOff = MenuItemImage::create("sound_effect_close.png","sound_effect_close.png");
	MenuItemToggle* soundEffectTog = MenuItemToggle::createWithTarget(this,menu_selector(MenuLayer::getSoudState),soundEffectOn,soundEffectOff,NULL);
	 if (GAMEDATA::getInstance()->getSoundEffect())
		{
		    soundEffectTog->setSelectedIndex(0);
		}
		else
		{
			soundEffectTog->setSelectedIndex(1);
		}
	auto soundEffectMenu = Menu::create(soundEffectTog,NULL);
	soundEffectMenu->setPosition(427,760);
	this->addChild(musicMenu);
	this->addChild(soundEffectMenu);

	quitBg = Sprite::create("quit_bg.png");
	quitBg->setPosition(240,116);
	quitBg->setVisible(false);
	this->addChild(quitBg,10);

	quitDesc = Sprite::create("quit_desc.png");
	quitDesc->setPosition(240,144);
	quitDesc->setVisible(false);
	this->addChild(quitDesc,10);

	MenuItemImage* confirmBtn = MenuItemImage::create(
		"quit_confirm_up.png","quit_confirm_down.png",CC_CALLBACK_0(MenuLayer::quit,this)
		);
	confirmMenu = Menu::create(confirmBtn, NULL);
	confirmMenu->setPosition(316,71);
	confirmMenu->setVisible(false);
	this->addChild(confirmMenu,10);

	MenuItemImage* cancelBtn = MenuItemImage::create(
		"quit_cancel_up.png","quit_cancel_down.png",CC_CALLBACK_0(MenuLayer::cancel,this)
		);
	cancelMenu = Menu::create(cancelBtn, NULL);
	cancelMenu->setPosition(164,71);
	cancelMenu->setVisible(false);
	this->addChild(cancelMenu,10);

	this->setKeypadEnabled(true);

	auto listener = EventListenerKeyboard::create();
	listener->onKeyReleased = [=](EventKeyboard::KeyCode code, Event * e){
		switch (code)
		    {
		    case cocos2d::EventKeyboard::KeyCode::KEY_NONE:
		        break;
		    case cocos2d::EventKeyboard::KeyCode::KEY_BACK:
		    	showQuit();
		        break;
		    default:
		        break;
		    }
	};

	Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this);

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
	signIn = SignIn::getInstance();
	signIn->setVisible(false);
	if(CallAndroidMethod::getInstance()->isSignToday()){
		CCLOG("result:%d",2);
	}else{
		CCLOG("result:%d",1);
		Audio::getInstance()->playSignin();
		signIn->setVisible(true);
		this->addChild(signIn,5);
	}
	schedule(schedule_selector(MenuLayer::autoStartGame), 0.2f, 0, 0);
#endif

	aboutBg = Sprite::create("bg_mainscene.jpg");
	aboutBg->setPosition(240,400);
	this->addChild(aboutBg);

	smallTitle11 = Label::create(ChineseWord("abouttitle11"),"Arial",36);
	smallTitle11->setPosition(60,718);
	smallTitle11->setAnchorPoint(Point(0,0.5));
	this->addChild(smallTitle11);

	int totalScore = GAMEDATA::getInstance()->getTotalScore();

	smallTitle12 = Label::create(String::createWithFormat("%d",
			totalScore)->_string+ChineseWord("abouttitle12"),"Arial",36);
	smallTitle12->setPosition(60,668);
	smallTitle12->setAnchorPoint(Point(0,0.5));
	this->addChild(smallTitle12);

	smallTitle21 = Label::create(ChineseWord("abouttitle21"),"Arial",36);
	smallTitle21->setPosition(60,618);
	smallTitle21->setAnchorPoint(Point(0,0.5));
	this->addChild(smallTitle21);

	smallTitle22 = Label::create(String::createWithFormat("%d",
			totalScore/1000)->_string+"."+String::createWithFormat("%d",
					(totalScore%1000)/100)->_string+ChineseWord("abouttitle22"),"Arial",36);
	smallTitle22->setPosition(60,568);
	smallTitle22->setAnchorPoint(Point(0,0.5));
	this->addChild(smallTitle22);

	titleDesc1 = Label::create(ChineseWord("aboutdesc1"),"Arial",24);
	titleDesc1->setPosition(60,478);
	titleDesc1->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc1);

	titleDesc2 = Label::create(ChineseWord("aboutdesc2"),"Arial",24);
	titleDesc2->setPosition(60,438);
	titleDesc2->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc2);

	titleDesc3 = Label::create(ChineseWord("aboutdesc3"),"Arial",24);
	titleDesc3->setPosition(60,398);
	titleDesc3->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc3);

	titleDesc4 = Label::create(ChineseWord("aboutdesc4"),"Arial",24);
	titleDesc4->setPosition(60,358);
	titleDesc4->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc4);

	titleDesc5 = Label::create(ChineseWord("aboutdesc5"),"Arial",24);
	titleDesc5->setPosition(60,318);
	titleDesc5->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc5);

	titleDesc6 = Label::create(ChineseWord("aboutdesc6"),"Arial",24);
	titleDesc6->setPosition(60,278);
	titleDesc6->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc6);

	titleDesc7 = Label::create(ChineseWord("aboutdesc7"),"Arial",24);
	titleDesc7->setPosition(60,238);
	titleDesc7->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc7);

	titleDesc8 = Label::create(ChineseWord("aboutdesc8"),"Arial",24);
	titleDesc8->setPosition(60,198);
	titleDesc8->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc8);

	titleDesc9 = Label::create(ChineseWord("aboutdesc9"),"Arial",24);
	titleDesc9->setPosition(60,158);
	titleDesc9->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc9);

	auto backBtn = MenuItemImage::create(
		"about_back_normal.png","about_back_click.png",CC_CALLBACK_0(MenuLayer::hideAbout,this)
		);
	backMenu = Menu::create(backBtn, NULL);
	backMenu->setPosition(100,70);
	backMenu->setAnchorPoint(Point(0.5,0.5));
	this->addChild(backMenu);

	auto startBtn = MenuItemImage::create(
		"about_start_normal.png","about_start_click.png",CC_CALLBACK_0(MenuLayer::startGameT,this)
		);
	startMenu = Menu::create(startBtn, NULL);
	startMenu->setPosition(320,70);
	startMenu->setAnchorPoint(Point(0.5,0.5));
	this->addChild(startMenu);
	setAboutVisible(false);

	return true;
}
Пример #12
0
bool SignIn::init(){
	if(!Node::init()){
		return false;
	}

	auto bg = Sprite::create("bg_mainscene.jpg");
	bg->setPosition(240,400);
	this->addChild(bg);

	int level = GAMEDATA::getInstance()->getUserLevel();

	int per = (int)((float)GAMEDATA::getInstance()->getCurExpNum()/GAMEDATA::getInstance()->getFullExpNum(level)*100);

	auto levelTxt = Sprite::create("level.png");
	levelTxt->setAnchorPoint(Point(0,0.5));
	levelTxt->setPosition(30,40);
	this->addChild(levelTxt);

	auto levelNum = LabelAtlas::create(String::createWithFormat("%d",level)->_string,"level_num.png",15,22,48);
	levelNum->setAnchorPoint(Point(0,0.5));
	levelNum->setPosition(64,40);
	this->addChild(levelNum);

	auto line = Sprite::create("line.png");
	line->setAnchorPoint(Point(0,0.5));
	auto perNum = LabelAtlas::create(String::createWithFormat("%d",per)->_string,"level_num.png",15,22,48);
	perNum->setAnchorPoint(Point(0,0.5));
	auto perTxt = Sprite::create("per.png");
	perTxt->setAnchorPoint(Point(0,0.5));
	this->addChild(line);
	this->addChild(perNum);
	this->addChild(perTxt);
	if(level < 10){
		line->setPosition(81,40);
		perNum->setPosition(90,40);
		if(per < 10){
			perTxt->setPosition(105,40);
		}else{
			perTxt->setPosition(120,40);
		}
	}else if(level < 100){
		line->setPosition(96,40);
		perNum->setPosition(105,40);
		if(per < 10){
			perTxt->setPosition(120,40);
		}else{
			perTxt->setPosition(135,40);
		}
	}else{
		line->setPosition(111,40);
		perNum->setPosition(120,40);
		if(per < 10){
			perTxt->setPosition(135,40);
		}else{
			perTxt->setPosition(150,40);
		}
	}

	auto goldBuyBtn = MenuItemImage::create(
		"gold_buy_normal.png","gold_buy_click.png",CC_CALLBACK_0(SignIn::pay,this)
		);
	auto goldBuyMenu = Menu::create(goldBuyBtn, NULL);
	goldBuyMenu->setPosition(447,760);
	goldBuyMenu->setAnchorPoint(Point(1,0));
	this->addChild(goldBuyMenu);

	gold = Gold::getInstance();
	this->addChild(gold);

	MenuItemImage* musicBtnOn = MenuItemImage::create("bg_music_open.png","bg_music_open.png");
	MenuItemImage* musicBtnOff = MenuItemImage::create("bg_music_close.png","bg_music_close.png");
	MenuItemToggle* musicTog = MenuItemToggle::createWithTarget(this,menu_selector(SignIn::getMusicState),musicBtnOn,musicBtnOff,NULL);
	 if (CocosDenshion::SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying())
		{
			musicTog->setSelectedIndex(0);
		}
		else
		{
			musicTog->setSelectedIndex(1);
		}
	auto musicMenu = Menu::create(musicTog,NULL);
	musicMenu->setPosition(53,760);
	MenuItemImage* soundEffectOn = MenuItemImage::create("sound_effect_on.png","sound_effect_on.png");
	MenuItemImage* soundEffectOff = MenuItemImage::create("sound_effect_close.png","sound_effect_close.png");
	MenuItemToggle* soundEffectTog = MenuItemToggle::createWithTarget(this,menu_selector(SignIn::getSoudState),soundEffectOn,soundEffectOff,NULL);
	 if (GAMEDATA::getInstance()->getSoundEffect())
		{
			soundEffectTog->setSelectedIndex(0);
		}
		else
		{
			soundEffectTog->setSelectedIndex(1);
		}
	auto soundEffectMenu = Menu::create(soundEffectTog,NULL);
	soundEffectMenu->setPosition(124,760);
	this->addChild(musicMenu);
	this->addChild(soundEffectMenu);

	auto signInbg = Sprite::create("sign_in_bg.png");
	signInbg->setPosition(240,400);
	this->addChild(signInbg);

	auto title = Sprite::create("sign_in_title.png");
	title->setPosition(240,542);
	this->addChild(title);

	auto itemBg1 = Sprite::create("sign_in_item_bg_1.png");
	itemBg1->setPosition(70,442);
	this->addChild(itemBg1);

	auto day1 = LabelAtlas::create("1","game_result_gold_num.png",15,27,48);
	day1->setPosition(60.5,480.5);
	day1->setAnchorPoint(Point(0.5,0.5));
	this->addChild(day1);

	auto dayTxt1 = Sprite::create("sign_in_day.png");
	dayTxt1->setPosition(77.5,480.5);
	this->addChild(dayTxt1);

	auto goldPack1 = Sprite::create("sign_in_gold_pack.png");
	goldPack1->setPosition(70,442);
	this->addChild(goldPack1);

	auto itemGoldNum1 = LabelAtlas::create("15","game_result_gold_num.png",15,27,48);
	itemGoldNum1->setPosition(70,403.5);
	itemGoldNum1->setAnchorPoint(Point(0.5,0.5));
	this->addChild(itemGoldNum1);

	auto itemBg2 = Sprite::create("sign_in_item_bg_1.png");
	itemBg2->setPosition(155,442);
	this->addChild(itemBg2);

	auto day2 = LabelAtlas::create("2","game_result_gold_num.png",15,27,48);
	day2->setPosition(155-9.5,480.5);
	day2->setAnchorPoint(Point(0.5,0.5));
	this->addChild(day2);

	auto dayTxt2 = Sprite::create("sign_in_day.png");
	dayTxt2->setPosition(155+7.5,480.5);
	this->addChild(dayTxt2);

	auto goldPack2 = Sprite::create("sign_in_gold_pack.png");
	goldPack2->setPosition(155,442);
	this->addChild(goldPack2);

	auto itemGoldNum2 = LabelAtlas::create("20","game_result_gold_num.png",15,27,48);
	itemGoldNum2->setPosition(155,403.5);
	itemGoldNum2->setAnchorPoint(Point(0.5,0.5));
	this->addChild(itemGoldNum2);

	auto itemBg3 = Sprite::create("sign_in_item_bg_1.png");
	itemBg3->setPosition(240,442);
	this->addChild(itemBg3);

	auto day3 = LabelAtlas::create("3","game_result_gold_num.png",15,27,48);
	day3->setPosition(240-9.5,480.5);
	day3->setAnchorPoint(Point(0.5,0.5));
	this->addChild(day3);

	auto dayTxt3 = Sprite::create("sign_in_day.png");
	dayTxt3->setPosition(240+7.5,480.5);
	this->addChild(dayTxt3);

	auto goldPack3 = Sprite::create("sign_in_gold_pack.png");
	goldPack3->setPosition(240,442);
	this->addChild(goldPack3);

	auto itemGoldNum3 = LabelAtlas::create("25","game_result_gold_num.png",15,27,48);
	itemGoldNum3->setPosition(240,403.5);
	itemGoldNum3->setAnchorPoint(Point(0.5,0.5));
	this->addChild(itemGoldNum3);

	auto itemBg4 = Sprite::create("sign_in_item_bg_1.png");
	itemBg4->setPosition(325,442);
	this->addChild(itemBg4);

	auto day4 = LabelAtlas::create("4","game_result_gold_num.png",15,27,48);
	day4->setPosition(325-9.5,480.5);
	day4->setAnchorPoint(Point(0.5,0.5));
	this->addChild(day4);

	auto dayTxt4 = Sprite::create("sign_in_day.png");
	dayTxt4->setPosition(325+7.5,480.5);
	this->addChild(dayTxt4);

	auto goldPack4 = Sprite::create("sign_in_gold_pack.png");
	goldPack4->setPosition(325,442);
	this->addChild(goldPack4);

	auto itemGoldNum4 = LabelAtlas::create("30","game_result_gold_num.png",15,27,48);
	itemGoldNum4->setPosition(325,403.5);
	itemGoldNum4->setAnchorPoint(Point(0.5,0.5));
	this->addChild(itemGoldNum4);

	auto itemBg5 = Sprite::create("sign_in_item_bg_1.png");
	itemBg5->setPosition(410,442);
	this->addChild(itemBg5);

	auto day5 = LabelAtlas::create("5","game_result_gold_num.png",15,27,48);
	day5->setPosition(410-9.5,480.5);
	day5->setAnchorPoint(Point(0.5,0.5));
	this->addChild(day5);

	auto dayTxt5 = Sprite::create("sign_in_day.png");
	dayTxt5->setPosition(410+7.5,480.5);
	this->addChild(dayTxt5);

	auto goldPack5 = Sprite::create("sign_in_gold_pack.png");
	goldPack5->setPosition(410,442);
	this->addChild(goldPack5);

	auto itemGoldNum5 = LabelAtlas::create("35","game_result_gold_num.png",15,27,48);
	itemGoldNum5->setPosition(410,403.5);
	itemGoldNum5->setAnchorPoint(Point(0.5,0.5));
	this->addChild(itemGoldNum5);

	auto signedBg = Sprite::create("sign_in_item_bg_2.png");
	auto hasSignMark = Sprite::create("sign_in_has_sign.png");
	this->addChild(signedBg);
	this->addChild(hasSignMark);

	auto desc1 = Sprite::create("sign_in_desc_1.png");
	desc1->setPosition(205.5,346);
	this->addChild(desc1);

	auto desc2 = Sprite::create("sign_in_gold_pack.png");
	desc2->setPosition(286.5,346);
	this->addChild(desc2);

	#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
		signDay = CallAndroidMethod::getInstance()->getCurrentSignDayas();
		if(signDay == 0){
			prizeGoldNum = 15;
			signedBg->setPosition(70,442);
			hasSignMark->setPosition(102,496);
		}else if(signDay == 1){
			prizeGoldNum = 20;
			signedBg->setPosition(155,442);
			hasSignMark->setPosition(187,496);
		}else if(signDay == 2){
			prizeGoldNum = 25;
			signedBg->setPosition(240,442);
			hasSignMark->setPosition(272,496);
		}else if(signDay == 3){
			prizeGoldNum = 30;
			signedBg->setPosition(325,442);
			hasSignMark->setPosition(357,496);
		}else if(signDay >= 4){
			prizeGoldNum = 35;
			signedBg->setPosition(410,442);
			hasSignMark->setPosition(442,496);
		}
    #endif

	auto prizeGold = LabelAtlas::create(String::createWithFormat("%d",prizeGoldNum)->_string,"game_result_gold_num.png",15,27,48);
	prizeGold->setAnchorPoint(Point(0.5,0.5));
	prizeGold->setPosition(321,346);
	this->addChild(prizeGold);

	MenuItemImage* confirmBtn = MenuItemImage::create(
			"sign_in_confirm_up.png","sign_in_confirm_down.png",CC_CALLBACK_0(SignIn::hideSelf,this)
			);
	auto confirmMenu = Menu::create(confirmBtn, NULL);
	confirmMenu->setPosition(240,276);
	this->addChild(confirmMenu);

	auto aboutBtn = MenuItemImage::create(
		"about_btn_normal.png","about_btn_click.png",CC_CALLBACK_0(SignIn::showAbout,this)
		);
	auto aboutMenu = Menu::create(aboutBtn, NULL);
	aboutMenu->setPosition(427,50);
	this->addChild(aboutMenu);

	aboutBg = Sprite::create("bg_mainscene.jpg");
	aboutBg->setPosition(240,400);
	this->addChild(aboutBg);

	smallTitle11 = Label::create(ChineseWord("abouttitle11"),"Arial",36);
	smallTitle11->setPosition(60,718);
	smallTitle11->setAnchorPoint(Point(0,0.5));
	this->addChild(smallTitle11);

	int totalScore = GAMEDATA::getInstance()->getTotalScore();

	smallTitle12 = Label::create(String::createWithFormat("%d",
			totalScore)->_string+ChineseWord("abouttitle12"),"Arial",36);
	smallTitle12->setPosition(60,668);
	smallTitle12->setAnchorPoint(Point(0,0.5));
	this->addChild(smallTitle12);

	smallTitle21 = Label::create(ChineseWord("abouttitle21"),"Arial",36);
	smallTitle21->setPosition(60,618);
	smallTitle21->setAnchorPoint(Point(0,0.5));
	this->addChild(smallTitle21);

	smallTitle22 = Label::create(String::createWithFormat("%d",
			totalScore/1000)->_string+"."+String::createWithFormat("%d",
					(totalScore%1000)/100)->_string+ChineseWord("abouttitle22"),"Arial",36);
	smallTitle22->setPosition(60,568);
	smallTitle22->setAnchorPoint(Point(0,0.5));
	this->addChild(smallTitle22);

	titleDesc1 = Label::create(ChineseWord("aboutdesc1"),"Arial",24);
	titleDesc1->setPosition(60,478);
	titleDesc1->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc1);

	titleDesc2 = Label::create(ChineseWord("aboutdesc2"),"Arial",24);
	titleDesc2->setPosition(60,438);
	titleDesc2->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc2);

	titleDesc3 = Label::create(ChineseWord("aboutdesc3"),"Arial",24);
	titleDesc3->setPosition(60,398);
	titleDesc3->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc3);

	titleDesc4 = Label::create(ChineseWord("aboutdesc4"),"Arial",24);
	titleDesc4->setPosition(60,358);
	titleDesc4->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc4);

	titleDesc5 = Label::create(ChineseWord("aboutdesc5"),"Arial",24);
	titleDesc5->setPosition(60,318);
	titleDesc5->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc5);

	titleDesc6 = Label::create(ChineseWord("aboutdesc6"),"Arial",24);
	titleDesc6->setPosition(60,278);
	titleDesc6->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc6);

	titleDesc7 = Label::create(ChineseWord("aboutdesc7"),"Arial",24);
	titleDesc7->setPosition(60,238);
	titleDesc7->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc7);

	titleDesc8 = Label::create(ChineseWord("aboutdesc8"),"Arial",24);
	titleDesc8->setPosition(60,198);
	titleDesc8->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc8);

	titleDesc9 = Label::create(ChineseWord("aboutdesc9"),"Arial",24);
	titleDesc9->setPosition(60,158);
	titleDesc9->setAnchorPoint(Point(0,0.5));
	this->addChild(titleDesc9);

	auto backBtn = MenuItemImage::create(
		"about_back_normal.png","about_back_click.png",CC_CALLBACK_0(SignIn::hideAbout,this)
		);
	backMenu = Menu::create(backBtn, NULL);
	backMenu->setPosition(100,70);
	backMenu->setAnchorPoint(Point(0.5,0.5));
	this->addChild(backMenu);

	auto startBtn = MenuItemImage::create(
		"about_start_normal.png","about_start_click.png",CC_CALLBACK_0(SignIn::startGameT,this)
		);
	startMenu = Menu::create(startBtn, NULL);
	startMenu->setPosition(320,70);
	startMenu->setAnchorPoint(Point(0.5,0.5));
	this->addChild(startMenu);
	setAboutVisible(false);

	return true;
}