@@ -9,47 +9,84 @@ bool isSettingEnabled(std::string setting) {
99 return Mod::get ()->getSettingValue <bool >(setting);
1010}
1111
12+ void kys (CCNode* victim) {
13+ victim->setVisible (false );
14+ }
15+
16+ void ignoreInvisible (CCNode* menu) {
17+ if (!menu) return ;
18+
19+ auto layout = menu->getLayout ();
20+ if (!layout) return ;
21+
22+ layout->ignoreInvisibleChildren (true );
23+ }
24+
1225class $modify(MyMenuLayer, MenuLayer) {
13- bool init () override {
26+ bool init () {
1427 if (!MenuLayer::init ()) {
1528 return false ;
1629 }
1730
18- auto const bottomMenu = this ->getChildByID (" bottom-menu" );
19- auto const socialMediaMenu = this ->getChildByID (" social-media-menu" );
20- auto const moreGamesMenu = this ->getChildByID (" more-games-menu" );
31+ auto bottomMenu = this ->getChildByID (" bottom-menu" );
32+ auto socialMediaMenu = this ->getChildByID (" social-media-menu" );
33+ auto moreGamesMenu = this ->getChildByID (" more-games-menu" );
34+
35+ ignoreInvisible (bottomMenu);
2136
2237 if (isSettingEnabled (" hide-newgrounds-button" )) {
23- bottomMenu->removeChildByID (" newgrounds-button" );
38+ auto ngBtn = bottomMenu->getChildByID (" newgrounds-button" );
39+
40+ kys (ngBtn);
41+
2442 bottomMenu->updateLayout ();
2543 }
2644
27- if (isSettingEnabled (" hide-social-media-buttons" )) {
28- socialMediaMenu->removeChildByID (" facebook-button" );
29- socialMediaMenu->removeChildByID (" twitter-button" );
30- socialMediaMenu->removeChildByID (" youtube-button" );
31- socialMediaMenu->removeChildByID (" twitch-button" );
32- socialMediaMenu->removeChildByID (" discord-button" );
45+ if (isSettingEnabled (" hide-social-media-buttons" ) && socialMediaMenu) {
46+ auto fbBtn = socialMediaMenu->getChildByID (" facebook-button" );
47+ auto twitterBtn = socialMediaMenu->getChildByID (" twitter-button" );
48+ auto ytBtn = socialMediaMenu->getChildByID (" youtube-button" );
49+ auto twitchBtn = socialMediaMenu->getChildByID (" twitch-button" );
50+ auto discordBtn = socialMediaMenu->getChildByID (" discord-button" );
51+
52+ ignoreInvisible (socialMediaMenu);
53+
54+ kys (fbBtn);
55+ kys (twitterBtn);
56+ kys (ytBtn);
57+ kys (twitchBtn);
58+ kys (discordBtn);
59+
3360 socialMediaMenu->updateLayout ();
3461 }
35-
62+
3663 if (isSettingEnabled (" hide-robtop-logo" )) {
37- socialMediaMenu->removeChildByID (" robtop-logo-button" );
64+ auto robtopBtn = socialMediaMenu->getChildByID (" robtop-logo-button" );
65+
66+ ignoreInvisible (socialMediaMenu);
67+
68+ kys (robtopBtn);
69+
3870 socialMediaMenu->updateLayout ();
3971 }
40- else if (isSettingEnabled (" hide-social-media-buttons" )) {
72+ else if (isSettingEnabled (" hide-social-media-buttons" ) && isSettingEnabled ( " reposition-robtop-logo " ) ) {
4173 CCNode* const robtopButtonNode = socialMediaMenu->getChildByID (" robtop-logo-button" );
4274 CCNode* const bottomMenuButton = bottomMenu->getChildByID (" settings-button" );
4375 robtopButtonNode->setPositionY (bottomMenuButton->getPositionY ());
44- socialMediaMenu->updateLayout ();
4576 }
4677
47- #ifdef GEODE_IS_ANDROID
78+ #ifdef GEODE_IS_MOBILE
4879 if (Loader::get ()->isModLoaded (" geode.devtools" ))
4980 return true ;
5081#endif
82+
5183 if (isSettingEnabled (" hide-more-games-button" )) {
52- moreGamesMenu->removeChildByID (" more-games-button" );
84+ auto moreGamesButton = moreGamesMenu->getChildByID (" more-games-button" );
85+
86+ ignoreInvisible (moreGamesMenu);
87+
88+ kys (moreGamesButton);
89+
5390 moreGamesMenu->updateLayout ();
5491 }
5592
@@ -66,13 +103,15 @@ class $modify(MyCreatorLayer, CreatorLayer) {
66103
67104 if (!creatorButtonsMenu) return true ;
68105
106+ ignoreInvisible (creatorButtonsMenu);
107+
69108 auto versusButton = creatorButtonsMenu->getChildByID (" versus-button" );
70109 auto mapButton = creatorButtonsMenu->getChildByID (" map-button" );
71110
72111 if (isSettingEnabled (" hide-versus-button" ))
73- versusButton-> removeMeAndCleanup ( );
112+ kys (versusButton );
74113 if (isSettingEnabled (" hide-map-button" ))
75- mapButton-> removeMeAndCleanup ( );
114+ kys (mapButton );
76115 creatorButtonsMenu->updateLayout ();
77116 return true ;
78117 }
0 commit comments