Skip to content

Commit

Permalink
fix up ChallengesPage IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Feb 23, 2024
1 parent 600f33b commit 758701b
Showing 1 changed file with 56 additions and 17 deletions.
73 changes: 56 additions & 17 deletions src/ChallengesPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,66 @@ using namespace geode::node_ids;

$register_ids(ChallengesPage) {

auto challengesLayer = static_cast<cocos2d::CCLayer*>(this->getChildren()->objectAtIndex(0));
auto winSize = CCDirector::get()->getWinSize();

m_mainLayer->setID("main-layer");

getChildOfType<cocos2d::extension::CCScale9Sprite>(challengesLayer, 0)->setID("background");
auto topMenu = getChildOfType<cocos2d::CCMenu>(challengesLayer, 0);
topMenu->setID("top-menu");
topMenu->setLayout(
RowLayout::create()
->setGap(370.f)
->setGrowCrossAxis(true)
getChildOfType<cocos2d::extension::CCScale9Sprite>(m_mainLayer, 0)->setID("background");
getChildOfType<LoadingCircle>(m_mainLayer, 0)->setID("loading-circle");

setIDs(
m_mainLayer,
1,
"bottom-left-art",
"top-left-art",
"top-right-art",
"bottom-right-art"
);
topMenu->updateLayout();
topMenu->setPositionX(285);
getChildOfType<ChallengeNode>(challengesLayer, 0)->setID("top-quest");
getChildOfType<ChallengeNode>(challengesLayer, 1)->setID("middle-quest");
getChildOfType<ChallengeNode>(challengesLayer, 2)->setID("bottom-quest");
getChildOfType<cocos2d::CCLabelBMFont>(challengesLayer, 0)->setID("new-quest-label");
getChildOfType<cocos2d::CCLabelBMFont>(challengesLayer, 1)->setID("top-quest-indicator");
getChildOfType<cocos2d::CCLabelBMFont>(challengesLayer, 2)->setID("middle-quest-indicator");
getChildOfType<cocos2d::CCLabelBMFont>(challengesLayer, 3)->setID("bottom-quest-indicator");

if(auto topMenu = getChildOfType<cocos2d::CCMenu>(m_mainLayer, 0)) {
setIDs(
topMenu,
0,
"close-button",
"info-button"
);

auto infoMenu = detachAndCreateMenu(
m_mainLayer,
"top-right-menu",
ColumnLayout::create()
->setAxisReverse(true)
->setAxisAlignment(AxisAlignment::End),
topMenu->getChildByID("info-button")
);
infoMenu->setContentSize({ 60.f, 120.f });
infoMenu->setPositionY(
infoMenu->getPositionY() - 120.f / 2 +
infoMenu->getChildByID("info-button")->getScaledContentSize().height / 2
);
infoMenu->updateLayout();

topMenu->setID("top-left-menu");
topMenu->setLayout(
ColumnLayout::create()
->setAxisReverse(true)
->setAxisAlignment(AxisAlignment::End)
);
topMenu->setContentSize({ 60.f, 120.f });
topMenu->setPositionY(
topMenu->getPositionY() - 120.f / 2 +
topMenu->getChildByID("close-button")->getScaledContentSize().height / 2
);
topMenu->updateLayout();
//topMenu->setPositionX(285);
}
getChildOfType<ChallengeNode>(m_mainLayer, 0)->setID("top-quest");
getChildOfType<ChallengeNode>(m_mainLayer, 1)->setID("middle-quest");
getChildOfType<ChallengeNode>(m_mainLayer, 2)->setID("bottom-quest");
getChildOfType<cocos2d::CCLabelBMFont>(m_mainLayer, 0)->setID("new-quest-label");
getChildOfType<cocos2d::CCLabelBMFont>(m_mainLayer, 1)->setID("top-quest-indicator");
getChildOfType<cocos2d::CCLabelBMFont>(m_mainLayer, 2)->setID("middle-quest-indicator");
getChildOfType<cocos2d::CCLabelBMFont>(m_mainLayer, 3)->setID("bottom-quest-indicator");

};

Expand Down

0 comments on commit 758701b

Please sign in to comment.