add editorpauselayer::get

This commit is contained in:
altalk23 2022-11-10 15:19:29 +03:00 committed by alk
parent 370be30e76
commit fa3a62255b

View file

@ -1103,6 +1103,17 @@ class EditorOptionsLayer {
}
class EditorPauseLayer : CCBlockLayer, FLAlertLayerProtocol {
static EditorPauseLayer* get() {
if (!EditorUI::get()) return nullptr;
auto editor = LevelEditorLayer::get();
for (auto i = 0; i < editor->getChildrenCount(); ++i) {
if (auto layer = cast::safe_cast<EditorPauseLayer*>(editor->getChildren()->objectAtIndex(i))) {
return layer;
}
}
return nullptr;
}
static EditorPauseLayer* create(LevelEditorLayer* editor) {
auto pRet = new EditorPauseLayer();
if (pRet && pRet->init(editor)) {