1+ /* *
2+ * Include the Geode headers.
3+ */
4+ #include < Geode/Geode.hpp>
5+ #include < Geode/binding/PlatformToolbox.hpp>
6+ /* *
7+ * Brings cocos2d and all Geode namespaces to the current scope.
8+ */
9+ using namespace geode ::prelude;
10+ static bool g_levelLocked = false ;
11+ #include < Geode/modify/PlayerObject.hpp>
12+ #include < Geode/modify/PlayLayer.hpp>
13+ #include < Geode/modify/GameStatsManager.hpp>
14+ class $modify(MyPlayerObject, PlayerObject) {
15+ void playerDestroyed (bool p0) {
16+ PlayerObject::playerDestroyed (p0);
17+
18+ g_levelLocked = true ;
19+
20+ auto playLayer = PlayLayer::get ();
21+ if (playLayer) {
22+ playLayer->removeFromParentAndCleanup (true );
23+ CCDirector::sharedDirector ()->replaceScene (MenuLayer::scene (false ));
24+ PlatformToolbox::showCursor ();
25+ PlatformToolbox::toggleLockCursor (false );
26+ }
27+ }
28+ };
29+ #include < Geode/modify/MenuLayer.hpp>
30+ class $modify(MyMenuLayer, MenuLayer) {
31+
32+ bool init () {
33+ if (!MenuLayer::init ())
34+ return false ;
35+
36+ if (g_levelLocked) {
37+ auto menu = this ->getChildByID (" main-menu" );
38+ auto createmenu = this ->getChildByID (" main-menu" );
39+ if (menu) {
40+ auto playBtn = menu->getChildByID (" play-button" );
41+ auto createBtn = menu->getChildByID (" editor-button" );
42+ if (playBtn) {
43+ playBtn->setVisible (false );
44+ menu->updateLayout (true );
45+ }
46+ if (createBtn) {
47+ createBtn->setVisible (false );
48+ menu->updateLayout (true );
49+ }
50+ }
51+ }
52+
53+ return true ;
54+ }
55+ };
56+ class $modify(MyStatsManager, GameStatsManager) {
57+
58+ bool init () {
59+ if (!GameStatsManager::init ()) {
60+ return false ;
61+ }
62+ GameStatsManager::setAwardedBonusKeys (100000 );
63+ return true ;
64+ }
65+ };
0 commit comments