Skip to content

Commit

Permalink
Merge #23 v1.1.1
Browse files Browse the repository at this point in the history
# v1.1.1
- The old search menu can be opened with a click on a green arrow on the bottom right of the search popup
- Android users can finally input the correct amount of characters into text fields
- Old tier label displays on top of the epic/legendary/mythic fire
- The tier button/label is given a texture/color and content that matches the tier in the local cache, making it feel like the rating is instantly loaded
  • Loading branch information
B1rtek authored Feb 19, 2024
2 parents 06ca1b2 + b8f63e7 commit f01c31f
Show file tree
Hide file tree
Showing 18 changed files with 537 additions and 410 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ You can search for levels based on their tier or enjoyment rating, completion st

![Example of the new search menu](resources/search.png)

If you prefer, you can switch to a simpler search menu using the green arrow button in the bottom right corner

![Example of the old search menu](resources/old_search.png)

Adds a button on your profile that shows how many demons of each tier you've beaten

![Another example visible only to those who downloaded this mod](resources/split.png)
Expand All @@ -29,5 +33,5 @@ If you encounter any other issues, contact me on Discord (<cb>@b1rtek</c>) or on
## Special thanks

<cb>*Code contributions:*</c> <cy>**[Diversion](https://github.com/B1rtek/Geode-GDDLIntegration/pull/3)**</c>
<cg>*Feature suggestions:*</c> <cy>[MasterGamerY](https://github.com/B1rtek/Geode-GDDLIntegration/issues/1), [Weebifying](https://github.com/B1rtek/Geode-GDDLIntegration/pull/2), [averiee_](https://github.com/B1rtek/Geode-GDDLIntegration/milestone/4), [TheSuperJepphyKiller](https://github.com/B1rtek/Geode-GDDLIntegration/issues/6), [hoshinekosanti](https://github.com/B1rtek/Geode-GDDLIntegration/issues/11), [epicmushroom.](https://github.com/B1rtek/Geode-GDDLIntegration/issues/15)</c>
<cr>*Bug reporters:*</c> <cy>croozington, bllue, [Fleeym](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780380), [matcool](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780699), [Lexicon](https://github.com/B1rtek/Geode-GDDLIntegration/issues/7), [patrick61804](https://github.com/B1rtek/Geode-GDDLIntegration/issues/16)</c>
<cg>*Feature suggestions:*</c> <cy>[MasterGamerY](https://github.com/B1rtek/Geode-GDDLIntegration/issues/1), [Weebifying](https://github.com/B1rtek/Geode-GDDLIntegration/pull/2), [averiee_](https://github.com/B1rtek/Geode-GDDLIntegration/milestone/4), [TheSuperJepphyKiller](https://github.com/B1rtek/Geode-GDDLIntegration/issues/6), [hoshinekosanti](https://github.com/B1rtek/Geode-GDDLIntegration/issues/11), [epicmushroom.](https://github.com/B1rtek/Geode-GDDLIntegration/issues/15), [Koble](https://github.com/B1rtek/Geode-GDDLIntegration/issues/21)</c>
<cr>*Bug reporters:*</c> <cy>croozington, bllue, [Fleeym](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780380), [matcool](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780699), [Lexicon](https://github.com/B1rtek/Geode-GDDLIntegration/issues/7), [patrick61804](https://github.com/B1rtek/Geode-GDDLIntegration/issues/16), [epicmushroom.](https://github.com/B1rtek/Geode-GDDLIntegration/issues/20)</c>
8 changes: 6 additions & 2 deletions about.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ You can search for levels based on their tier or enjoyment rating, completion st

![Example of the new search menu](b1rtek.gddlintegration/search.png)

If you prefer, you can switch to a simpler search menu using the green arrow button in the bottom right corner

![Example of the old search menu](b1rtek.gddlintegration/old_search.png)

Adds a button on your profile that shows how many demons of each tier you've beaten

![Another example visible only to those who downloaded this mod](b1rtek.gddlintegration/split.png)
Expand All @@ -29,5 +33,5 @@ If you encounter any other issues, contact me on Discord (<cb>@b1rtek</c>) or on
## Special thanks

<cb>*Code contributions:*</c> <cy>**[Diversion](https://github.com/B1rtek/Geode-GDDLIntegration/pull/3)**</c>
<cg>*Feature suggestions:*</c> <cy>[MasterGamerY](https://github.com/B1rtek/Geode-GDDLIntegration/issues/1), [Weebifying](https://github.com/B1rtek/Geode-GDDLIntegration/pull/2), [averiee_](https://github.com/B1rtek/Geode-GDDLIntegration/milestone/4), [TheSuperJepphyKiller](https://github.com/B1rtek/Geode-GDDLIntegration/issues/6), [hoshinekosanti](https://github.com/B1rtek/Geode-GDDLIntegration/issues/11), [epicmushroom.](https://github.com/B1rtek/Geode-GDDLIntegration/issues/15)</c>
<cr>*Bug reporters:*</c> <cy>croozington, bllue, [Fleeym](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780380), [matcool](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780699), [Lexicon](https://github.com/B1rtek/Geode-GDDLIntegration/issues/7), [patrick61804](https://github.com/B1rtek/Geode-GDDLIntegration/issues/16)</c>
<cg>*Feature suggestions:*</c> <cy>[MasterGamerY](https://github.com/B1rtek/Geode-GDDLIntegration/issues/1), [Weebifying](https://github.com/B1rtek/Geode-GDDLIntegration/pull/2), [averiee_](https://github.com/B1rtek/Geode-GDDLIntegration/milestone/4), [TheSuperJepphyKiller](https://github.com/B1rtek/Geode-GDDLIntegration/issues/6), [hoshinekosanti](https://github.com/B1rtek/Geode-GDDLIntegration/issues/11), [epicmushroom.](https://github.com/B1rtek/Geode-GDDLIntegration/issues/15), [Koble](https://github.com/B1rtek/Geode-GDDLIntegration/issues/21)</c>
<cr>*Bug reporters:*</c> <cy>croozington, bllue, [Fleeym](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780380), [matcool](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780699), [Lexicon](https://github.com/B1rtek/Geode-GDDLIntegration/issues/7), [patrick61804](https://github.com/B1rtek/Geode-GDDLIntegration/issues/16), [epicmushroom.](https://github.com/B1rtek/Geode-GDDLIntegration/issues/20)</c>
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.1.1
- The old search menu can be opened with a click on a green arrow on the bottom right of the search popup
- Android users can finally input the correct amount of characters into text fields
- Old tier label displays on top of the epic/legendary/mythic fire
- The tier button/label is given a texture/color and content that matches the tier in the local cache, making it feel like the rating is instantly loaded

# v1.1.0
- The search menu has been replaced by a much better one that allows the user to take full advantage of the GDDL API
- Results in the GDDL Demon Split displayed in the level list after clicking a tier are now accurate according to the data in the GDDL API (that's why the numbers might not match, as the counts are generated using local cache)
Expand Down
3 changes: 2 additions & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"geode": "2.0.0",
"version": "v1.1.0",
"version": "v1.1.1",
"gd": {
"android": "2.205",
"win": "2.204"
Expand All @@ -26,6 +26,7 @@
"resources/tier.png",
"resources/split.png",
"resources/search.png",
"resources/old_search.png",
"resources/tiers/*.png"
]
},
Expand Down
Binary file added resources/old_search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 27 additions & 23 deletions src/GDDLDemonSplitLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
bool GDDLDemonSplitLayer::init() {
if(!FLAlertLayer::init(75)) return false; // that magic number is actualy bg opacity btw

CCPoint popupSize = {360.0f, 200.0f};
auto winSize = CCDirector::sharedDirector()->getWinSize();
const CCPoint popupSize = {360.0f, 200.0f};
const auto winSize = CCDirector::sharedDirector()->getWinSize();
// background
auto bg = CCScale9Sprite::create("GJ_square02.png", {0.0f, 0.0f, 80.0f, 80.0f});
const auto bg = CCScale9Sprite::create("GJ_square02.png", {0.0f, 0.0f, 80.0f, 80.0f});
bg->setContentSize(popupSize);
bg->setPosition({ winSize.width / 2, winSize.height / 2 });
bg->setID("gddl-demon-split-bg"_spr);
Expand All @@ -22,16 +22,16 @@ bool GDDLDemonSplitLayer::init() {
m_buttonMenu->setLayout(ColumnLayout::create()->setGap(5.0f)->setAxisReverse(true)->setAutoScale(true));
m_mainLayer->addChild(m_buttonMenu, 10);
// title
auto titleContainer = CCMenu::create();
const auto titleContainer = CCMenu::create();
titleContainer->setLayout(RowLayout::create());
titleContainer->setContentSize({200.0f, 30.0f});
auto title = CCLabelBMFont::create("GDDL Demon Split", "goldFont.fnt");
const auto title = CCLabelBMFont::create("GDDL Demon Split", "goldFont.fnt");
title->setID("gddl-demon-split-title"_spr);
titleContainer->addChild(title);
// the (i) button
auto iButtonSprite = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
const auto iButtonSprite = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
iButtonSprite->setScale(0.5f);
auto iButton = CCMenuItemSpriteExtra::create(iButtonSprite, this, menu_selector(GDDLDemonSplitLayer::onInfo));
const auto iButton = CCMenuItemSpriteExtra::create(iButtonSprite, this, menu_selector(GDDLDemonSplitLayer::onInfo));
iButton->setScale(0.4f);
iButton->setContentSize({10.0f, 10.0f});
titleContainer->addChild(iButton);
Expand All @@ -41,20 +41,20 @@ bool GDDLDemonSplitLayer::init() {

// this is where the tiers go
for (int row = 0; row < 5; row++) {
auto rowNode = CCNode::create();
const auto rowNode = CCNode::create();
rowNode->setLayout(RowLayout::create()->setGap(5.0f));
rowNode->setContentSize({350.0f, 20.0f});
for (int column = 0; column < 7; column++) {
auto tierNode = createTierNode(row+1+column*5);
const auto tierNode = createTierNode(row+1+column*5);
rowNode->addChild(tierNode);
}
rowNode->updateLayout();
m_buttonMenu->addChild(rowNode);
m_buttonMenu->reorderChild(rowNode, row+1);
}
// ok button
auto spr = ButtonSprite::create("OK");
auto okButton = CCMenuItemSpriteExtra::create(spr, this, menu_selector(GDDLDemonSplitLayer::onClose));
const auto spr = ButtonSprite::create("OK");
const auto okButton = CCMenuItemSpriteExtra::create(spr, this, menu_selector(GDDLDemonSplitLayer::onClose));
okButton->setID("gddl-demon-split-ok"_spr);
m_buttonMenu->addChild(okButton);
m_buttonMenu->reorderChild(okButton, 10);
Expand All @@ -71,11 +71,13 @@ void GDDLDemonSplitLayer::onClose(cocos2d::CCObject *sender) {
removeFromParentAndCleanup(true);
}

void GDDLDemonSplitLayer::onInfo(cocos2d::CCObject *sender) {
// ReSharper disable once CppMemberFunctionMayBeStatic
void GDDLDemonSplitLayer::onInfo(cocos2d::CCObject *sender) { // NOLINT(*-convert-member-functions-to-static)
std::map<int, int> tierStats = RatingsManager::getTierStats();
int total = 0;
for (auto tierCountPair: tierStats) {
total += tierCountPair.second;
// ReSharper disable once CppUseElementsView
for (const auto [tier, count]: tierStats) {
total += count;
}
const int unrated = tierStats[-1];
const std::string message = "Not accounting for <cb>official levels</c>, <co>gauntlet levels</c> and <cy>weekly "
Expand All @@ -85,31 +87,32 @@ void GDDLDemonSplitLayer::onInfo(cocos2d::CCObject *sender) {
FLAlertLayer::create("GDDL Demon Split", message.c_str(), "OK")->show();
}

void GDDLDemonSplitLayer::onTierSearch(cocos2d::CCObject *sender) {
// ReSharper disable once CppMemberFunctionMayBeStatic
void GDDLDemonSplitLayer::onTierSearch(cocos2d::CCObject *sender) { // NOLINT(*-convert-member-functions-to-static)
auto *senderNode = dynamic_cast<CCNode *>(sender);
const std::string tierStr = senderNode->getID();
const int tierNumber = std::stoi(tierStr.substr(12, tierStr.size()-10));
GDDLSearchLayer::requestSearchFromDemonSplit(tierNumber);
// the list should display itself hopefully
}

CCNode *GDDLDemonSplitLayer::createTierNode(int tier) {
auto tierNode = CCMenu::create();
CCNode *GDDLDemonSplitLayer::createTierNode(const int tier) {
const auto tierNode = CCMenu::create();
tierNode->setLayout(RowLayout::create()->setGap(3.0f)->setAutoScale(true));
tierNode->setContentSize({50.0f, 20.0f});
// tier sprite
std::string tierSpriteName = "tier_" + std::to_string(tier) + ".png";
auto textureName = Mod::get()->expandSpriteName(tierSpriteName.c_str());
auto tierSprite = CCSprite::create(textureName);
const std::string tierSpriteName = "tier_" + std::to_string(tier) + ".png";
const auto textureName = Mod::get()->expandSpriteName(tierSpriteName.c_str());
const auto tierSprite = CCSprite::create(textureName);
tierSprite->setScale(0.05f);
tierSprite->setContentSize({20.0f, 20.0f});
auto tierButton = CCMenuItemSpriteExtra::create(tierSprite, this, menu_selector(GDDLDemonSplitLayer::onTierSearch));
const auto tierButton = CCMenuItemSpriteExtra::create(tierSprite, this, menu_selector(GDDLDemonSplitLayer::onTierSearch));
tierButton->setContentSize({20.0f, 20.0f});
tierButton->setID("button-tier-"+std::to_string(tier));
tierNode->addChild(tierButton);
// tier count
int count = RatingsManager::getTierStats()[tier];
auto countLabel = CCLabelBMFont::create(std::to_string(count).c_str(), "chatFont.fnt");
const int count = RatingsManager::getTierStats()[tier];
const auto countLabel = CCLabelBMFont::create(std::to_string(count).c_str(), "chatFont.fnt");
countLabel->setContentSize({30.0f, 20.0f});
tierNode->addChild(countLabel);
tierNode->updateLayout();
Expand All @@ -123,6 +126,7 @@ CCNode *GDDLDemonSplitLayer::createTierNode(int tier) {
}

GDDLDemonSplitLayer *GDDLDemonSplitLayer::create() {
// ReSharper disable once CppDFAConstantConditions
if (const auto newLayer = new GDDLDemonSplitLayer(); newLayer != nullptr && newLayer->init()) {
newLayer->autorelease();
return newLayer;
Expand Down
6 changes: 3 additions & 3 deletions src/GDDLDemonSplitLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@

using namespace geode::prelude;

class GDDLDemonSplitLayer : public FLAlertLayer {
class GDDLDemonSplitLayer final : public FLAlertLayer {
CCMenuItemSpriteExtra* m_closeBtn{};

bool init();
bool init() override;
void onClose(cocos2d::CCObject* sender);
void onInfo(cocos2d::CCObject *sender);
void onTierSearch(cocos2d::CCObject* sender);

CCNode* createTierNode(int tier);
public:
static GDDLDemonSplitLayer* create();
void show();
void show() override;
};


Expand Down
2 changes: 1 addition & 1 deletion src/GDDLRating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ GDDLRating::GDDLRating(json levelData) {
this->enjoymentCount = levelData["EnjoymentCount"];
this->submissionCount = levelData["SubmissionCount"];

this->roundedRating = round(this->rating);
this->roundedRating = static_cast<int>(round(this->rating));
}
Loading

0 comments on commit f01c31f

Please sign in to comment.