UIGameHelpWindow::UIGameHelpWindow (IFrontend* frontend) :
		UIWindow(UI_WINDOW_HELP, frontend, WINDOW_FLAG_FULLSCREEN)
{
	UINodeBackground *background = new UINodeBackground(frontend, tr("Help"), false);
	add(background);

	UINode *panel = new UINode(_frontend, "helppanel");
	UIVBoxLayout *vboxLayout = new UIVBoxLayout(vboxspacing, true, NODE_ALIGN_CENTER);
	panel->setLayout(vboxLayout);
	panel->setAlignment(NODE_ALIGN_MIDDLE | NODE_ALIGN_CENTER);
	addPackageHelp(panel);
	addStoneWalkingHelp(panel);
	addStoneFlyingHelp(panel);
	addTreeHelp(panel);
	// TODO: invisible and update on onActive
	if (Config.isModeEasy() && Config.getAmountOfFruitsForANewLife() > 0) {
		addLivesHelp(panel);
	}

	if (System.isOUYA()) {
		addOuyaButton(panel, "ouyaO", tr("Select"));
		addOuyaButton(panel, "ouyaU", tr("Drop the package and the stone"));
		addOuyaButton(panel, "ouyaY", tr("Drop the package and the stone"));
		addOuyaButton(panel, "ouyaA", tr("Back"));
		//addOuyaButton(panel, "ouyaSystem", tr("Hit twice to end the game"));
	}

	add(panel);

	if (!wantBackButton())
		return;

	add(new UINodeBackButton(frontend, background));
}
Esempio n. 2
0
UIMapOptionsWindow::UIMapOptionsWindow (IFrontend *frontend, ServiceProvider& serviceProvider) :
		UIWindow(UI_WINDOW_OPTIONS, frontend, WINDOW_FLAG_MODAL), _serviceProvider(serviceProvider)
{
	_onPush = _onPop = CMD_MAP_PAUSE;

	UINodeSettingsBackground *background = new UINodeSettingsBackground(frontend, "");
	background->setAmountHorizontal(1);
	add(background);

	UINodeBackToRootButton* backToRoot = new UINodeBackToRootButton(frontend);
	const float gap = std::max(0.01f, getScreenPadding());
	backToRoot->alignTo(background, NODE_ALIGN_CENTER | NODE_ALIGN_TOP, gap);
	add(backToRoot);

	_restartMap = new UINodeButtonImage(frontend, "icon-reload");
	_restartMap->setId("restart-map");
	_restartMap->putUnder(backToRoot, 0.02f);
	_restartMap->setOnActivate(CMD_UI_POP ";" CMD_MAP_RESTART);
	add(_restartMap);

	if (!wantBackButton()) {
		_backButton = nullptr;
		return;
	}

	_backButton = new UINodeBackButton(frontend);
	const float gapBack = std::max(0.01f, getScreenPadding());
	_backButton->alignTo(background, NODE_ALIGN_BOTTOM | NODE_ALIGN_LEFT, gapBack);
	add(_backButton);
}
Esempio n. 3
0
UICampaignWindow::UICampaignWindow (IFrontend *frontend, ServiceProvider& serviceProvider, CampaignManager& campaignManager, int cols, int rows) :
		UIWindow(UI_WINDOW_CAMPAIGN, frontend), _campaignManager(campaignManager)
{
	UINodeBackground *background = new UINodeBackground(frontend, tr("Campaigns"));
	add(background);

	const float gap = 0.001f;

	_buttonLeft = new UINodeButtonImage(frontend, "icon-scroll-page-left");

	_campaign = new UINodeCampaignSelector(frontend, _campaignManager, cols, rows);
	add(_campaign);

	_buttonLeft->setPos(_campaign->getLeft() - _buttonLeft->getWidth() - gap, _campaign->getTop());
	_buttonLeft->addListener(UINodeListenerPtr(new SelectorPageListener<CampaignPtr>(_campaign, false)));
	add(_buttonLeft);

	_buttonRight = new UINodeButtonImage(frontend, "icon-scroll-page-right");
	_buttonRight->setPos(_campaign->getRight() + gap, _campaign->getTop());
	_buttonRight->addListener(UINodeListenerPtr(new SelectorPageListener<CampaignPtr>(_campaign, true)));
	add(_buttonRight);

	_continuePlay = new UINodeMainButton(_frontend, tr("Continue"));
	_continuePlay->addListener(UINodeListenerPtr(new ContinuePlayNodeListener(_campaignManager, serviceProvider)));
	_continuePlay->putUnderRight(_campaign);
	add(_continuePlay);

	if (!wantBackButton())
		return;

	add(new UINodeBackButton(frontend, background));
}
UIGameOverWindow::UIGameOverWindow (IFrontend *frontend, CampaignManager& campaignManager) :
		UIWindow(UI_WINDOW_GAMEOVER, frontend), _campaignManager(campaignManager)
{
	setInactiveAfterPush();

	UINode* background = new UINodeGameOverBackground(frontend);
	add(background);

	if (!wantBackButton())
		return;

	add(new UINodeBackButton(frontend, background));
}
UIGameFinishedWindow::UIGameFinishedWindow (IFrontend *frontend) :
		UIWindow(UI_WINDOW_GAMEFINISHED, frontend)
{
	_musicFile = "music-win";
	setInactiveAfterPush();

	UINodeBackground *background = new UINodeBackground(frontend, "", false);
	if (System.hasTouch() && !wantBackButton())
		background->setOnActivate(CMD_UI_POP);
	add(background);

	UINodeLabel *won = new UINodeLabel(frontend, tr("You won!"));
	won->setAlignment(NODE_ALIGN_MIDDLE | NODE_ALIGN_CENTER);
	won->setFont(LARGE_FONT);
	won->setColor(colorWhite);
	add(won);

	// TODO:

	if (!wantBackButton())
		return;

	add(new UINodeBackButton(frontend, background));
}
UIMapSelectorWindow::UIMapSelectorWindow (UINodeMapSelector* mapSelector, const std::string& title, const std::string& id, IFrontend *frontend,
		WindowFlags flags) :
		UIWindow(id, frontend, flags), _mapSelector(mapSelector)
{
	UINodeBackground *background = new UINodeBackground(frontend, title);
	add(background);

	const float gap = 0.001f;

	const int spriteHeight = 60;
	_livesSprite = new UINodeSprite(frontend, spriteHeight, spriteHeight);
	_livesSprite->setSpriteOffset(spriteHeight);
	_liveSprite = UI::get().loadSprite("icon-heart");
	for (uint8_t i = 0; i < INITIAL_LIVES; ++i) {
		_livesSprite->addSprite(_liveSprite);
	}
	_livesSprite->putAbove(_mapSelector);
	add(_livesSprite);

	_buttonLeft = new UINodeButtonImage(frontend, "icon-scroll-page-left");
	_buttonLeft->addListener(UINodeListenerPtr(new SelectorPageListener<std::string>(_mapSelector, false)));
	add(_mapSelector);

	_buttonLeft->setPos(_mapSelector->getLeft() - _buttonLeft->getWidth() - gap, _mapSelector->getTop());
	add(_buttonLeft);

	_buttonRight = new UINodeButtonImage(frontend, "icon-scroll-page-right");
	_buttonRight->setPos(_mapSelector->getRight() + gap, _mapSelector->getTop());
	_buttonRight->addListener(UINodeListenerPtr(new SelectorPageListener<std::string>(_mapSelector, true)));
	add(_buttonRight);

	_buttonRight->setVisible(false);
	_buttonLeft->setVisible(false);

	if (!wantBackButton())
		return;

	add(new UINodeBackButton(frontend, background));
}