MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / loadPageFromUserInfo

Method loadPageFromUserInfo

Source/ProfilePage.cpp:177–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175
176
177void ProfilePage::loadPageFromUserInfo(GJUserScore* score) // replace with 'GJUserScore* score'
178{
179 const auto& winSize = Director::getInstance()->getWinSize();
180
181 //GameToolbox::limitLabelWidth(playerName, 185.0f, 0.9f, 0.0f);
182
183 auto playerStatsNode = Node::create();
184 std::string_view statSpriteName;
185
186 bool hasCP = score->_creatorpoints > 0;
187 int statValue;
188 ax::Vec2 initialPos = ax::Vec2::ZERO;
189
190 float v16 = 0.0f;
191
192 for (int i = 0; i < (hasCP ? 6 : 5); i++)
193 {
194 switch (i)
195 {
196 case 1:
197 statSpriteName = "GJ_diamondsIcon_001.png";
198 statValue = score->_diamonds;
199 break;
200 case 2:
201 statSpriteName = "GJ_coinsIcon_001.png";
202 statValue = score->_secretCoins;
203 break;
204 case 3:
205 statSpriteName = "GJ_coinsIcon2_001.png";
206 statValue = score->_usercoins;
207 break;
208 case 4:
209 statSpriteName = "GJ_demonIcon_001.png";
210 statValue = score->_demons;
211 break;
212 case 5:
213 statSpriteName = "GJ_hammerIcon_001.png";
214 statValue = score->_creatorpoints;
215 break;
216 default:
217 statSpriteName = "GJ_starsIcon_001.png";
218 statValue = score->_stars;
219 break;
220 }
221 int widthLimit = hasCP ? 50 : 60;
222 std::string bigFontStr = GameToolbox::getTextureString("bigFont.fnt");
223 auto statLabel = Label::createWithBMFont(bigFontStr, std::to_string(statValue));
224 GameToolbox::limitLabelWidth(statLabel, widthLimit, 0.6, 0.0);
225 statLabel->setAnchorPoint({0.0f, 0.5f});
226 statLabel->setScale(0.6f);
227 statLabel->setPosition(initialPos);
228 playerStatsNode->addChild(statLabel);
229
230 auto statSprite = Sprite::createWithSpriteFrameName(statSpriteName);
231 playerStatsNode->addChild(statSprite);
232
233 auto labelPos = statLabel->getPosition();
234 auto scaledContentSize = statLabel->getContentSize();

Callers

nothing calls this directly

Calls 9

createFunction · 0.85
setScaleMethod · 0.80
setPositionMethod · 0.80
updateGamemodeMethod · 0.80
setGlowMethod · 0.80
setGlowColorMethod · 0.80
to_stringFunction · 0.50
setMainColorMethod · 0.45
setSecondaryColorMethod · 0.45

Tested by

no test coverage detected