コード例 #1
0
	GameOptionsMenu::GameOptionsMenu(SMenuConfig* menuConfig) :
		title("Options de la partie", TITLEFONT, 30),
		category(TITLEFONT, 100),		
		cancel("Annuler", 550, CREATEGAMEMENU),
		save("Valider", 550, CREATEGAMEMENU),
		menuConfig(menuConfig)
	{
		ISkin* skin = PolyBomberApp::getISkin();
		
		title.setColor(skin->getColor(TITLECOLOR));

		category.push_back("Bonus de bombe");
		category.push_back("Bonus de personnage");
		category.push_back("Infections");

		cancel.move(-100, 0);
		save.move(100, 0);

		cancel.setSelected(true);
		
		cancel.setNext(&save);			
		save.setNext(&cancel);

		this->widgets.push_back(&title);
		this->widgets.push_back(&category);
		this->widgets.push_back(&cancel);
		this->widgets.push_back(&save);

		initBonus();
	}
コード例 #2
0
ファイル: Scene_UI.cpp プロジェクト: dreamyouxi/Defend
bool Scene_UI::init()
{

	Layer::init();

	Audio::stop_backgroundMusic();



	data = new DatePos_Array;
	data->clear();




	bg = MenuItemSprite::create(Sprite::create("bg.jpg"), Sprite::create("bg.jpg"), [=](Ref*)
	{
		for (int i = 0; i < tower_queue.size(); i++)
		{
			tower_queue[i]->setClick(false);
		}
	});

	bg->setPosition(960 / 2, 640 / 2);

	auto menu = Menu::create(bg, nullptr);
	menu->setPosition(0, 0);
	this->addChild(menu);





	initQueue_way();

	initScene(this);


	this->loadSceneWay();


	/*

		tower_queue.push_back(new Tower_Bottle(this, PublicFunc::convertToPoint(1, 4), 3));

		data->push_back(1, 4);
		*/

	Sprite*start = Sprite::createWithSpriteFrameName("start01.png");
	this->addChild(start);
	start->setPosition(PublicFunc::convertToPoint(queue_way.front().x, queue_way.front().y));
	view_click_gloal = 0;


	view_up_menu = new View_Up_Menu(this, base_money);

	view_king = new View_king(this, PublicFunc::convertToPoint(queue_way.back().x, queue_way.back().y));
	view_click_gloal = new View_Click_gloal(this);

	initAbleTower();


	/*Init bonus*/
	initBonus();

	/**********************************************************************/

	wave_manager = new Wave_Manager(this);
	initWave_manager();

	/*

		wave_manager->push_back(1, Each_One(13, 1), true);
		wave_manager->push_back(1, Each_One(13, 1));

		*/



	this->scheduleUpdate();


	/*初始化  开始   倒计时   */

	view_up_menu->setPause(true);


	auto menu_ = MenuItemImage::create("bg.jpg", "bg.jpg", [=](Ref*)
	{

	});
	menu_->setPosition(960 / 2, 640 / 2);
	menu_->setOpacity(0);

	x = Menu::create(menu_, nullptr);
	x->setPosition(0, 0);
	this->addChild(x, 10);




	sp_count_1 = Sprite::createWithSpriteFrameName("countdown_11.png");
	this->addChild(sp_count_1, 11);
	sp_count_1->setPosition(960 / 2, 640 / 2);

	sp_count_2 = Sprite::createWithSpriteFrameName("countdown_12.png");
	this->addChild(sp_count_2, 11);
	sp_count_2->setPosition(960 / 2, 640 / 2);

	sp_count_2->runAction(RepeatForever::create(RotateBy::create(1.0, -360)));

	SimpleAudioEngine::getInstance()->playEffect("Music/CountDown.mp3");


	sp_count = Sprite::createWithSpriteFrameName("countdown_01.png");

	sp_count->setPosition(960 / 2, 640 / 2);
	this->addChild(sp_count, 11);

	this->runAction(Sequence::create(DelayTime::create(1),
		CallFunc::create([=]()
	{
		sp_count->setSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("countdown_02.png"));
		SimpleAudioEngine::getInstance()->playEffect("Music/CountDown.mp3");

	})
		, DelayTime::create(1), CallFunc::create([=]()
	{
		sp_count->setSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("countdown_03.png"));
		SimpleAudioEngine::getInstance()->playEffect("Music/CountDown.mp3");


	})

		, DelayTime::create(1), CallFunc::create([=]()
	{
		sp_count->setSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("countdown_13.png"));
		SimpleAudioEngine::getInstance()->playEffect("Music/GO.mp3");

	}),


		DelayTime::create(0.3),

		CallFunc::create([=]()
	{
		x->setVisible(false);

		for (int i = 0; i < queue_f.size(); i++)
		{
			queue_f[i]->removeFromParentAndCleanup(true);

		}
		queue_f.clear();

		sp_count->removeFromParentAndCleanup(true);

		view_up_menu->setPause(false);
		SimpleAudioEngine::getInstance()->stopBackgroundMusic(false);

		sp_count_1->removeFromParentAndCleanup(true);
		sp_count_2->removeFromParentAndCleanup(true);

		//	x->removeAllChildrenWithCleanup(true);
		x->removeFromParentAndCleanup(true);

	}), nullptr));


	/*倒计时,显示可放的 位置*/
	for (int x = 0; x < 12; x++)
	{
		for (int y = 0; y < 7; y++)
		{
			if (data->isUseAble(x, y) == true)
			{
				Sprite*sp = Sprite::createWithSpriteFrameName("select_00.png");

				sp->runAction(RepeatForever::create(Sequence::create(
					FadeOut::create(0.5), FadeIn::create(0.5)

					, nullptr)));
				this->addChild(sp);
				sp->setPosition(PublicFunc::convertToPoint(x, y));
				queue_f.push_back(sp);
			}
		}
	}


	sp_bonus_clear = Sprite::createWithSpriteFrameName("targetscleard_CN.png");
	this->addChild(sp_bonus_clear, 4);
	sp_bonus_clear->setPosition(960 / 2, -0);
	sp_bonus_clear->setVisible(false);


	return true;
}