| 241 | } |
| 242 | |
| 243 | void RewardUnlockLayer::showEarnedCurrency(int currencyID, int currencyCount, float delay, Vec2 position) |
| 244 | { |
| 245 | std::string_view currencySpriteName; |
| 246 | |
| 247 | float scale = 0; |
| 248 | float yoffset = 0; |
| 249 | float xoffset = 0; |
| 250 | |
| 251 | switch (currencyID) |
| 252 | { |
| 253 | case 1: |
| 254 | currencySpriteName = "currencyOrbIcon_001.png"; |
| 255 | scale = 1.2f; |
| 256 | break; |
| 257 | case 3: |
| 258 | currencySpriteName = "GJ_bigDiamond_001.png"; |
| 259 | scale = 0.65f; |
| 260 | break; |
| 261 | case 4: |
| 262 | currencySpriteName = "fireShardBig_001.png"; |
| 263 | break; |
| 264 | case 5: |
| 265 | currencySpriteName = "iceShardBig_001.png"; |
| 266 | break; |
| 267 | case 6: |
| 268 | currencySpriteName = "poisonShardBig_001.png"; |
| 269 | break; |
| 270 | case 7: |
| 271 | currencySpriteName = "shadowShardBig_001.png"; |
| 272 | break; |
| 273 | case 8: |
| 274 | currencySpriteName = "lavaShardBig_001.png"; |
| 275 | break; |
| 276 | case 9: |
| 277 | currencySpriteName = "GJ_bigKey_001.png"; |
| 278 | scale = 0.9f; |
| 279 | xoffset = 7.0f; |
| 280 | yoffset = -0.5f; |
| 281 | break; |
| 282 | } |
| 283 | |
| 284 | const auto& winSize = Director::getInstance()->getWinSize(); |
| 285 | |
| 286 | Sprite* currencySprite = Sprite::createWithSpriteFrameName(currencySpriteName); |
| 287 | |
| 288 | Label* label = Label::createWithBMFont(GameToolbox::getTextureString("bigFont.fnt"), fmt::format("+{}", currencyCount)); |
| 289 | |
| 290 | Node* currencyNode = Node::create(); |
| 291 | |
| 292 | this->addChild(currencyNode); |
| 293 | |
| 294 | currencyNode->addChild(label); |
| 295 | currencyNode->addChild(currencySprite); |
| 296 | currencyNode->setPosition(position); |
| 297 | currencyNode->setScale(2.f); |
| 298 | |
| 299 | label->setOpacity(0); |
| 300 | GameToolbox::limitLabelWidth(label, 40.0f, 0.7f, 0.0f); |
nothing calls this directly
no test coverage detected