Skip to content

Commit

Permalink
fix - bug, and stop mac from crashing on compile
Browse files Browse the repository at this point in the history
  • Loading branch information
FireMario211 committed Nov 6, 2023
1 parent 7eaa4c2 commit 228cafb
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 17 deletions.
15 changes: 15 additions & 0 deletions src/CreditsBetaMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,21 @@ CCLayer* CreditsBetaMenu::getPage(int pageNum) {
Icon3Link->setPosition({ 95, 44 });
menu->addChild(Icon3Link);

auto Icon4 = SimplePlayer::create(53);
auto firstColorIcon4 = ccColor3B {0, 125, 255};
auto secondColorIcon4 = ccColor3B {255,255,255};
Icon4->setChildColor(firstColorIcon4);
Icon4->setSecondColor(secondColorIcon4);
Icon4->setGlowOutline(true);
Icon4->setPosition({ -93, -58 });
page5betaSection->addChild(Icon4);
auto Icon4Label = CCLabelBMFont::create("SharKing09", "goldFont.fnt");
Icon4Label->setScale(.7F);
auto Icon4Link = CCMenuItemSpriteExtra::create(Icon4Label, this, menu_selector(CreditsBetaMenu::goToURL));
Icon4Link->setUserObject(CCString::create("https://www.google.com"));
Icon4Link->setPosition({ -93, -24 });
menu->addChild(Icon4Link);

menu->addChild(page5betaSection);
break;
}
Expand Down
24 changes: 19 additions & 5 deletions src/MoreLeaderboards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,30 @@ CCDictionary* MoreLeaderboards::responseToDict(const std::string& response){
std::stringstream responseStream(response);
std::string currentKey;
std::string keyID;
std::string playerID;
std::string username;
std::string accountID;

GameLevelManager* glm = GameLevelManager::sharedState();
unsigned int i = 0;
while(getline(responseStream, currentKey, ':')){

if(i % 2 == 0) keyID = currentKey;
else dict->setObject(CCString::create(currentKey.c_str()),keyID);

if(i % 2 == 0) {
keyID = currentKey;
} else {
if (keyID == "2") { // Player ID
playerID = currentKey;
} else if (keyID == "16") {
accountID = currentKey;
} else if (keyID == "1") {
username = currentKey;
}
dict->setObject(CCString::create(currentKey.c_str()),keyID);
}
i++;
}

if (playerID.length() > 0 && username.length() > 0 && accountID.length() > 0) {
glm->storeUserName(std::stoi(playerID), std::stoi(accountID), username);
}
return dict;
}

Expand Down
4 changes: 2 additions & 2 deletions src/MoreLeaderboardsCell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ void MoreLeaderboardsCell::loadFromDict(cocos2d::CCDictionary* content) //
auto discordBtn = CCMenuItemSpriteExtra::create(
discordSpr,
this,
menu_selector(MoreLeaderboardsCell::callback_link)
);
menu_selector(MoreLeaderboardsCell::callback_link)
);
auto discord_link = CCString::create(name);
discordBtn->setUserObject(discord_link);
mediaMenu->addChild(discordBtn);
Expand Down
21 changes: 11 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,10 @@ class $modify(CustomLevelInfo, LevelInfoLayer) {
demonSpr->setVisible(false);
this->addChild(demonSpr);
this->addChild(positionLabel);
if (level->m_coins > 0) {
positionLabel->setPositionY(positionLabel->getPositionY() - 18);
demonSpr->setPositionY(demonSpr->getPositionY() - 18);
}
int levelID = level->m_levelID.value();
if (exists(levelID)) {
int position = get(levelID);
Expand Down Expand Up @@ -932,15 +936,13 @@ class $modify(CustomLevelInfo, LevelInfoLayer) {
} else {
auto info = json.get<json::Value>(0);
auto position = info.get<int>("position");
if (position != NULL) {
moveCoinsDown(level);
positionLabel->setString(fmt::format("#{}", position).c_str());
positionLabel->setScale(getScaleBasedPos(position));
positionLabel->setVisible(true);
demonSpr->setVisible(true);
set(levelID, position);
log::info(fmt::format("Level found in Pointercrate! {} at #{}", level->m_levelName, position));
}
//moveCoinsDown(level);
positionLabel->setString(fmt::format("#{}", position).c_str());
positionLabel->setScale(getScaleBasedPos(position));
positionLabel->setVisible(true);
demonSpr->setVisible(true);
set(levelID, position);
log::info(fmt::format("Level found in Pointercrate! {} at #{}", level->m_levelName, position));
}
})
.expect([this, loading_circle](std::string const& error) {
Expand All @@ -953,7 +955,6 @@ class $modify(CustomLevelInfo, LevelInfoLayer) {
nullptr,
350.0F
)->show();
FLAlertLayer::create("Error", "lmao", "OK")->show();
});
}

Expand Down

0 comments on commit 228cafb

Please sign in to comment.