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) {
try
{
@ -244,6 +249,7 @@ void GalaxyMenu::DrawGalaxyMenu() {
}
void GalaxyMenu::InteractWithGalaxy(size_t dt) {
if (timer_active) {
// ::::::::::::: timer active ::::::::::::::
if (menuState == 0) { // main view
@ -310,7 +316,6 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) {
if (starIndex != -1) {
planetHoverIndex = starIndex;
Application->SetupGalaxyUi(starIndex);
ResourceManager->newGuiManager.findWidgetByName("modal_background")->setVisibility(true);
}
timer_active = false;

View File

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

View File

@ -606,8 +606,9 @@ void TMyApplication::LoadGalaxyUi()
std::shared_ptr<WidgetAncestor> modal_background = ResourceManager->newGuiManager.findWidgetByName("modal_background");
modal_background->onMouseUpSignal.connect(
[modal_background](Vector2f v, int i) {
modal_background->visible = false;
[modal_background, this](Vector2f v, int i) {
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();
ResourceManager->newGuiManager.startEditing();
modal_background->setVisibility(true);
if (levelCount <= 3)
{
row2->setVisibility(false);
@ -665,8 +670,6 @@ void TMyApplication::SetupGalaxyUi(size_t levelStar)
currentLevelButton->onMouseUpSignal.disconnect_all_slots();
if (levelIndex < levelCount)
{
@ -683,7 +686,7 @@ void TMyApplication::SetupGalaxyUi(size_t levelStar)
currentLevelButton->onMouseUpSignal.connect(
[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];
lvl->ReloadLevel();
@ -693,6 +696,8 @@ void TMyApplication::SetupGalaxyUi(size_t levelStar)
}
else
{
currentLevelButton->setVisibility(true);
currentLevelButton->setBackground(levelName + "_prerender_blackandwhite");
}
@ -705,9 +710,10 @@ void TMyApplication::SetupGalaxyUi(size_t levelStar)
}
}
ResourceManager->newGuiManager.finishEditing();
}