Пример #1
0
void StartScene::itemArrange()
{
	auto director = Director::getInstance();
	auto winSize = director->getWinSize();

	// 背景の作成
	auto background = Sprite::create("Title.png");
	background->setPosition(Vec2(winSize.width / 2, winSize.height / 2));
	this->addChild(background);

	// スタートロゴの作成
	auto startLogo = Sprite::create("start_logo.png");
	startLogo->setPosition(Vec2(winSize.width / 2, START_BUTTON_POS_Y));
	this->addChild(startLogo);
	// 点滅アクション
	auto blink = Sequence::create(FadeOut::create(1.0), FadeIn::create(1.0), NULL);
	startLogo->runAction(RepeatForever::create(blink));

	// ルール画面の作成
	auto rulescene = RuleScene::create();
	this->setRuleScene(rulescene);

	// ランク画面の作成
	auto rankscene = RankScene::create();
	this->setRankScene(rankscene);

	// ルールボタンの作成
	auto ruleButton = MenuItemImage::create("rule_button.png", "rule_button_pressed.png", [this](Ref *sender){
		if(_ruleScene->getAtmain() && _rankScene->getAtmain()){// メイン画面が表示されていれば
			// ルール画面を表示する
			this->addChild(_ruleScene, 7);

			// メイン画面でないフラグを立てる
			_ruleScene->setAtmain(false);
		}
		//auto transition = TransitionPageTurn::create(0.5, scene, true);
		//Director::getInstance()->replaceScene(transition);
	});

	// ランキングボタンの作成
	auto rankButton = MenuItemImage::create("rank_button_home.png", "rank_button_home_pressed.png",
			[this](Ref* ref){
		if(_ruleScene->getAtmain() && _rankScene->getAtmain()){// メイン画面が表示されていれば
			// ランク画面を表示する
			this->addChild(_rankScene, 7);

			// メイン画面でないフラグを立てる
			_rankScene->setAtmain(false);
		}
		//auto transition = TransitionPageTurn::create(0.5, scene, true);
		//Director::getInstance()->replaceScene(transition);
	});

	// ボタンメニューの作成
	auto menu = Menu::create(ruleButton, rankButton, nullptr);
	this->addChild(menu);
	menu->setPosition(winSize.width / 2.0, MENU_BUTTON_POS_Y);
	menu->alignItemsHorizontallyWithPadding(BUTTON_INTERVAL);

}
Пример #2
0
bool MainScene::init()
{
	if (!Layer::init())
	{
		return false;
	}
	auto listener = EventListenerTouchAllAtOnce::create();

	listener->onTouchesBegan = CC_CALLBACK_2(MainScene::onTouchBegan, this);
	Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this);
	visiblesize = Director::getInstance()->getVisibleSize();

	auto startbtn = MenuItemImage::create("play1.png", "play2.png", CC_CALLBACK_1(MainScene::menuCallback, this));
	auto exitbtn = MenuItemImage::create("exit1.png", "exit2.png", CC_CALLBACK_1(MainScene::menuCallback, this));

	startbtn->setScale(0.5);
	exitbtn->setScale(0.5);
	startbtn->setTag(0);
	exitbtn->setTag(1);

	auto menu = Menu::create(startbtn, exitbtn, NULL);

	menu->alignItemsHorizontallyWithPadding(100.0f);

	this->addChild(menu);

	return true;
}
bool GameLvlChoose::init(){
	auto visibleSize = Director::getInstance()->getVisibleSize();
	
	const char* norImg = "Button/choose_btn_nor.png";
	const char* lightImg = "Button/choose_btn_light.png";
	
	//Lv_1
	auto level_1_Item = MenuItemImage::create(norImg, lightImg, CC_CALLBACK_1(GameLvlChoose::level_1,this));
	level_1_Item->addChild(createLevelLab("1"));
	
	//Lv_2
	auto level_2_Item = MenuItemImage::create(norImg, lightImg, CC_CALLBACK_1(GameLvlChoose::level_2,this));
	level_2_Item->addChild(createLevelLab("2"));
	
	//Lv_3
	auto level_3_Item = MenuItemImage::create(norImg, lightImg, CC_CALLBACK_1(GameLvlChoose::level_3,this));
	level_3_Item->addChild(createLevelLab("3"));
	
	auto menu = CCMenu::create(level_1_Item, level_2_Item, level_3_Item, nullptr);
	menu->alignItemsHorizontallyWithPadding(20);
	menu->setPosition(ccp(visibleSize.width / 2, visibleSize.height / 2));

	this->addChild(menu);

	return true;
}
Пример #4
0
bool MainScene::init()
{
	if (!Layer::init()){
		return false;
	}
	//乱数初期化
	srand((unsigned int)time(NULL));
	
	// directorを取り出す
	auto director = Director::getInstance();
	// 画面サイズを取り出す
	auto size = director->getWinSize();

	// カード(左)を表示する
	int cardNum = rand() % 13 + 1;
	this->setCardNum(cardNum);
	std::string filename = StringUtils::format("trump/c%02d.png", cardNum);
	auto cardLeft = Sprite::create(filename);
	cardLeft->setPosition(Vec2(size.width / 3.0, size.height / 2.0));
	this->setCardLeft(cardLeft);
	this->addChild(cardLeft);

	// カード(右)を表示する
	auto cardRight = Sprite::create("trump/z01.png");
	cardRight->setPosition(Vec2(size.width / 3.0 * 2.0, size.height / 2.0));
	this->setCardRight(cardRight);
	this->addChild(cardRight);

	auto listener = EventListenerTouchOneByOne::create();
	listener->onTouchBegan = [](Touch* touch, Event* event){
		return true;
	};

	// タイトルラベルの表示
	auto titleLabel = Label::createWithSystemFont("High and Low", "Market Felt", 48);
	this->setTitleLabel(titleLabel);
	titleLabel->setPosition(Vec2(size.width / 2.0, size.height / 5.0 * 4.0));
	this->addChild(titleLabel);

	// メニューの表示
	auto highButtonLabel = LabelTTF::create("High", "Market Felt", 48);
	auto highButton = MenuItemLabel::create(highButtonLabel, [this](Ref* ref){
		this->openCard(HighLow::HIGH);
	});
	auto lowButtonLabel = LabelTTF::create("Low", "Market Felt", 48);
	auto lowButton = MenuItemLabel::create(lowButtonLabel, [this](Ref* ref){
		this->openCard(HighLow::LOW);
	});

	auto menu = Menu::create(highButton, lowButton, NULL);
	menu->alignItemsHorizontallyWithPadding(60);
	menu->setPosition(Vec2(size.width/2.0, size.height/ 5.0));
	this->setSelectMenu(menu);
	this->addChild(menu);

	this->scheduleUpdate();
	
	return true;
}
Пример #5
0
bool GameOverLayer::init()
{
    if (!LayerColor::initWithColor(Color4B(255, 255, 255, 50))) {
        return false;
    }
    
    auto visibleSize=Director::getInstance()->getVisibleSize();
    
    auto score_bk=Sprite::createWithSpriteFrameName("gameover_score_bk.png");
    score_bk->setPosition(Vec2(visibleSize.width/2, visibleSize.height/2));
    addChild(score_bk,1);
    score_bk->setScale(0.2f);
    score_bk->runAction(Sequence::create(ScaleTo::create(0.2f, 1.1f),
                                         ScaleTo::create(0.1f, 0.9f),
                                         ScaleTo::create(0.1f, 1.0f),
                                         CallFunc::create(CC_CALLBACK_0(GameOverLayer::ShowScore,this)),
                                         NULL));
    
    auto backtomenu_normal=Sprite::createWithSpriteFrameName("gameover_backtomenu.png");
    auto backtomenu_pressed=Sprite::createWithSpriteFrameName("gameover_backtomenu.png");
    backtomenu_Item = MenuItemSprite::create(backtomenu_normal,
                                           backtomenu_pressed,
                                           CC_CALLBACK_1(GameOverLayer::menu_backtomenu_Callback,this));
    
//    auto playagain_normal=Sprite::createWithSpriteFrameName("gameover_playagain.png");
//    auto playagain_pressed=Sprite::createWithSpriteFrameName("gameover_playagain.png");
//    playagain_Item = MenuItemSprite::create(playagain_normal,
//                                           playagain_pressed,
//                                           CC_CALLBACK_1(GameOverLayer::menu_playagain_Callback,this));
    
    auto menu = Menu::create(backtomenu_Item,NULL);
    menu->alignItemsHorizontallyWithPadding(20);
    menu->setPosition(visibleSize.width/2, 100);
    this->addChild(menu, 2);
    
    auto listener = EventListenerTouchOneByOne::create();
    listener->setSwallowTouches(true);
    
    listener->onTouchBegan = CC_CALLBACK_2(GameOverLayer::onTouchBegan, this);
    listener->onTouchMoved = CC_CALLBACK_2(GameOverLayer::onTouchMoved, this);
    listener->onTouchEnded = CC_CALLBACK_2(GameOverLayer::onTouchEnded, this);
    
    _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
    
#if(CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    auto controllListener = EventListenerController::create();
    controllListener->onKeyUp = CC_CALLBACK_3(GameOverLayer::onKeyDown, this);
    _eventDispatcher->addEventListenerWithSceneGraphPriority(controllListener, this);
    Controller::startDiscoveryController();
#endif
    
    return true;
}
Пример #6
0
bool SelectScene::init()
{
	if (!Layer::init())
	{
		return false;
	}

	auto visibleSize = Director::getInstance()->getVisibleSize();

	/*
	Ìí¼Ó±³¾°Í¼¡£
	*/
	auto background = Sprite::create("other_bg.jpg");
	background->setPosition(visibleSize.width / 2, visibleSize.height / 2);
	this->addChild(background, 0);

	auto bg = Sprite::create("select.png");
	bg->setPosition(visibleSize.width / 2, visibleSize.height / 2);
	this->addChild(bg, 1);

	auto image1 = MenuItemImage::create("simple.png", "simple_selected.png");
	image1->setCallback([](Ref* ref) {
		my_action->changeScene(Level0::createScene());
	});
	auto image2 = MenuItemImage::create("medium.png", "medium_selected.png");
	image2->setCallback([](Ref* ref) {
		my_action->changeScene(Test::createScene());
	});
	auto image3 = MenuItemImage::create("hard.png", "hard_selected.png");
	image3->setCallback([](Ref* ref) {
		my_action->changeScene(Level2::createScene());
	});

	auto menu = Menu::create(image1, image2, image3, NULL);
	menu->setOpacity(200);
	menu->setPosition(visibleSize.width / 2, visibleSize.height / 2);
	menu->alignItemsHorizontallyWithPadding(30);
	this->addChild(menu, 1);

	auto back = MenuItemLabel::create(Label::createWithTTF(my_action->getChinese("chineseXML/start.xml", "Back"), "fonts/shaonvxin.ttf", 36));
	back->setCallback([](Ref* ref) {
		my_action->changeScene(Start::createScene());
	});
	back->setColor(Color3B::WHITE);
	auto backMenu = Menu::create(back, NULL);
	backMenu->setPosition(back->getContentSize().width, visibleSize.height - back->getContentSize().height);
	this->addChild(backMenu, 1);

	return true;
}
// on "init" you need to initialize your instance
bool OverLayer::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }

    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();

    /////////////////////////////
    //Background gameover
    auto overPanel = Sprite::create("Popup.png");
    overPanel->setPosition(Point(origin.x + visibleSize.width / 2, origin.y + (visibleSize.height / 3) * 2));

    this->addChild(overPanel);

    //Score
    //Tạo LabelTTF
    _scoreLabel = Label::createWithTTF("0", "fonts/Square.ttf", 80);
    _scoreLabel->setPosition(origin.x + visibleSize.width / 2, overPanel->getPositionY() + overPanel->getContentSize().height / 4);

    this->addChild(_scoreLabel);

    _highScoreLabel = Label::createWithTTF("0", "fonts/Square.ttf", 20);
    _highScoreLabel->setPosition(origin.x + visibleSize.width / 2, _scoreLabel->getPositionY() - _highScoreLabel->getContentSize().height - 30);

    this->addChild(_highScoreLabel);

    //Button
    auto menuBtn = MenuItemImage::create("MenuBtn.png", "MenuBtnSelected.png", CC_CALLBACK_0(OverLayer::gotoMenuScene, this));
    auto replayBtn = MenuItemImage::create("AgainBtn.png", "AgainBtnSelected.png", CC_CALLBACK_0(OverLayer::gotoPlayScene, this));

    auto menu = Menu::create(menuBtn, replayBtn, nullptr);
    menu->alignItemsHorizontallyWithPadding(50);
    menu->setPosition(origin.x + visibleSize.width / 2, overPanel->getPositionY() - overPanel->getContentSize().height / 2 + menuBtn->getContentSize().height);

    this->addChild(menu);

    return true;
}
Пример #8
0
bool PopChoiceDlg::init()
{
	if (!LayerColor::initWithColor(ccc4(25, 25, 25, 125))) 
		return false;

	auto visibleSize = Director::getInstance()->getVisibleSize();
	//auto origin = Director::getInstance()->getVisibleOrigin();

	addBgImg();

	//获得背景sprite的大小
	m_size = m_bgSprite->getContentSize();
	auto yesItem = MenuItemImage::create(
		"popdlg/popy.png",
		"popdlg/popy.png",
		CC_CALLBACK_1(PopChoiceDlg::yesButton, this));

	auto noItem = MenuItemImage::create(
		"popdlg/popn.png",
		"popdlg/popn.png",
		CC_CALLBACK_1(PopChoiceDlg::noButton, this));

	// create menu, it's an autorelease object
	auto menu = Menu::create(yesItem, noItem, NULL);
	menu->alignItemsHorizontallyWithPadding(5);
	menu->setPosition(ccp(visibleSize.width / 2, visibleSize.height * 0.42));

	this->addChild(menu, 1);

	addTitle();
	addContent();

	//保证是模态对话框
	auto touchlistenter = EventListenerTouchOneByOne::create();
	touchlistenter->setSwallowTouches(true);
	touchlistenter->onTouchBegan = CC_CALLBACK_2(PopChoiceDlg::onTouchBegan, this);
	_eventDispatcher->addEventListenerWithSceneGraphPriority(touchlistenter, this);

	return true;
}
Пример #9
0
bool SelectScene::init()
{
	if (!Layer::init())
	{
		return false;
	}

	auto visibleSize = Director::getInstance()->getVisibleSize();

	auto image1 = MenuItemImage::create("simple.png", "simple.png");
	image1->setCallback([](Ref* ref) {
		my_action->changeScene(Test::createScene());
	});
	auto image2 = MenuItemImage::create("medium.png", "medium.png");
	image2->setCallback([](Ref* ref) {
		// my_action->changeScene(Test::createScene());
	});
	auto image3 = MenuItemImage::create("hard.png", "hard.png");
	image3->setCallback([](Ref* ref) {
		// my_action->changeScene(Test::createScene());
	});

	auto menu = Menu::create(image1, image2, image3, NULL);
	menu->setPosition(visibleSize.width / 2, visibleSize.height / 2);
	menu->alignItemsHorizontallyWithPadding(30);
	this->addChild(menu, 1);

	auto back = MenuItemLabel::create(Label::createWithTTF("Back", "fonts/Marker Felt.ttf", 36));
	back->setCallback([](Ref* ref) {
		my_action->changeScene(Start::createScene());
	});
	back->setColor(Color3B::WHITE);
	auto backMenu = Menu::create(back, NULL);
	backMenu->setPosition(back->getContentSize().width, visibleSize.height - back->getContentSize().height);
	this->addChild(backMenu, 1);

	return true;
}
Пример #10
0
void MenuLayer2::alignMenusH()
{
    for(int i=0;i<2;i++) 
    {
        auto menu = static_cast<Menu*>( getChildByTag(100+i) );
        menu->setPosition( _centeredMenu );
        if(i==0) 
        {
            // TIP: if no padding, padding = 5
            menu->alignItemsHorizontally();            
            auto p = menu->getPosition();
            menu->setPosition(p + Vec2(0,30));
            
        } 
        else 
        {
            // TIP: but padding is configurable
            menu->alignItemsHorizontallyWithPadding(40);
            auto p = menu->getPosition();
            menu->setPosition(p - Vec2(0,30));
        }        
    }
}
Пример #11
0
void Mining::Menu_create(){
	auto Book=Sprite::create("UI/Book.png");
	auto t_Book=Sprite::create("UI/Book.png");
	auto Setup=Sprite::create("UI/Setup.png");
	auto t_Setup=Sprite::create("UI/Setup.png");
	auto Building=Sprite::create("UI/Building.png");
	auto t_Building=Sprite::create("UI/Building.png");
	Building->setAnchorPoint(Point(0,0));
	t_Building->setAnchorPoint(Point(0,0));
	t_Book->setOpacity(150);
	t_Setup->setOpacity(150);
	t_Building->setOpacity(150);
	auto _ui1=MenuItemSprite::create(Book,t_Book,Book,CC_CALLBACK_1(Mining::Touch_book,this));
	auto _ui2=MenuItemSprite::create(Setup,t_Setup,Setup,CC_CALLBACK_1(Mining::Touch_Setup,this));
	auto _ui3=MenuItemSprite::create(Building,t_Building,Building,CC_CALLBACK_1(Mining::Touch_Building,this));
	
	auto UI=Menu::create(_ui3,_ui1,_ui2,NULL);
	UI->alignItemsHorizontallyWithPadding(5);
	//UI->setAnchorPoint(Point(1,1));
	UI->setPosition(243,458);

	this->addChild(UI,ui);
}
Пример #12
0
void TitleScene::initMenu()
{
	auto item_0 = CCMenuItemImage::create("TitleScene_icon_Play_1.png",				 "TitleScene_icon_Play_2.PNG", CC_CALLBACK_1(TitleScene::menuCallback, this));

	auto item_1 = CCMenuItemImage::create("TitleScene_icon_Option_1.png", "TitleScene_icon_Option_2.png", CC_CALLBACK_1(TitleScene::menuCallback, this));

	auto item_2 = CCMenuItemImage::create("TitleScene_icon_About_1.png",
		"TitleScene_icon_About_2.png", CC_CALLBACK_1(TitleScene::menuCallback, this));

	auto item_3 = CCMenuItemImage::create("TitleScene_icon_Quit_1.png", "TitleScene_icon_Quit_2.png", CC_CALLBACK_1(TitleScene::menuCallback, this));

	item_0->setTag(TAG_TITLE__PLAY);
	item_1->setTag(TAG_TITLE__OPTION);
	item_2->setTag(TAG_TITLE__ABOUT);
	item_3->setTag(TAG_TITLE__QUIT);

	auto menu = Menu::create(item_0, item_1, item_2, item_3, NULL);
	menu->alignItemsHorizontallyWithPadding(20);
	menu->setAnchorPoint(Point(0.5, 0.5));
	menu->setPosition(Point(Director::getInstance()->getWinSize().width / 2, Director::getInstance()->getWinSize().height / 8));

	this->addChild(menu);

}
Пример #13
0
BitmapFontMultiLineAlignment::BitmapFontMultiLineAlignment()
{
    auto listener = EventListenerTouchAllAtOnce::create();
    listener->onTouchesBegan = CC_CALLBACK_2(BitmapFontMultiLineAlignment::onTouchesBegan, this);
    listener->onTouchesMoved = CC_CALLBACK_2(BitmapFontMultiLineAlignment::onTouchesMoved, this);
    listener->onTouchesEnded = CC_CALLBACK_2(BitmapFontMultiLineAlignment::onTouchesEnded, this);
    
    _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
    
    // ask director the the window size
    auto size = Director::getInstance()->getWinSize();

    // create and initialize a Label
    this->_labelShouldRetain = LabelBMFont::create(LongSentencesExample, "fonts/markerFelt.fnt", size.width/1.5, TextHAlignment::CENTER);
    this->_labelShouldRetain->retain();

    this->_arrowsBarShouldRetain = Sprite::create("Images/arrowsBar.png");
    this->_arrowsBarShouldRetain->retain();
    this->_arrowsShouldRetain = Sprite::create("Images/arrows.png");
    this->_arrowsShouldRetain->retain();

    MenuItemFont::setFontSize(20);
    auto longSentences = MenuItemFont::create("Long Flowing Sentences", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this));
    auto lineBreaks = MenuItemFont::create("Short Sentences With Intentional Line Breaks", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this));
    auto mixed = MenuItemFont::create("Long Sentences Mixed With Intentional Line Breaks", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this));
    auto stringMenu = Menu::create(longSentences, lineBreaks, mixed, NULL);
    stringMenu->alignItemsVertically();

    longSentences->setColor(Color3B::RED);
    _lastSentenceItem = longSentences;
    longSentences->setTag(LongSentences);
    lineBreaks->setTag(LineBreaks);
    mixed->setTag(Mixed);

    MenuItemFont::setFontSize(30);

    auto left = MenuItemFont::create("Left", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this));
    auto center = MenuItemFont::create("Center", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this));
    auto right = MenuItemFont::create("Right", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this));
    auto alignmentMenu = Menu::create(left, center, right, NULL);
    alignmentMenu->alignItemsHorizontallyWithPadding(alignmentItemPadding);

    center->setColor(Color3B::RED);
    _lastAlignmentItem = center;
    left->setTag(LeftAlign);
    center->setTag(CenterAlign);
    right->setTag(RightAlign);

    // position the label on the center of the screen
    this->_labelShouldRetain->setPosition(Point(size.width/2, size.height/2));

    this->_arrowsBarShouldRetain->setVisible(false);

    float arrowsWidth = (ArrowsMax - ArrowsMin) * size.width;
    this->_arrowsBarShouldRetain->setScaleX(arrowsWidth / this->_arrowsBarShouldRetain->getContentSize().width);
    this->_arrowsBarShouldRetain->setPosition(Point(((ArrowsMax + ArrowsMin) / 2) * size.width, this->_labelShouldRetain->getPosition().y));

    this->snapArrowsToEdge();

    stringMenu->setPosition(Point(size.width/2, size.height - menuItemPaddingCenter));
    alignmentMenu->setPosition(Point(size.width/2, menuItemPaddingCenter+15));

    this->addChild(this->_labelShouldRetain);
    this->addChild(this->_arrowsBarShouldRetain);
    this->addChild(this->_arrowsShouldRetain);
    this->addChild(stringMenu);
    this->addChild(alignmentMenu);
}
Пример #14
0
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }
	srand(time(NULL));
 
    visibleSize = Director::getInstance()->getVisibleSize();
    origin = Director::getInstance()->getVisibleOrigin();
	char hello_tmp_char[100];
	rightSetStatus = false;

	int tmp = CCRANDOM_0_1()*10000;
	sprintf(hello_tmp_char,"scene/map%d.jpg",tmp % 3 + 1);
    auto sprite = Sprite::create(hello_tmp_char);
    sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
    this->addChild(sprite);

	//左上角
	auto left_hall = Sprite::createWithSpriteFrameName("common_info_bg.png");
	left_hall->setAnchorPoint(Vec2(0,1));
	left_hall->setScale(static_Scale * 0.9);
	left_hall->setTag(1);
	left_hall->setPosition(Vec2(0,visibleSize.height));
	addChild(left_hall,ANNIULAYER);

		//遮罩
	auto left_hall_zhe = Sprite::createWithSpriteFrameName("common_touxiang_bg.png");
	left_hall_zhe->setPosition(Vec2(51,65));
	left_hall->addChild(left_hall_zhe);

		//vip
	auto left_hall_vip = Sprite::createWithSpriteFrameName("common_vip_tiao.png");
	left_hall_vip->setAnchorPoint(Vec2(1,0));
	left_hall_vip->setPosition(Vec2(102,16));
	left_hall->addChild(left_hall_vip);

		//name
	auto left_hall_name =  LabelTTF::create(GAME_DATA_STRING("username"),word_Kind,22);
	left_hall_name->setPosition(Vec2(196,88));
	left_hall->addChild(left_hall_name);

		//jinbi icon
	auto left_hall_jinbi_icon = Sprite::createWithSpriteFrameName("bar_coin11.png");
	left_hall_jinbi_icon->setScale(0.4);
	left_hall_jinbi_icon->setPosition(Vec2(129,40));
	left_hall->addChild(left_hall_jinbi_icon);

	auto jinbi_animate = Animate::create(AnimationCache::getInstance()->getAnimation("jinbi_shan"));
	left_hall_jinbi_icon->runAction(RepeatForever::create(Sequence::create(jinbi_animate,DelayTime::create(3.0f),nullptr)));

		//jinbi num
	sprintf(hello_tmp_char,"%d",StaticFunc::getFileData("gameMoney.txt"));
	left_scene_jinbi = LabelAtlas::create(hello_tmp_char,"img/atlas_gold.png",36,44,'0');
	left_scene_jinbi->ignoreAnchorPointForPosition(false);
	left_scene_jinbi->setAnchorPoint(Vec2(0,0.5));
	left_scene_jinbi->setPosition(Vec2(146,40));
	left_scene_jinbi->setScale(0.45);
	left_hall->addChild(left_scene_jinbi);

	//***************************右上角**************************
	right_hall = Sprite::createWithSpriteFrameName("common_set_bg.png");
	right_hall->setAnchorPoint(Vec2(1,1));
	right_hall->setScale(static_Scale * 0.9);
	right_hall->setPosition(Vec2(visibleSize.width,visibleSize.height));
	addChild(right_hall,ANNIULAYER);

		//菜单设置
	auto right_hall_set_sp = Sprite::createWithSpriteFrameName("common_set.png");
	auto right_hall_set_item = MenuItemSprite::create(right_hall_set_sp,right_hall_set_sp,CC_CALLBACK_0(HelloWorld::rightSetFunc,this));
	right_set_menu = Menu::create(right_hall_set_item,nullptr);
	right_set_menu->setPosition(Vec2(379,-52));
	right_set_menu->setEnabled(false);
	right_hall->addChild(right_set_menu,-1);
		
		//菜单选项
	auto right_hall_sp_1 = Sprite::createWithSpriteFrameName("common_about.png");
	auto right_hall_sp_2 = Sprite::createWithSpriteFrameName("common_sound_k.png");
	auto right_hall_sp_3 = Sprite::createWithSpriteFrameName("common_baike.png");
	auto right_hall_sp_4 = Sprite::createWithSpriteFrameName("common_fankui.png");
	auto right_hall_sp_5 = Sprite::createWithSpriteFrameName("common_tuichu.png");
	
	auto right_hall_item_1 = MenuItemSprite::create(right_hall_sp_1,right_hall_sp_1,CC_CALLBACK_0(HelloWorld::rightAboutFunc,this));
	auto right_hall_item_2 = MenuItemSprite::create(right_hall_sp_2,right_hall_sp_2,CC_CALLBACK_0(HelloWorld::rightSoundFunc,this));
	auto right_hall_item_3 = MenuItemSprite::create(right_hall_sp_3,right_hall_sp_3,CC_CALLBACK_0(HelloWorld::rightBaikeFunc,this));
	auto right_hall_item_4 = MenuItemSprite::create(right_hall_sp_4,right_hall_sp_4,CC_CALLBACK_0(HelloWorld::rightFankuiFunc,this));
	auto right_hall_item_5 = MenuItemSprite::create(right_hall_sp_5,right_hall_sp_5,CC_CALLBACK_0(HelloWorld::rightExitFunc,this));

	auto right_hall_menu = Menu::create(right_hall_item_1,right_hall_item_2,right_hall_item_3,right_hall_item_4,right_hall_item_5,nullptr);
	right_hall_menu->alignItemsHorizontallyWithPadding(28);
	right_hall_menu->setPosition(Vec2(right_hall->getContentSize().width/2 ,  right_hall->getContentSize().height *0.6));
	right_hall->addChild(right_hall_menu);

	right_hall->runAction(Sequence::create( MoveBy::create(1.0f,Vec2(0,80 * static_Scale)),CCCallFunc::create([&]{right_set_menu->setEnabled(true);}),nullptr));
 
	//鱼层
	auto layer = ControlLayer::create();
	this->addChild(layer,FISHLAYER);

	sche_bgmusic(0);
	this->schedule(schedule_selector(HelloWorld::sche_bgmusic),60.0f);

	auto mCustomListener = EventListenerCustom::create("REFRASHCOIN",CC_CALLBACK_1(HelloWorld::refrashCoin,this)); 
	_eventDispatcher->addEventListenerWithFixedPriority(mCustomListener,1);
 
    return true;
}
Пример #15
0
void StoreLayer::initMenu()
{
	Size size = Director::getInstance()->getVisibleSize();
	menu = Node::create();
	this->addChild(menu);
	//ÓÑÇé³é½±
	auto raffle_friend_Item = createMenuItem("raffle_friend.png");
	raffle_friend_Item->setCallback([](Ref* pSender){
		Director::getInstance()->pushScene(RaffleOneLayer::createScene());
	});

	//±¦Ê¯³é½±
	auto raffle_diamond_Item = createMenuItem("raffle_diamond.png");
	raffle_diamond_Item->setCallback([](Ref* pSender){
		Director::getInstance()->pushScene(RaffleTenLayer::createScene());
	});


	//µÚÒ»ÅŲ˵¥
	auto menu_row1 = Menu::create(raffle_friend_Item, raffle_diamond_Item, NULL);
	menu_row1->alignItemsHorizontallyWithPadding(30);
	menu_row1->setPosition(size.width/2, size.height/2 + 110);
	menu->addChild(menu_row1);

	//¹ºÂòÌåÁ¦
	auto  buy_str_Item = createMenuItem("text_buy_str.png");
	buy_str_Item->setCallback([this](Ref* pSender){
		createDialog("store_buy_str");
	});


	//¹ºÂò±³°ü
	auto buy_bag_Item = createMenuItem("text_buy_bag.png");
	buy_bag_Item->setCallback([this](Ref* pSender){
		createDialog("store_buy_bag");
	});

	//µÚ¶þÅŲ˵¥
	auto menu_row2 = Menu::create(buy_str_Item, buy_bag_Item, NULL);
	menu_row2->alignItemsHorizontallyWithPadding(30);
	menu_row2->setPosition(size.width/2, size.height/2 + 10);
	menu->addChild(menu_row2);

	//¹ºÂòPVP
	auto buy_pvp_item = createMenuItem("text_buy_pvp.png");
	buy_pvp_item->setCallback([](Ref* pSender){

	});
	
	//ºÃÓÑÉÏÏÞ
	auto friend_number_Item = createMenuItem("text_friend_number.png");
	friend_number_Item->setCallback([this](Ref* pSender){
		createDialog("store_friend_number");
	});

	auto menu_row3 = Menu::create(buy_pvp_item, friend_number_Item, NULL);
	menu_row3->alignItemsHorizontallyWithPadding(30);
	menu_row3->setPosition(size.width/2, size.height/2 - 90);
	menu->addChild(menu_row3);

	//¹ã¸æ
	auto raffle_ad = Sprite::create("ui/raffle_ad.png");
	raffle_ad->setPosition(size.width/2, size.height/2-220);
	menu->addChild(raffle_ad);
}
Пример #16
0
//配置菜单的UI
void MainUILayer::configureMenuUI()
{
	Size size = Director::getInstance()->getVisibleSize();
	menu = Node::create();
	this->addChild(menu);

	//英雄
	auto card_item = createMenuItem("button_little_", "text_card.png");
	card_item->setCallback([this](Ref* pSender){
		log("hero menu");
		removeMainUI();
		showCardUI();
	});

	//进化
	auto cardevolve_item = createMenuItem("button_little_", "text_cardevolve.png");
	cardevolve_item->setCallback([this](Ref* pSender){
		log("evolute menu");
		removeMainUI();
		showCardEvolveUI();
	});

	//第一排菜单
	auto menu_row1 = Menu::create(card_item, cardevolve_item, NULL);
	menu_row1->alignItemsHorizontallyWithPadding(30);
	menu_row1->setPosition(size.width /2, size.height/2 - 70);
	menu->addChild(menu_row1);

	//碎片
	auto chip_item = createMenuItem("button_little_", "text_chip.png");
	chip_item->setCallback([this](Ref* pSender){
		log("chip menu");
		removeMainUI();
		showChipUI();
	});

	//升级
	auto mix_item = createMenuItem("button_little_", "text_mix.png");
	mix_item->setCallback([this](Ref* pSender){
		log("mix menu");
		removeMainUI();
		showCardLevelupUI();
	});

	//第二排菜单
	auto menu_row2 = Menu::create(chip_item, mix_item, NULL);
	menu_row2->alignItemsHorizontallyWithPadding(30);
	menu_row2->setPosition(size.width /2, size.height/2 - 175);
	menu->addChild(menu_row2);

	//奖励
	auto task_item = createMenuItem("button_little_", "text_tast.png");
	task_item->setCallback([this](Ref* pSender){
		log("task menu");
		removeMainUI();
		showTaskUI();
	});

	//技能学院
	auto colleage_item = createMenuItem("button_little_", "text_colleage.png");
	colleage_item->setCallback([this](Ref* pSender){
		log("college menu");
		removeMainUI();
		showColleageUI();
	});

	//第一排菜单
	auto menu_row3 = Menu::create(task_item, colleage_item, NULL);
	menu_row3->alignItemsHorizontallyWithPadding(30);
	menu_row3->setPosition(size.width /2, size.height/2 - 280);
	menu->addChild(menu_row3);
	
}
bool GameJoltLoginLayer::init(std::function<void()> closeFunc) {
    
    if (!LayerColor::initWithColor(ccc4(0, 0, 0, kOverlayOpacity)))
        return false;
    
    _closeFunc = closeFunc;
    
    Size inputSize = CCSizeMake(this->getContentSize().width * 0.3f, 40);
    
    auto gjLogo = Sprite::create("gamejolt_logo.png");
    gjLogo->setPosition(ccp(this->getContentSize().width * 0.5f, this->getContentSize().height * 0.75f));
    gjLogo->getTexture()->setAliasTexParameters();

    EditBox *loginEditBox = EditBox::create(inputSize, Scale9Sprite::create("editboxbg.png"));
    loginEditBox->setAnchorPoint(ccp(0.5f, 0.5f));
    loginEditBox->setPosition(ccp(this->getContentSize().width * 0.5f, this->getContentSize().height * 0.62f));
    loginEditBox->setFontColor(ccBLACK);
    loginEditBox->setPlaceHolder("Username");
    loginEditBox->setReturnType(kKeyboardReturnTypeDone);
    //_loginEditBox->setDelegate(this);
    
    EditBox *tokenEditBox = EditBox::create(inputSize, Scale9Sprite::create("editboxbg.png"));
    tokenEditBox->setAnchorPoint(ccp(0.5f, 0.5f));
    tokenEditBox->setPosition(ccp(this->getContentSize().width * 0.5f, this->getContentSize().height * 0.52f));
    tokenEditBox->setFontColor(ccBLACK);
    tokenEditBox->setPlaceHolder("Token");
    tokenEditBox->setReturnType(kKeyboardReturnTypeDone);
    //_tokenEditBox->setDelegate(this);
    
    if (UserDefault::sharedUserDefault()->getBoolForKey("Logged", false)) {
        string loggedUser = UserDefault::sharedUserDefault()->getStringForKey("LoggedUser");
        string loggedToken = UserDefault::sharedUserDefault()->getStringForKey("LoggedToken");
        loginEditBox->setText(loggedUser.c_str());
        tokenEditBox->setText(loggedToken.c_str());
    }
    
    auto loginLabel = LabelBMFont::create("Login", "MainFont.fnt", 100, kTextAlignmentCenter);
    auto cancelLabel = LabelBMFont::create("Cancel", "MiniFont.fnt", 100, kTextAlignmentCenter);
    auto logoutLabel = LabelBMFont::create("Logout", "MiniFont.fnt", 100, kTextAlignmentCenter);
    
    loginLabel->setColor(greenLabelColor);
    cancelLabel->setColor(yellowLabelColor);
    logoutLabel->setColor(redLabelColor);
    
    auto loginMenuItem = MenuItemLabel::create(loginLabel, [this, loginEditBox, tokenEditBox](Object *object) {
        
        GameJolt::getInstance()->login(loginEditBox->getText(), tokenEditBox->getText());
        this->getCloseFunc()();
        this->removeFromParentAndCleanup(true);
        
    });
    
    auto cancelMenuItem = MenuItemLabel::create(cancelLabel, [this](Object *object) {
        
        this->getCloseFunc()();
        this->removeFromParentAndCleanup(true);
        
    });
    
    auto logoutMenuItem = MenuItemLabel::create(logoutLabel, [this](Object *object) {
        
        GameJolt::getInstance()->logout();
        this->getCloseFunc()();
        this->removeFromParentAndCleanup(true);
        
    });
    
    auto menu = Menu::create(cancelMenuItem, loginMenuItem, logoutMenuItem, NULL);
    menu->setPosition(ccp(this->getContentSize().width * 0.5f, this->getContentSize().height * 0.4f));
    menu->alignItemsHorizontallyWithPadding(80);
    
    auto notice = LabelBMFont::create("Warning:\nThe token is NOT your password.\nGet yours on GameJolt.com!", "MiniFont.fnt", this->getContentSize().width, kTextAlignmentCenter);
    notice->setPosition(ccp(this->getContentSize().width * 0.5f, this->getContentSize().height * 0.11f));
    
    this->addChild(gjLogo);
    this->addChild(loginEditBox);
    this->addChild(tokenEditBox);
    this->addChild(menu);
    this->addChild(notice);
    
    return true;
}
Пример #18
0
bool parentMode::init()
{
	if (!Layer::init())
	{
		return false;
	}

	visibleSize = Director::getInstance()->getVisibleSize();
	Vec2 origin = Director::getInstance()->getVisibleOrigin();
	dispatcher = Director::getInstance()->getEventDispatcher();

	
	//log("%s", FileUtils::getInstance()->getWritablePath().c_str());
	//auto path = FileUtils::getInstance()->getWritablePath() + "/UserDefault.xml";

	auto background = Sprite::create("parent_read/login.png");
	float x = visibleSize.width / background->getContentSize().width;
	float y = visibleSize.height / background->getContentSize().height;
	background->setScale(x, y);
	background->setAnchorPoint(Vec2::ZERO);
	background->setPosition(Vec2::ZERO);
	this->addChild(background);

	taglabel = Sprite::create("parentmode/11.png");
	float xx = visibleSize.width / taglabel->getContentSize().width;
	float yy = visibleSize.height / taglabel->getContentSize().height;
	taglabel->setScale(xx/2,yy);
	taglabel->setAnchorPoint(Vec2::ZERO);
	taglabel->setPosition(Vec2::ZERO);
	this->addChild(taglabel);



	auto panel = Sprite::create("parentmode/11.png");
	panel->setPosition(visibleSize.width / 5 * 3, visibleSize.height / 2);

	auto label2 = Label::createWithTTF("选择家长", "fonts/my_font3.ttf", 24);
	label2->setPosition(Vec2(panel->getPosition().x-panel->getContentSize().width/1.7+label2->getContentSize().width, panel->getPosition().y+panel->getContentSize().height/3));
	this->addChild(label2, 1);
	label2->setVisible(false);

	//auto label3 = Label::createWithTTF("联系方式", "fonts/my_font3.ttf", 24);
	//label3->setPosition(Vec2(panel->getPosition().x - panel->getContentSize().width / 1.7 + label2->getContentSize().width, panel->getPosition().y + panel->getContentSize().height / 12));
	//this->addChild(label3, 3);

	//auto label4 = Label::createWithTTF("家庭住址", "fonts/my_font3.ttf", 24);
	//label4->setPosition(Vec2(panel->getPosition().x - panel->getContentSize().width / 1.7 + label2->getContentSize().width, panel->getPosition().y-panel->getContentSize().height / 6));
	//this->addChild(label4, 3);

	auto level_1 = MenuItemImage::create(
		"my_button.png", "my_button3.png", "my_button2.png", CC_CALLBACK_1(parentMode::Level_1, this));
	auto menuWidth = visibleSize.width / 38 * 4.6;
	auto menuHeight = visibleSize.height / 19 * 2;
	level_1->setScale(menuWidth / level_1->getContentSize().width, menuHeight / level_1->getContentSize().height);
	//creat Level_2
	auto level_2 = MenuItemImage::create(
		"my_button.png", "my_button3.png", "my_button2.png", CC_CALLBACK_1(parentMode::Level_1, this));
	level_2->setEnabled(false);

	auto menu = Menu::create(level_1, NULL);
	menu->alignItemsHorizontallyWithPadding(level_1->getContentSize().width);
	menu->setPosition(Vec2(visibleSize.width/38*20.72,visibleSize.height/19*2.95));
	this->addChild(menu, 3);

	auto close_item = MenuItemImage::create("CloseNormal.png",
		"CloseSelected.png",
		CC_CALLBACK_1(parentMode::menuCloseCallback,
		this));
	close_item->setPosition(
		Vec2(origin.x + visibleSize.width - close_item->getContentSize().width / 2,
		origin.y + close_item->getContentSize().height / 2));
	// create menu, it's an autorelease object
	auto mymenu = Menu::create(close_item, NULL);
	mymenu->setPosition(Vec2::ZERO);
	this->addChild(mymenu, 1);
	/////////////////////////////
	// 3. add your codes below...

	// add a label shows "Hello World"
	// create and initialize a label

	//创建一个label作为下拉菜单的默认选项
	auto label = Label::createWithTTF("妈妈",
		"fonts/my_font3.ttf",
		36);
	label->setColor(Color3B::BLACK);
	label->setTextColor(Color4B::BLACK);
	//设置大小
	auto box_size = Size(visibleSize.width/38*5.15,
		visibleSize.height/19*1.05);

	//
	list_box = CustomDropDownListBox::DropDownList::Create(label,
		box_size,
		Size(visibleSize.width / 38 * 5.15,
		visibleSize.height / 19 * 1.05));


	//添加一堆label进去
	CCDictionary *strings = CCDictionary::createWithContentsOfFile("fonts/chinese.xml");
	const char *charchinese = ((CCString*)strings->objectForKey("parent1"))->getCString();
	auto labell0 = Label::create(charchinese, "Arial", 18);
	labell0->setColor(Color3B::BLACK);
	//auto labell0 = Label::createWithTTF();
	list_box->AddLabel(labell0);//不知道怎么把默认显示的label添加到选项里,只好再添加一个

	CCDictionary *strings1 = CCDictionary::createWithContentsOfFile("fonts/chinese.xml");
	const char *charchinese1 = ((CCString*)strings1->objectForKey("parent2"))->getCString();
	auto labell1 = Label::create(charchinese1, "Arial", 18);
	labell1->setColor(Color3B::BLACK);
	list_box->AddLabel(labell1);

	CCDictionary *strings2 = CCDictionary::createWithContentsOfFile("fonts/chinese.xml");
	const char *charchinese2 = ((CCString*)strings2->objectForKey("parent3"))->getCString();
	auto labell2 = Label::create(charchinese2, "Arial", 18);
	labell2->setColor(Color3B::BLACK);
	list_box->AddLabel(labell2);
	
	CCDictionary *strings3 = CCDictionary::createWithContentsOfFile("fonts/chinese.xml");
	const char *charchinese3 = ((CCString*)strings3->objectForKey("parent4"))->getCString();
	auto labell3 = Label::create(charchinese3, "Arial", 18);
	labell3->setColor(Color3B::BLACK);
	list_box->AddLabel(labell3);

	CCDictionary *strings4 = CCDictionary::createWithContentsOfFile("fonts/chinese.xml");
	const char *charchinese4 = ((CCString*)strings4->objectForKey("parent5"))->getCString();
	auto labell4 = Label::create(charchinese4, "Arial", 18);
	labell4->setColor(Color3B::BLACK);
	list_box->AddLabel(labell4);

	// 设置位置
	list_box->setPosition(
		Vec2(visibleSize.width/38*14.45, 
		visibleSize.height/19*13.85));
	this->addChild(list_box,
		4);
	//启动监听
	list_box->OpenListener();

	testTouchEvent();



	/*auto timesetLabel = MenuItemImage::create(
		"my_button.png", "my_button3.png", "my_button2.png", CC_CALLBACK_1(parentMode::timeset, this));
	auto timesetmenu = Menu::create(timesetLabel, NULL);
	timesetmenu->alignItemsHorizontallyWithPadding(timesetLabel->getContentSize().width / 3 * 2);
	timesetmenu->setPosition(Vec2(100, visibleSize.height / 4 * 3));
	this->addChild(timesetmenu, 3);

	auto messagelabel = MenuItemImage::create(
		"my_button.png", "my_button3.png", "my_button2.png", CC_CALLBACK_1(parentMode::message, this));
	auto messagemenu = Menu::create(messagelabel, NULL);
	messagemenu->alignItemsHorizontallyWithPadding(messagelabel->getContentSize().width / 3 * 2);
	messagemenu->setPosition(Vec2(100, visibleSize.height / 4 * 2));
	this->addChild(messagemenu, 3);

	auto parentstudylabel = MenuItemImage::create(
		"my_button.png", "my_button3.png", "my_button2.png", CC_CALLBACK_1(parentMode::parentstudy, this));
	auto parentstudymenu = Menu::create(parentstudylabel, NULL);
	parentstudymenu->alignItemsHorizontallyWithPadding(parentstudylabel->getContentSize().width / 3 * 2);
	parentstudymenu->setPosition(Vec2(100, visibleSize.height / 4));
	this->addChild(parentstudymenu, 3);*/



	auto back = MenuItemImage::create("timeset/back.png", "timeset/back.png", CC_CALLBACK_1(parentMode::returnto, this));
	back->setScale(0.2*visibleSize.height/back->getContentSize().height);
	auto back_menu = Menu::create(back, NULL);
	back_menu->setPosition(Vec2(back->getBoundingBox().size.width/2, visibleSize.height - back->getBoundingBox().size.height/2));
	this->addChild(back_menu, 3);

	//CCDictionary *xmlstrings = CCDictionary::createWithContentsOfFile(path.c_str());
	if (!database->getBoolForKey("isExist")){
		database->setBoolForKey("isExist", true);
		database->setStringForKey("babyName", "Child's name");
		database->setStringForKey("telNumber", "Tel number");
		database->setStringForKey("address", "Address");
		database->setStringForKey("password", "Password");
		database->setIntegerForKey("indexs", 0);
	}

	list_box->SetSelectedIndex(database->getIntegerForKey("indexs"));

	auto childname = database->getStringForKey("babyName");
	textEdit = TextFieldTTF::textFieldWithPlaceHolder(childname, "fonts/arial.ttf", 36);
	textEdit->setPosition(Vec2(visibleSize.width/38*27.95,visibleSize.height/19*14.35));
	this->addChild(textEdit, 10);
	setTouchMode(kCCTouchesOneByOne);
	setTouchEnabled(true);

	auto telNumber = database->getStringForKey("telNumber");
	textEdit2 = TextFieldTTF::textFieldWithPlaceHolder(telNumber, "fonts/arial.ttf", 36);
	textEdit2->setPosition(Vec2(visibleSize.width / 38 * 17.78, visibleSize.height / 19 * 10.79));
	this->addChild(textEdit2, 10);
	setTouchMode(kCCTouchesOneByOne);
	setTouchEnabled(true);

	auto address = database->getStringForKey("address");
	textEdit3 = TextFieldTTF::textFieldWithPlaceHolder(address, "fonts/arial.ttf", 36);
	textEdit3->setPosition(Vec2(visibleSize.width/38*20.58,visibleSize.height/19*6.85));
	this->addChild(textEdit3, 10);
	setTouchMode(kCCTouchesOneByOne);
	setTouchEnabled(true);

	auto password = database->getStringForKey("password");
	if (password != "Password") {
		for (int i = 0; i < password.length(); i++) {
			password.at(i) = '*';
		}
	}
	textEdit4 = TextFieldTTF::textFieldWithPlaceHolder(password, "fonts/arial.ttf", 36);
	textEdit4->setPosition(Vec2(visibleSize.width / 38 * 29.1, visibleSize.height / 19 * 10.79));
	this->addChild(textEdit4, 10);
	setTouchMode(kCCTouchesOneByOne);
	setTouchEnabled(true);

	return true;
}
Пример #19
0
bool ResultLayer::init()
{
	if(!Layer::init()){
		return false;
	}

	auto winSize = Director::getInstance()->getWinSize();


	// 結果画面の生成
	auto resultBackground = Sprite::create("result_background.png");
	auto backSize = resultBackground->getContentSize();
	resultBackground->setPosition(Vec2(winSize.width / 2, winSize.height * 3 / 2));
	this->setResultBackground(resultBackground);
	this->addChild(resultBackground, 1);

	// 結果画面の出現
	auto delay = DelayTime::create(1.0);
	auto moveto = MoveTo::create(1.0, Vec2(winSize.width / 2, winSize.height / 2));
	auto resultSequence = Sequence::create(delay, moveto, NULL);
	resultBackground->runAction(resultSequence);

	// スコアラベルの作成
	auto scoreLabel = Label::createWithSystemFont("0", "Latha", 20);
	scoreLabel->enableShadow(Color4B::BLACK, Size(0.5, 0.5), 3);
	scoreLabel->enableOutline(Color4B::BLACK, 1.5);
	scoreLabel->setPosition(Vec2(backSize.width / 2, RESULT_SCORE_LABEL_POS_Y));
	this->setResultScoreLabel(scoreLabel);
	resultBackground->addChild(scoreLabel);

	// パネル枚数ラベルの作成
	auto panelsLabel = Label::createWithSystemFont("0", "Latha", 20);
	panelsLabel->enableShadow(Color4B::BLACK, Size(0.5, 0.5), 3);
	panelsLabel->enableOutline(Color4B::BLACK, 1.5);
	panelsLabel->setPosition(Vec2(RESULT_PANELS_LABEL_POS_X, RESULT_PANELS_LABEL_POS_Y));
	this->setResultPanelsLabel(panelsLabel);
	resultBackground->addChild(panelsLabel);


	// maxコンボラベルの作成
	auto maxComboLabel = Label::createWithSystemFont("0", "Latha", 20);
	maxComboLabel->enableShadow(Color4B::BLACK, Size(0.5, 0.5), 3);
	maxComboLabel->enableOutline(Color4B::BLACK, 1.5);
	maxComboLabel->setPosition(Vec2(RESULT_MAX_COMBO_LABEL_POS_X, RESULT_MAX_COMBO_LABEL_POS_Y));
	this->setResultMaxComboLabel(maxComboLabel);
	resultBackground->addChild(maxComboLabel);


	//リプレイボタンの作成
	auto replayButton = MenuItemImage::create("replay_button.png", "replay_button_pressed.png",
			[](Ref* ref){
		auto scene = GameScene::createScene();
		Director::getInstance()->replaceScene(scene);
		CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("buttonpush.mp3");
	});

	// ホームボタンの作成
	auto homeButton = MenuItemImage::create("home_button_result.png", "home_button_result_pressed.png",
			[](Ref* ref){
		auto scene = StartScene::createScene();
		auto transition = TransitionPageTurn::create(0.5, scene, true);
		Director::getInstance()->replaceScene(transition);
		CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("buttonpush.mp3");
	});

	// ランキングボタンの作成
	auto rankButton = MenuItemImage::create("rank_button_result.png", "rank_button_result_pressed.png",
			[](Ref* ref){
		auto scene = StartScene::createScene();
		auto layer = RankScene::create();
		layer->setAtmain(false);
		scene->addChild(layer);
		auto transition = TransitionPageTurn::create(0.5, scene, true);
		Director::getInstance()->replaceScene(transition);
		CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("buttonpush.mp3");
	});

	auto menu = Menu::create(homeButton, replayButton, rankButton, NULL);
	resultBackground->addChild(menu, 2);
	menu->setPosition(Vec2(backSize.width / 2, MENU_POS_Y));

	menu->alignItemsHorizontallyWithPadding(MENU_INTERVAL); // ボタンを横に並べる

	return true;
}