[email protected] 8 years ago
parent
commit
5e897634ee
3 changed files with 15 additions and 8 deletions
  1. 7 0
      src/flow/Scene.cpp
  2. 2 1
      src/flow/Scene.h
  3. 6 7
      src/flow/flow.cpp

+ 7 - 0
src/flow/Scene.cpp

@@ -54,6 +54,13 @@ namespace oxygine
             _holder->setSize(Stage::instance->getSize());
             _holder->setName("Scene::_holder");
 
+            _checkIsThisSceneAllowesDialog = [](spScene) {
+                return true;
+            };
+            _checkIsThisDialogAllowedOnScene = [](spScene) {
+                return true; 
+            };
+
             _transitionIn = _defaultTransition;
             _transitionOut = _defaultTransition;
         }

+ 2 - 1
src/flow/Scene.h

@@ -136,7 +136,8 @@ namespace oxygine
             bool _allowDialogsOnTop;
             bool _passBlockedTouch;
 
-            std::function< bool(spScene) > _checkIsDialogAllowed;
+            std::function< bool(spScene) > _checkIsThisSceneAllowesDialog;//called as: scene->_checkIsDialogAllowed(dialog)
+            std::function< bool(spScene) > _checkIsThisDialogAllowedOnScene;//called  as: dialog->_checkIsDiallogAllowed(scene)
 
 
             spTransition runTransition(Flow*, spScene current, bool back);

+ 6 - 7
src/flow/flow.cpp

@@ -322,14 +322,13 @@ namespace oxygine
                     break;
                 }
             }
-            if (current->_checkIsDialogAllowed)
+
+            for (; it != scenes2show.end(); ++it)
             {
-                for (; it != scenes2show.end(); ++it)
-                {
-                    if ((*it)->_dialog && !current->_checkIsDialogAllowed(*it))
-                        continue;
-                    break;
-                }
+                spScene dialog = *it;
+                if (dialog->_dialog && (!current->_checkIsThisSceneAllowesDialog(dialog) || !dialog->_checkIsThisDialogAllowedOnScene(current)))
+                    continue;
+                break;
             }
 
             if (it == scenes2show.end())