Skip to content

Commit

Permalink
Fix LevelInfoLayer node IDs and ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Jan 20, 2024
1 parent 27974fa commit f2f932d
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/LevelInfoLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ using namespace geode::node_ids;
leftSideMenu->setPosition(30.f, winSize.height / 2);
leftSideMenu->setLayout(ColumnLayout::create());
leftSideMenu->setID("left-side-menu");
leftSideMenu->setContentSize({ 50.f, 225.f });
leftSideMenu->setContentSize({ 50.f, 145.f });
this->addChild(leftSideMenu);

menu->setPosition(winSize.width - 30.f, winSize.height / 2);
Expand Down Expand Up @@ -142,7 +142,26 @@ using namespace geode::node_ids;
->setAxisReverse(true)
);

setIDSafe(leftSideMenu, 0, "copy-button");
auto GM = GameManager::sharedState();
auto GJA = GJAccountManager::sharedState();
size_t leftMenuIdx = 0;
if(GM->m_hasRP == 1 || GM->m_hasRP == 2) {
setIDSafe(leftSideMenu, leftMenuIdx, "mod-rate-button");
leftMenuIdx++;
}

if(GM->m_hasRP > 0) {
setIDSafe(menu, menu->getChildrenCount() - 1, "delete-button");
}else if(GM->m_playerUserID == m_level->m_userID || (GJA->m_accountID == m_level->m_accountID && GJA->m_accountID != 0)) {
setIDSafe(leftSideMenu, leftMenuIdx, "delete-button");
leftMenuIdx++;
}
//if above if OR if password != 0 (the 2nd condition is inlined in some weird way into the addChild call)
setIDSafe(leftSideMenu, leftMenuIdx, "copy-button");

if(auto btn = leftSideMenu->getChildByID("mod-rate-button")) btn->setZOrder(-1);
if(auto btn = leftSideMenu->getChildByID("delete-button")) btn->setZOrder(-2);
if(auto btn = leftSideMenu->getChildByID("copy-button")) btn->setZOrder(-3);

menu->updateLayout();
leftSideMenu->updateLayout();
Expand Down

0 comments on commit f2f932d

Please sign in to comment.