| 38 | } |
| 39 | |
| 40 | void SimplePlayer::updateGamemode(int iconID, IconType mode) { |
| 41 | iconID = GameToolbox::inRange(iconID, 1, GameToolbox::getValueForGamemode(mode)); |
| 42 | |
| 43 | auto tipo = GameToolbox::getNameGamemode(mode); |
| 44 | |
| 45 | auto mainFrame = StringUtils::format("%s_%02d_001.png", tipo, iconID); |
| 46 | auto secFrame = StringUtils::format("%s_%02d_2_001.png", tipo, iconID); |
| 47 | auto extFrame = StringUtils::format("%s_%02d_extra_001.png", tipo, iconID); |
| 48 | auto glowFrame = StringUtils::format("%s_%02d_glow_001.png", tipo, iconID); |
| 49 | auto domeFrame = StringUtils::format("%s_%02d_3_001.png", tipo, iconID); |
| 50 | |
| 51 | if (m_pMainSprite) this->removeChild(m_pMainSprite); |
| 52 | if (m_pSecondarySprite) this->removeChild(m_pSecondarySprite); |
| 53 | if (m_pGlowSprite) this->removeChild(m_pGlowSprite); |
| 54 | if (m_pExtraSprite) this->removeChild(m_pExtraSprite); |
| 55 | if (m_pDomeSprite) this->removeChild(m_pDomeSprite); |
| 56 | |
| 57 | // Main Color |
| 58 | m_pMainSprite = Sprite::createWithSpriteFrameName(mainFrame); |
| 59 | if (!m_pMainSprite) m_pMainSprite = Sprite::createWithSpriteFrameName("GJ_arrow_03_001.png"); |
| 60 | m_pMainSprite->setAnchorPoint({ 0, 0 }); |
| 61 | m_pMainSprite->setStretchEnabled(false); |
| 62 | this->addChild(m_pMainSprite); |
| 63 | |
| 64 | // Second Color |
| 65 | m_pSecondarySprite = Sprite::createWithSpriteFrameName(secFrame); |
| 66 | if (!m_pSecondarySprite) m_pSecondarySprite = Sprite::createWithSpriteFrameName("GJ_arrow_03_001.png"); |
| 67 | m_pSecondarySprite->setPosition(m_pMainSprite->getContentSize() / 2); |
| 68 | m_pSecondarySprite->setStretchEnabled(false); |
| 69 | this->addChild(m_pSecondarySprite, -1); |
| 70 | |
| 71 | // Glow |
| 72 | m_pGlowSprite = Sprite::createWithSpriteFrameName(glowFrame); |
| 73 | if (!m_pGlowSprite) m_pGlowSprite = Sprite::createWithSpriteFrameName("GJ_arrow_03_001.png"); |
| 74 | m_pGlowSprite->setPosition(m_pMainSprite->getContentSize() / 2); |
| 75 | m_pGlowSprite->setStretchEnabled(false); |
| 76 | m_pGlowSprite->setVisible(m_bHasGlow); |
| 77 | this->addChild(m_pGlowSprite, -1); |
| 78 | |
| 79 | // Extra |
| 80 | m_pExtraSprite = Sprite::createWithSpriteFrameName(extFrame); |
| 81 | if (m_pExtraSprite) { |
| 82 | m_pExtraSprite->setPosition(this->m_pMainSprite->getContentSize() / 2); |
| 83 | m_pExtraSprite->setStretchEnabled(false); |
| 84 | this->addChild(m_pExtraSprite); |
| 85 | } |
| 86 | |
| 87 | // Dome |
| 88 | if (mode == IconType::kIconTypeUfo) { |
| 89 | m_pDomeSprite = Sprite::createWithSpriteFrameName(domeFrame); |
| 90 | if (m_pDomeSprite) { |
| 91 | m_pDomeSprite->setPosition(this->m_pMainSprite->getContentSize() / 2); |
| 92 | m_pDomeSprite->setStretchEnabled(false); |
| 93 | this->addChild(m_pDomeSprite, -1); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | this->updateIconColors(); |
no test coverage detected