Skip to content

Commit

Permalink
fix more bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alphalaneous committed Jul 25, 2024
1 parent 637d0e0 commit e7676f6
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 56 deletions.
12 changes: 11 additions & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"win": "2.206",
"android": "2.206"
},
"version": "v0.9.3",
"version": "v0.9.4",
"id": "zalphalaneous.minecraft",
"name": "Minecraftify!",
"developer": "Alphalaneous",
Expand Down Expand Up @@ -35,6 +35,16 @@
"id": "ninxout.redash",
"version": "*",
"importance": "breaking"
},
{
"id": "muhammadgames.bettermenu",
"version": "*",
"importance": "breaking"
},
{
"id": "sanes.daily-transfer",
"version": "*",
"importance": "breaking"
}
]
}
19 changes: 12 additions & 7 deletions src/ui/hooks/MenuLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,19 @@ class $modify(MenuLayer){
bottomMenu->getChildByIDRecursive("geode.loader/geode-button")->setVisible(false);
}
if(Loader::get()->isModLoaded("alphalaneous.pages_api")){
if(CCNode* rightSideMenu = this->getChildByIDRecursive("right-side-menu")){
if(AxisLayout* layout = typeinfo_cast<AxisLayout*>(rightSideMenu->getLayout())){
layout->setAxis(Axis::Row);
}
rightSideMenu->setContentSize({170, 70});
rightSideMenu->setUserObject("orientation", CCInteger::create(1));
rightSideMenu->removeChildByID("daily-chest-button");

Mod* mod = Loader::get()->getLoadedMod("alphalaneous.pages_api");

if(mod->getSettingValue<bool>("menulayer-right-menu")){
if(CCNode* rightSideMenu = this->getChildByIDRecursive("right-side-menu")){
if(AxisLayout* layout = typeinfo_cast<AxisLayout*>(rightSideMenu->getLayout())){
layout->setAxis(Axis::Row);
}
rightSideMenu->setContentSize({170, 70});
rightSideMenu->setUserObject("orientation", CCInteger::create(1));
rightSideMenu->removeChildByID("daily-chest-button");

}
}
}

Expand Down
82 changes: 35 additions & 47 deletions src/ui/layers/ExtrasLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,46 @@ bool ExtrasLayer::init() {
this->addChild(Utils::generateDirtBG());
m_menuLayer = typeinfo_cast<CCLayer*>(scene->getChildren()->objectAtIndex(0));

bool modifyRightMenu = true;
bool modifyBottomMenu = true;


if(Loader::get()->isModLoaded("alphalaneous.pages_api")){
if(CCMenu* rightMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("right-side-menu"))) {
rightMenu->setPosition({winSize.width/2, 150});
rightMenu->setVisible(true);
rightMenu->removeFromParentAndCleanup(false);
this->addChild(rightMenu);
}
if(CCMenu* pagedRightMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("paged-right-side-menu"))) {
this->addChild(pagedRightMenu);
}

if(m_bottomMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("bottom-menu"))) {
m_bottomMenu->setID("extras-menu"_spr);
m_bottomMenu->setPosition({winSize.width/2, 100});
m_bottomMenu->setVisible(true);
m_bottomMenu->removeFromParentAndCleanup(false);
this->addChild(m_bottomMenu);
Mod* mod = Loader::get()->getLoadedMod("alphalaneous.pages_api");

if(mod->getSettingValue<bool>("menulayer-right-menu")){
modifyRightMenu = false;
if(CCMenu* rightMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("right-side-menu"))) {
rightMenu->setPosition({winSize.width/2, 150});
rightMenu->setVisible(true);
rightMenu->removeFromParentAndCleanup(false);
this->addChild(rightMenu);
}
if(CCMenu* pagedRightMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("paged-right-side-menu"))) {
this->addChild(pagedRightMenu);
}
}

if(mod->getSettingValue<bool>("menulayer-bottom-menu")){
modifyBottomMenu = false;
if(m_bottomMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("bottom-menu"))) {
m_bottomMenu->setID("extras-menu"_spr);
m_bottomMenu->setPosition({winSize.width/2, 100});
m_bottomMenu->setVisible(true);
m_bottomMenu->removeFromParentAndCleanup(false);
this->addChild(m_bottomMenu);
}

if(CCMenu* pagedBottomtMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("paged-bottom-menu"))) {
this->addChild(pagedBottomtMenu);
if(CCMenu* pagedBottomtMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("paged-bottom-menu"))) {
this->addChild(pagedBottomtMenu);
}
}
}
else{

if(modifyRightMenu){
if(CCMenu* rightMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("right-side-menu"))) {
typeinfo_cast<ColumnLayout*>(rightMenu->getLayout())->setAxis(Axis::Row);
typeinfo_cast<AxisLayout*>(rightMenu->getLayout())->setAxis(Axis::Row);

rightMenu->removeChildByID("daily-chest-button");

Expand All @@ -63,17 +76,9 @@ bool ExtrasLayer::init() {
rightMenu->removeFromParent();
this->addChild(rightMenu);
}
//hacky shit to fix globed

CCMenu* dummyMenuToFixGlobed = CCMenu::create();
dummyMenuToFixGlobed->setID("bottom-menu");

CCSprite* dummySprite = CCSprite::create("select.png"_spr);
CCMenuItemSpriteExtra* dummyGlobed = CCMenuItemSpriteExtra::create(dummySprite, this, nullptr);
dummyGlobed->setID("dankmeme.globed2/main-menu-button");

dummyMenuToFixGlobed->addChild(dummyGlobed);
}

if(modifyBottomMenu){
if(m_bottomMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("bottom-menu"))) {
m_bottomMenu->setID("extras-menu"_spr);
m_bottomMenu->setContentSize({winSize.width, winSize.height/2});
Expand All @@ -93,9 +98,8 @@ bool ExtrasLayer::init() {
m_bottomMenu->removeFromParent();
this->addChild(m_bottomMenu);
}
m_menuLayer->addChild(dummyMenuToFixGlobed);
this->scheduleUpdate();
}


CCMenu* gdButtons = CCMenu::create();

Expand Down Expand Up @@ -173,22 +177,6 @@ void ExtrasLayer::onBack(CCObject* object) {
keyBackClicked();
}

//hacky shit to fix globed

void ExtrasLayer::update(float dt){

if(Loader::get()->isModLoaded("dankmeme.globed2")){

if(CCNode* button = m_bottomMenu->getChildByIDRecursive("dankmeme.globed2/main-menu-button")) {
if(!button){
CCScene* scene = ExtrasLayer::scene();
auto transition = CCTransitionFade::create(0.0f, scene);
CCDirector::sharedDirector()->replaceScene(transition);
}
}
}
}

CCScene* ExtrasLayer::scene() {
auto layer = ExtrasLayer::create();
auto scene = CCScene::create();
Expand Down
1 change: 0 additions & 1 deletion src/ui/layers/ExtrasLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class ExtrasLayer : public cocos2d::CCLayer {
virtual void keyBackClicked();
void onBack(cocos2d::CCObject*);
public:
void update(float dt);
void onNewgrounds(CCObject*);
static ExtrasLayer* create();
static cocos2d::CCScene* scene();
Expand Down

0 comments on commit e7676f6

Please sign in to comment.