Skip to content

Commit

Permalink
fix the compile errors at least
Browse files Browse the repository at this point in the history
  • Loading branch information
altalk23 committed Feb 16, 2024
1 parent 631fd43 commit 200a5c8
Showing 1 changed file with 33 additions and 31 deletions.
64 changes: 33 additions & 31 deletions src/EndLevelLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,37 @@ inline CCNode* getChildBySpriteFrameName(CCNode* parent, const char* name) {
return nullptr;
}

namespace {
void handleContainers(EndLevelLayer* self) {
for (auto child : CCArrayExt<CCNode*>(self->m_mainLayer->getChildren())) {
if (auto star = ::getChildBySpriteFrameName(child, "GJ_bigStar_001.png")) {
child->setID("star-container");
star->setID("star-sprite");
getChildOfType<CCLabelBMFont>(child, 0)->setID("star-label");
}
else if (auto star = ::getChildBySpriteFrameName(child, "GJ_bigMoon_001.png")) {
child->setID("moon-container");
star->setID("moon-sprite");
getChildOfType<CCLabelBMFont>(child, 0)->setID("moon-label");
}
else if (auto star = ::getChildBySpriteFrameName(child, "currencyOrbIcon_001.png")) {
child->setID("orb-container");
star->setID("orb-sprite");
getChildOfType<CCLabelBMFont>(child, 0)->setID("orb-label");
}
else if (auto star = ::getChildBySpriteFrameName(child, "GJ_bigDiamond_001.png")) {
child->setID("diamond-container");
star->setID("diamond-sprite");
getChildOfType<CCLabelBMFont>(child, 0)->setID("diamond-label");
}
}
}
}

$register_ids(EndLevelLayer) {
if (!m_mainLayer->getID().empty()) {
goto container_ids;
handleContainers(this);
return;
}

m_mainLayer->setID("main-layer");
Expand Down Expand Up @@ -88,9 +116,8 @@ inline CCNode* getChildBySpriteFrameName(CCNode* parent, const char* name) {
}
}

auto potentialEndText = m_mainLayer->getChildren()->objectAtIndex(idx);
if (!typeinfo_cast<TextArea*>(potentialEndText)) {
potentialEndText->setID("end-text");
if (auto endText = typeinfo_cast<CCLabelBMFont*>(m_mainLayer->getChildren()->objectAtIndex(idx))) {
endText->setID("end-text");
idx += 1;
}

Expand Down Expand Up @@ -141,31 +168,6 @@ inline CCNode* getChildBySpriteFrameName(CCNode* parent, const char* name) {
);
idx += 2;
}

container_ids:

for (auto child : CCArrayExt<CCNode*>(m_mainLayer->getChildren())) {
if (auto star = ::getChildBySpriteFrameName(child, "GJ_bigStar_001.png")) {
child->setID("star-container");
star->setID("star-sprite");
getChildOfType<CCLabelBMFont>(child, 0)->setID("star-label");
}
else if (auto star = ::getChildBySpriteFrameName(child, "GJ_bigMoon_001.png")) {
child->setID("moon-container");
star->setID("moon-sprite");
getChildOfType<CCLabelBMFont>(child, 0)->setID("moon-label");
}
else if (auto star = ::getChildBySpriteFrameName(child, "currencyOrbIcon_001.png")) {
child->setID("orb-container");
star->setID("orb-sprite");
getChildOfType<CCLabelBMFont>(child, 0)->setID("orb-label");
}
else if (auto star = ::getChildBySpriteFrameName(child, "GJ_bigDiamond_001.png")) {
child->setID("diamond-container");
star->setID("diamond-sprite");
getChildOfType<CCLabelBMFont>(child, 0)->setID("diamond-label");
}
}
}

struct EndLevelLayerIDs : Modify<EndLevelLayerIDs, EndLevelLayer> {
Expand All @@ -175,8 +177,8 @@ struct EndLevelLayerIDs : Modify<EndLevelLayerIDs, EndLevelLayer> {
}
}

void customSetup(bool p0) {
EndLevelLayer::customSetup(p0);
void customSetup() {
EndLevelLayer::customSetup();

NodeIDs::get()->provide(this);
}
Expand Down

0 comments on commit 200a5c8

Please sign in to comment.