From bf419aaa4442fc7a1ff476aff26c8c5aeb6132b6 Mon Sep 17 00:00:00 2001 From: Cvolton Date: Fri, 19 Jan 2024 20:55:48 +0100 Subject: [PATCH] add missing LevelInfoLayer IDs --- src/LevelInfoLayer.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/LevelInfoLayer.cpp b/src/LevelInfoLayer.cpp index 69ce8a7..9193053 100644 --- a/src/LevelInfoLayer.cpp +++ b/src/LevelInfoLayer.cpp @@ -218,4 +218,38 @@ struct LevelInfoLayerIDs : Modify { return true; } + + void updateLabelValues() { + LevelInfoLayer::updateLabelValues(); + + size_t coinIdx = 1; + for(auto& coin : CCArrayExt(m_coins)) { + coin->setID(fmt::format("coin-icon-{}", coinIdx++)); + } + } + + void setupPlatformerStats() { + LevelInfoLayer::setupPlatformerStats(); + + size_t labelOffset = 1; + if(m_level->m_bestPoints) { + static_cast(this->getChildren()->objectAtIndex(this->getChildrenCount() - labelOffset))->setID("points-label"); + labelOffset++; + } + + log::info("best time: {}", this->getChildren()->objectAtIndex(this->getChildrenCount() - labelOffset)); + static_cast(this->getChildren()->objectAtIndex(this->getChildrenCount() - labelOffset))->setID("best-time-label"); + labelOffset++; + } + + void setupProgressBars() { + LevelInfoLayer::setupProgressBars(); + + static_cast(this->getChildren()->objectAtIndex(this->getChildrenCount() - 1))->setID("practice-mode-label"); + static_cast(this->getChildren()->objectAtIndex(this->getChildrenCount() - 2))->setID("normal-mode-label"); + static_cast(this->getChildren()->objectAtIndex(this->getChildrenCount() - 3))->setID("practice-mode-percentage"); + static_cast(this->getChildren()->objectAtIndex(this->getChildrenCount() - 4))->setID("normal-mode-percentage"); + static_cast(this->getChildren()->objectAtIndex(this->getChildrenCount() - 5))->setID("practice-mode-bar"); + static_cast(this->getChildren()->objectAtIndex(this->getChildrenCount() - 6))->setID("normal-mode-bar"); + } }; \ No newline at end of file