MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / exit

Method exit

Source/LevelDebugLayer.cpp:570–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568}
569
570void LevelDebugLayer::exit()
571{
572
573 AudioEngine::stopAll();
574 AudioEngine::play2d("quitSound_01.ogg", false, 0.1f);
575 AudioEngine::play2d("menuLoop.mp3", true, 0.2f);
576
577 unscheduleUpdate();
578
579 int size = _allObjects.size();
580 for (int i = 0; i < size; i++)
581 {
582 GameObject* obj = _allObjects.at(i);
583 if (obj && !obj->getParent())
584 {
585 for (auto sprite : obj->_childSprites)
586 {
587 if (!sprite->getParent())
588 {
589 sprite->onExit();
590 AX_SAFE_RELEASE_NULL(sprite);
591 }
592 }
593 if (obj->_particle)
594 {
595 obj->_particle->onExit();
596 AX_SAFE_RELEASE_NULL(obj->_particle);
597 }
598 if (obj->_glowSprite)
599 {
600 obj->_glowSprite->onExit();
601 AX_SAFE_RELEASE_NULL(obj->_glowSprite);
602 }
603 obj->unscheduleAllCallbacks();
604 obj->onExit();
605 obj->setActive(false);
606 AX_SAFE_RELEASE(obj);
607 }
608 }
609
610 int id = _level->_levelID;
611 if (id <= 0 || id > 22)
612 return GameToolbox::popSceneWithTransition(0.5f);
613
614 Director::getInstance()->replaceScene(TransitionFade::create(0.5f, LevelSelectLayer::scene(id - 1)));
615}

Callers 1

onDrawImguiMethod · 0.95

Calls 4

createFunction · 0.85
sizeMethod · 0.80
setActiveMethod · 0.80
onExitMethod · 0.45

Tested by

no test coverage detected