Skip to content

Commit

Permalink
Disable "view leaderboard as" on Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Aug 25, 2023
1 parent 75ef933 commit f25edbb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
52 changes: 28 additions & 24 deletions src/hooks/ProfilePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,33 +144,37 @@ class $modify(BIProfilePage, ProfilePage) {
if(a2->m_userID != GameManager::sharedState()->m_playerUserID){
for(unsigned int i = 0; i < layer->getChildrenCount(); i++){
CCNode* node = dynamic_cast<CCNode*>(layer->getChildren()->objectAtIndex(i));
if(node != nullptr && node->getPositionX() == (winSize.width / 2) - 164 && node->getPositionY() == (winSize.height / 2) + 123) node->setVisible(false);
#ifndef GEODE_IS_MACOS
if(node != nullptr && node->getPositionX() == (winSize.width / 2) - 164 && node->getPositionY() == (winSize.height / 2) + 123) node->setVisible(false);
#endif
if(node != nullptr && node->getPositionX() == (winSize.width / 2) && node->getPositionY() == (winSize.height / 2) + 125) node->setVisible(false);
}

auto leaderboardButtonSprite = BetterInfo::createBISprite("BI_blankBtn_001.png");
auto leaderboardSprite = CCSprite::createWithSpriteFrameName(BetterInfo::rankIcon(a2->m_globalRank));
leaderboardSprite->setZOrder(1);
leaderboardSprite->setScale(1 / 0.6f);
if(a2->m_globalRank > 0) {
if(a2->m_globalRank <= 10) leaderboardSprite->setScale(1.1f);
else if(a2->m_globalRank <= 50) leaderboardSprite->setScale(1.25f);
else if(a2->m_globalRank <= 200) leaderboardSprite->setScale(1.3f);
else if(a2->m_globalRank <= 1000) leaderboardSprite->setScale(1 / 0.7f);
}
leaderboardSprite->setPosition({22.5f, 23});
leaderboardButtonSprite->addChild(leaderboardSprite);
leaderboardButtonSprite->setScale( (a2->m_globalRank <= 1000 && a2->m_globalRank > 0) ? 0.7f : 0.6f);
auto leaderboardButton = CCMenuItemSpriteExtra::create(
leaderboardButtonSprite,
this,
menu_selector(BIProfilePage::onProfilePageLeaderboard)
);
leaderboardButton->setID("bi-leaderboard-button");
menu->addChild(leaderboardButton);
leaderboardButton->setPosition({46, -12});
leaderboardButton->setSizeMult(1.2f);
this->m_buttons->addObject(leaderboardButton);
#ifndef GEODE_IS_MACOS
auto leaderboardButtonSprite = BetterInfo::createBISprite("BI_blankBtn_001.png");
auto leaderboardSprite = CCSprite::createWithSpriteFrameName(BetterInfo::rankIcon(a2->m_globalRank));
leaderboardSprite->setZOrder(1);
leaderboardSprite->setScale(1 / 0.6f);
if(a2->m_globalRank > 0) {
if(a2->m_globalRank <= 10) leaderboardSprite->setScale(1.1f);
else if(a2->m_globalRank <= 50) leaderboardSprite->setScale(1.25f);
else if(a2->m_globalRank <= 200) leaderboardSprite->setScale(1.3f);
else if(a2->m_globalRank <= 1000) leaderboardSprite->setScale(1 / 0.7f);
}
leaderboardSprite->setPosition({22.5f, 23});
leaderboardButtonSprite->addChild(leaderboardSprite);
leaderboardButtonSprite->setScale( (a2->m_globalRank <= 1000 && a2->m_globalRank > 0) ? 0.7f : 0.6f);
auto leaderboardButton = CCMenuItemSpriteExtra::create(
leaderboardButtonSprite,
this,
menu_selector(BIProfilePage::onProfilePageLeaderboard)
);
leaderboardButton->setID("bi-leaderboard-button");
menu->addChild(leaderboardButton);
leaderboardButton->setPosition({46, -12});
leaderboardButton->setSizeMult(1.2f);
this->m_buttons->addObject(leaderboardButton);
#endif

auto refreshSprite = CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png");
auto refreshButton = CCMenuItemSpriteExtra::create(
Expand Down
2 changes: 2 additions & 0 deletions src/managers/BetterInfoOnline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void BetterInfoOnline::loadScores(int accountID, bool force){
return;
}

#ifndef GEODE_IS_MACOS
//only on forced reload or if we dont have cached
CCHttpRequest* request = new CCHttpRequest;
request->setUrl("http://www.boomlings.com/database/getGJScores20.php");
Expand All @@ -40,6 +41,7 @@ void BetterInfoOnline::loadScores(int accountID, bool force){
request->setUserData(ccInt);
CCHttpClient::getInstance()->send(request);
//request->release();
#endif
}

void BetterInfoOnline::onScoresFinished(CCHttpClient* client, CCHttpResponse* response){
Expand Down

0 comments on commit f25edbb

Please sign in to comment.