Skip to content

Commit

Permalink
make comma separated counts more consistent in chest history
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Dec 8, 2024
1 parent f1df55e commit 2ca0f5a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
10 changes: 0 additions & 10 deletions src/hooks/LevelInfoLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,6 @@ class BI_DLL $modify(LevelInfoLayer) {
this->release();
});
}).detach();

/**
* Update download and like labels
*/
/*m_downloadsLabel->setString(fmt::format(std::locale("en_US.UTF-8"), "{:L}", m_level->m_downloads).c_str());
m_likesLabel->setString(fmt::format(std::locale("en_US.UTF-8"), "{:L}", m_level->m_likes).c_str());
m_downloadsLabel->limitLabelWidth(60.f, .5f, 0.f);
m_likesLabel->limitLabelWidth(60.f, .5f, 0.f);
log::info("m_songIDs: {}", m_level->m_songIDs);*/
}

void onViewProfile(CCObject* sender) {
Expand Down
2 changes: 1 addition & 1 deletion src/layers/RewardHistory/RewardCategoryCell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void RewardCategoryCell::loadFromData(CCObject* object) {
lastSprite->setAnchorPoint({0, 0.5f});
this->m_mainLayer->addChild(lastSprite);

lastText = CCLabelBMFont::create(fmt::format(std::locale("en_US.UTF-8"), "{:L}", count).c_str(), "bigFont.fnt");
lastText = CCLabelBMFont::create(BetterInfo::numberComma(count).c_str(), "bigFont.fnt");
lastText->setAnchorPoint({ 0.0f, 0.5f });
lastText->setPosition({lastSprite->getPositionX() + ((lastSprite->getContentSize().width) * lastSprite->getScaleX()) + 5, rowY});
lastText->setScale(.325f);
Expand Down
2 changes: 1 addition & 1 deletion src/layers/RewardHistory/RewardCell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void RewardCell::loadFromData(CCObject* object) {
//lastSprite->setAnchorPoint({0, 0.5f});
menu->addChild(lastSprite);

lastText = CCLabelBMFont::create(CCString::createWithFormat("%i", rewardObj->m_total)->getCString(), "bigFont.fnt");
lastText = CCLabelBMFont::create(BetterInfo::numberComma(rewardObj->m_total).c_str(), "bigFont.fnt");
lastText->setAnchorPoint({ 0.f, 0.5f });
lastText->setPosition({lastSprite->getPositionX() + (lastSprite->getScaledContentWidth() / 2) + 5, 0});
lastText->setScale(.325f);
Expand Down
4 changes: 4 additions & 0 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,10 @@ long long BetterInfo::strtol(std::string_view str) {
return result;
}

std::string BetterInfo::numberComma(int number) {
return fmt::format(std::locale("en_US.UTF-8"), "{:L}", number);
}

static std::vector<Ref<Notification>> s_notifications;
void BetterInfo::showUnimportantNotification(const std::string& content, NotificationIcon icon, float time) {
if(GJBaseGameLayer::get()) return;
Expand Down
1 change: 1 addition & 0 deletions src/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ namespace BetterInfo {
BI_DLL int stoi(std::string_view str);
BI_DLL float stof(std::string_view str);
BI_DLL long long strtol(std::string_view str);
BI_DLL std::string numberComma(int number);

BI_DLL void showUnimportantNotification(const std::string& content, NotificationIcon icon, float time = 5.f);
BI_DLL void cancelUnimportantNotifications();
Expand Down

0 comments on commit 2ca0f5a

Please sign in to comment.