fixed some GUI issues

This commit is contained in:
Ilshat Safiullin 2018-10-04 06:55:37 +05:00
parent c7290d0d0f
commit 7a2f0154fb
3 changed files with 20 additions and 7 deletions

View File

@ -13,6 +13,11 @@ GalaxyMenu::~GalaxyMenu()
{ {
} }
void GalaxyMenu::setTimerActivity(bool value)
{
timer_active = value;
}
bool GalaxyMenu::InitGalaxyMenu(std::string config_json, float scale) { bool GalaxyMenu::InitGalaxyMenu(std::string config_json, float scale) {
try try
{ {
@ -244,6 +249,7 @@ void GalaxyMenu::DrawGalaxyMenu() {
} }
void GalaxyMenu::InteractWithGalaxy(size_t dt) { void GalaxyMenu::InteractWithGalaxy(size_t dt) {
if (timer_active) { if (timer_active) {
// ::::::::::::: timer active :::::::::::::: // ::::::::::::: timer active ::::::::::::::
if (menuState == 0) { // main view if (menuState == 0) { // main view
@ -310,7 +316,6 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) {
if (starIndex != -1) { if (starIndex != -1) {
planetHoverIndex = starIndex; planetHoverIndex = starIndex;
Application->SetupGalaxyUi(starIndex); Application->SetupGalaxyUi(starIndex);
ResourceManager->newGuiManager.findWidgetByName("modal_background")->setVisibility(true);
} }
timer_active = false; timer_active = false;

View File

@ -47,6 +47,8 @@ public:
void tapUp(Eigen::Vector2f pos); void tapUp(Eigen::Vector2f pos);
void tapMove(Eigen::Vector2f shift); void tapMove(Eigen::Vector2f shift);
void setTimerActivity(bool value);
private: private:

View File

@ -606,8 +606,9 @@ void TMyApplication::LoadGalaxyUi()
std::shared_ptr<WidgetAncestor> modal_background = ResourceManager->newGuiManager.findWidgetByName("modal_background"); std::shared_ptr<WidgetAncestor> modal_background = ResourceManager->newGuiManager.findWidgetByName("modal_background");
modal_background->onMouseUpSignal.connect( modal_background->onMouseUpSignal.connect(
[modal_background](Vector2f v, int i) { [modal_background, this](Vector2f v, int i) {
modal_background->visible = false; modal_background->setVisibility(false);
Menu.GalaxMenu.setTimerActivity(false);
}); });
} }
@ -624,6 +625,10 @@ void TMyApplication::SetupGalaxyUi(size_t levelStar)
size_t levelCount = this->Menu.GalaxMenu.galaxies[0].Stars[levelStar].selectionMenu.gameLevels.size(); size_t levelCount = this->Menu.GalaxMenu.galaxies[0].Stars[levelStar].selectionMenu.gameLevels.size();
ResourceManager->newGuiManager.startEditing();
modal_background->setVisibility(true);
if (levelCount <= 3) if (levelCount <= 3)
{ {
row2->setVisibility(false); row2->setVisibility(false);
@ -666,8 +671,6 @@ void TMyApplication::SetupGalaxyUi(size_t levelStar)
currentLevelButton->onMouseUpSignal.disconnect_all_slots(); currentLevelButton->onMouseUpSignal.disconnect_all_slots();
if (levelIndex < levelCount) if (levelIndex < levelCount)
{ {
@ -683,7 +686,7 @@ void TMyApplication::SetupGalaxyUi(size_t levelStar)
currentLevelButton->onMouseUpSignal.connect( currentLevelButton->onMouseUpSignal.connect(
[this, modal_background, levelStar, levelIndex](Vector2f v, int i) { [this, modal_background, levelStar, levelIndex](Vector2f v, int i) {
modal_background->visible = false; modal_background->setVisibility(false);
std::shared_ptr<TGameLevel> lvl = this->Menu.GalaxMenu.galaxies[0].Stars[levelStar].selectionMenu.gameLevels[levelIndex]; std::shared_ptr<TGameLevel> lvl = this->Menu.GalaxMenu.galaxies[0].Stars[levelStar].selectionMenu.gameLevels[levelIndex];
lvl->ReloadLevel(); lvl->ReloadLevel();
@ -693,6 +696,8 @@ void TMyApplication::SetupGalaxyUi(size_t levelStar)
} }
else else
{ {
currentLevelButton->setVisibility(true);
currentLevelButton->setBackground(levelName + "_prerender_blackandwhite"); currentLevelButton->setBackground(levelName + "_prerender_blackandwhite");
} }
@ -707,6 +712,7 @@ void TMyApplication::SetupGalaxyUi(size_t levelStar)
} }
ResourceManager->newGuiManager.finishEditing();
} }