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

Method exit

Source/PlayLayer.cpp:1778–1831  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1776}
1777
1778void PlayLayer::exit()
1779{
1780
1781 _player1->deactivateStreak();
1782 _player2->deactivateStreak();
1783 unscheduleAllCallbacks();
1784 _player1->unscheduleAllCallbacks();
1785 _player2->unscheduleAllCallbacks();
1786 _bottomGround->unscheduleUpdate();
1787 if (_ceiling)
1788 {
1789 _ceiling->unscheduleUpdate();
1790 }
1791
1792 int size = _pObjects.size();
1793 for (int i = 0; i < size; i++)
1794 {
1795 GameObject* obj = _pObjects.at(i);
1796 if (obj && !obj->getParent())
1797 {
1798 if (obj->_particle)
1799 {
1800 obj->_particle->onExit();
1801 AX_SAFE_RELEASE_NULL(obj->_particle);
1802 }
1803 if (obj->_glowSprite)
1804 {
1805 obj->_glowSprite->onExit();
1806 AX_SAFE_RELEASE_NULL(obj->_glowSprite);
1807 }
1808 obj->unscheduleAllCallbacks();
1809 obj->onExit();
1810 obj->setActive(false);
1811 AX_SAFE_RELEASE(obj);
1812 }
1813 }
1814
1815 Instance = nullptr;
1816 BaseGameLayer::_instance = nullptr;
1817
1818 AudioEngine::stopAll();
1819 AudioEngine::play2d("quitSound_01.ogg", false, 0.1f);
1820 AudioEngine::play2d("menuLoop.mp3", true, 0.2f);
1821
1822 auto id = getLevel()->_levelID;
1823 if (id <= 0 || id > 22)
1824 return GameToolbox::popSceneWithTransition(0.5f);
1825
1826 // GameToolbox::popSceneWithTransition(0.5f);
1827
1828
1829 Director::getInstance()->pushScene(
1830 TransitionFade::create(0.5f, LevelSelectLayer::scene(getLevel()->_levelID - 1)));
1831}
1832
1833void PlayLayer::onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event)
1834{

Callers 3

onDrawImGuiMethod · 0.95
onKeyPressedMethod · 0.95
initMethod · 0.45

Calls 5

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

Tested by

no test coverage detected