1+ #include < Geode/Geode.hpp>
2+ #include < Geode/modify/CCDirector.hpp>
3+ #include < Geode/modify/PauseLayer.hpp>
4+
5+ class $modify(MyPauseLayer, PauseLayer){
6+
7+ void customSetup (){
8+ PauseLayer::customSetup ();
9+
10+ if (!Loader::get ()->isModLoaded (" geode.node-ids" )) return ;
11+
12+ if (CCNode* node = getChildByID (" background" )) {
13+ node->setVisible (false );
14+ }
15+ if (CCNode* node = getChildByID (" music-slider" )) {
16+ node->setVisible (false );
17+ }
18+ if (CCNode* node = getChildByID (" sfx-slider" )) {
19+ node->setVisible (false );
20+ }
21+ if (CCNode* node = getChildByID (" music-label" )) {
22+ node->setVisible (false );
23+ }
24+ if (CCNode* node = getChildByID (" sfx-label" )) {
25+ node->setVisible (false );
26+ }
27+ if (CCNode* node = getChildByID (" left-button-menu" )) {
28+ node->setVisible (false );
29+ }
30+ if (CCNode* node = getChildByID (" right-button-menu" )) {
31+ node->setVisible (false );
32+ }
33+ if (CCNode* node = getChildByID (" bottom-button-menu" )) {
34+ node->setVisible (false );
35+ }
36+ if (CCNode* node = getChildByID (" normal-progress-label" )) {
37+ node->setVisible (false );
38+ }
39+ if (CCNode* node = getChildByID (" normal-progress-bar" )) {
40+ node->setVisible (false );
41+ }
42+ if (CCNode* node = getChildByID (" normal-mode-label" )) {
43+ node->setVisible (false );
44+ }
45+ if (CCNode* node = getChildByID (" practice-progress-label" )) {
46+ node->setVisible (false );
47+ }
48+ if (CCNode* node = getChildByID (" practice-progress-bar" )) {
49+ node->setVisible (false );
50+ }
51+ if (CCNode* node = getChildByID (" practice-mode-label" )) {
52+ node->setVisible (false );
53+ }
54+
55+ PlayLayer* playLayer = PlayLayer::get ();
56+
57+ if (CCLabelBMFont* title = typeinfo_cast<CCLabelBMFont*>(getChildByID (" level-name" ))) {
58+ title->setFntFile (" minecraft.fnt" _spr);
59+ title->setScale (0 .45f );
60+ title->setPosition ({title->getPosition ().x , title->getPosition ().y - 10 });
61+
62+ if (CCLabelBMFont* time = typeinfo_cast<CCLabelBMFont*>(getChildByID (" play-time" ))) {
63+ time->setFntFile (" minecraft.fnt" _spr);
64+ time->setScale (0 .45f );
65+ time->setPosition ({title->getPosition ().x , title->getPosition ().y - 15 });
66+ }
67+
68+ if (getChildByID (" normal-progress-bar" )){
69+
70+ CCLabelBMFont* normalProgress = typeinfo_cast<CCLabelBMFont*>(getChildByID (" normal-progress-label" ));
71+ CCLabelBMFont* practiceProgress = typeinfo_cast<CCLabelBMFont*>(getChildByID (" practice-progress-label" ));
72+
73+ if (normalProgress && practiceProgress){
74+ std::wstring bestText = L" " ;
75+ bestText.append (L" Best: \u00A7 a" );
76+ bestText.append (Utils::strToWstr (normalProgress->getString ()));
77+ bestText.append (L" \u00A7 f| \u00A7 b" );
78+ bestText.append (Utils::strToWstr (practiceProgress->getString ()));
79+
80+ MCLabel* label = MCLabel::create (bestText, " minecraft.fnt" _spr);
81+ label->setScale (0 .45f );
82+ label->setPosition ({title->getPosition ().x , title->getPosition ().y - 15 });
83+ addChild (label);
84+ }
85+ }
86+ }
87+
88+ setColor ({15 , 15 , 15 });
89+ setOpacity (200 );
90+
91+ CCSize winSize = CCDirector::get ()->getWinSize ();
92+
93+ RowLayout* rowLayout = RowLayout::create ();
94+ rowLayout->ignoreInvisibleChildren (true );
95+ rowLayout->setGrowCrossAxis (true );
96+
97+ CCNode* innerButtonMenu = CCNode::create ();
98+
99+ innerButtonMenu->setContentSize ({200 , 200 });
100+ innerButtonMenu->setLayout (rowLayout);
101+ innerButtonMenu->setAnchorPoint ({0.5 , 0.5 });
102+ innerButtonMenu->setZOrder (1 );
103+ innerButtonMenu->setID (" button-menu" _spr);
104+ innerButtonMenu->setPosition ({winSize.width /2 , winSize.height -140 });
105+
106+ CCNode* bottomLeftMenu = CCNode::create ();
107+ bottomLeftMenu->setContentSize ({20 , 20 });
108+ bottomLeftMenu->setLayout (rowLayout);
109+ bottomLeftMenu->setAnchorPoint ({0.5 , 0.5 });
110+ bottomLeftMenu->setZOrder (1 );
111+ bottomLeftMenu->setID (" bottom-left-menu" _spr);
112+ bottomLeftMenu->setPosition ({30 , 30 });
113+
114+ if (MyCCMenuItemSpriteExtra* button = static_cast <MyCCMenuItemSpriteExtra*>(getChildByIDRecursive (" play-button" ))) {
115+
116+ MCButton* btn2 = MCButton::create (" Back to Game" , 50 .0f , button->m_fields ->m_buttonTarget , button->m_fields ->m_buttonCallback );
117+ btn2->setID (button->getID ());
118+ button->setVisible (false );
119+ innerButtonMenu->addChild (btn2);
120+
121+ }
122+
123+
124+ if (MyCCMenuItemSpriteExtra* button = static_cast <MyCCMenuItemSpriteExtra*>(getChildByIDRecursive (" practice-button" ))) {
125+
126+ std::string practiceText = " Practice" ;
127+
128+ if (playLayer->m_isPracticeMode ){
129+ practiceText = " Exit Practice" ;
130+ }
131+
132+
133+ MCButton* btn2 = MCButton::create (practiceText.c_str (), 24 .3f , button->m_fields ->m_buttonTarget , button->m_fields ->m_buttonCallback );
134+ btn2->setID (button->getID ());
135+ button->setVisible (false );
136+ innerButtonMenu->addChild (btn2);
137+
138+ }
139+
140+ MCButton* statsButton = MCButton::create (" Statistics" , 24 .3f , this , menu_selector (MyPauseLayer::onStatistics));
141+ innerButtonMenu->addChild (statsButton);
142+
143+ MCButton* optionButton = MCButton::create (" Options..." , 24 .3f , this , menu_selector (MyPauseLayer::onMCOptions));
144+ innerButtonMenu->addChild (optionButton);
145+
146+ if (MyCCMenuItemSpriteExtra* button = static_cast <MyCCMenuItemSpriteExtra*>(getChildByIDRecursive (" options-button" ))) {
147+
148+ MCButton* btn2 = MCButton::create (" " , 5 .0f , button->m_fields ->m_buttonTarget , button->m_fields ->m_buttonCallback );
149+ CCSprite* spr = Utils::createPixelSprite (" accessibility.png" _spr);
150+ btn2->setID (button->getID ());
151+ spr->setPosition ({btn2->getContentSize ().width /2 , btn2->getContentSize ().height /2 });
152+ btn2->addSprite (spr);
153+ button->setVisible (false );
154+
155+ bottomLeftMenu->addChild (btn2);
156+ }
157+
158+ if (MyCCMenuItemSpriteExtra* button = static_cast <MyCCMenuItemSpriteExtra*>(getChildByIDRecursive (" retry-button" ))) {
159+
160+ MCButton* btn2 = MCButton::create (" Retry" , 24 .3f , button->m_fields ->m_buttonTarget , button->m_fields ->m_buttonCallback );
161+ btn2->setID (button->getID ());
162+ button->setVisible (false );
163+ innerButtonMenu->addChild (btn2);
164+ }
165+
166+ float buttonSize = 50 .0f ;
167+
168+ if (MyCCMenuItemSpriteExtra* button = static_cast <MyCCMenuItemSpriteExtra*>(getChildByIDRecursive (" edit-button" ))) {
169+
170+ if (getChildByIDRecursive (" full-restart-button" )){
171+ buttonSize = 24 .3f ;
172+ }
173+
174+ MCButton* btn2 = MCButton::create (" Edit Level" , buttonSize, button->m_fields ->m_buttonTarget , button->m_fields ->m_buttonCallback );
175+ btn2->setID (button->getID ());
176+ button->setVisible (false );
177+ innerButtonMenu->addChild (btn2);
178+ }
179+
180+ if (MyCCMenuItemSpriteExtra* button = static_cast <MyCCMenuItemSpriteExtra*>(getChildByIDRecursive (" full-restart-button" ))) {
181+
182+ MCButton* btn2 = MCButton::create (" Restart Level" , buttonSize, button->m_fields ->m_buttonTarget , button->m_fields ->m_buttonCallback );
183+ btn2->setID (button->getID ());
184+ button->setVisible (false );
185+ innerButtonMenu->addChild (btn2);
186+ }
187+
188+ if (MyCCMenuItemSpriteExtra* button = static_cast <MyCCMenuItemSpriteExtra*>(getChildByIDRecursive (" exit-button" ))) {
189+
190+ MCButton* btn2 = MCButton::create (" Quit to Title" , 50 .0f , button->m_fields ->m_buttonTarget , button->m_fields ->m_buttonCallback );
191+ btn2->setID (button->getID ());
192+ button->setVisible (false );
193+ innerButtonMenu->addChild (btn2);
194+
195+ }
196+
197+ innerButtonMenu->updateLayout ();
198+ bottomLeftMenu->updateLayout ();
199+
200+ addChild (innerButtonMenu);
201+ addChild (bottomLeftMenu);
202+ }
203+
204+ void onMCOptions (CCObject* obj){
205+ OptionsLayer* optionsLayer = OptionsLayer::create ();
206+ optionsLayer->setZOrder (20 );
207+ optionsLayer->showLayer (false );
208+ }
209+
210+ void onStatistics (CCObject* obj){
211+
212+ PlayLayer* playLayer = PlayLayer::get ();
213+
214+ LevelInfoLayer* lil = LevelInfoLayer::create (playLayer->m_level , false );
215+ lil->onLevelInfo (nullptr );
216+ }
217+ };
0 commit comments