mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
add special visuals for paid tag + make featured tag match with it
This commit is contained in:
parent
22b258028c
commit
0082765591
4 changed files with 34 additions and 12 deletions
BIN
loader/resources/tag-featured.png
Normal file
BIN
loader/resources/tag-featured.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
loader/resources/tag-paid.png
Normal file
BIN
loader/resources/tag-paid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
|
@ -20,7 +20,7 @@ $on_mod(Loaded) {
|
||||||
ColorProvider::get()->define("mod-list-tab-deselected-bg"_spr, { 26, 24, 29, 255 });
|
ColorProvider::get()->define("mod-list-tab-deselected-bg"_spr, { 26, 24, 29, 255 });
|
||||||
ColorProvider::get()->define("mod-list-tab-selected-bg"_spr, { 168, 147, 185, 255 });
|
ColorProvider::get()->define("mod-list-tab-selected-bg"_spr, { 168, 147, 185, 255 });
|
||||||
ColorProvider::get()->define("mod-list-tab-selected-bg-alt"_spr, { 147, 163, 185, 255 });
|
ColorProvider::get()->define("mod-list-tab-selected-bg-alt"_spr, { 147, 163, 185, 255 });
|
||||||
ColorProvider::get()->define("mod-list-featured-color"_spr, { 255, 255, 120, 255 });
|
ColorProvider::get()->define("mod-list-featured-color"_spr, { 240, 211, 42, 255 });
|
||||||
ColorProvider::get()->define("mod-list-enabled"_spr, { 120, 255, 100, 255 });
|
ColorProvider::get()->define("mod-list-enabled"_spr, { 120, 255, 100, 255 });
|
||||||
ColorProvider::get()->define("mod-list-disabled"_spr, { 255, 120, 100, 255 });
|
ColorProvider::get()->define("mod-list-disabled"_spr, { 255, 120, 100, 255 });
|
||||||
ColorProvider::get()->define("mod-list-recommended-bg"_spr, ccc3(25, 255, 167));
|
ColorProvider::get()->define("mod-list-recommended-bg"_spr, ccc3(25, 255, 167));
|
||||||
|
@ -28,6 +28,7 @@ $on_mod(Loaded) {
|
||||||
ColorProvider::get()->define("mod-list-recommended-by-2"_spr, ccc3(47, 255, 255));
|
ColorProvider::get()->define("mod-list-recommended-by-2"_spr, ccc3(47, 255, 255));
|
||||||
ColorProvider::get()->define("mod-problems-item-bg"_spr, { 255, 255, 255, 15 });
|
ColorProvider::get()->define("mod-problems-item-bg"_spr, { 255, 255, 255, 15 });
|
||||||
ColorProvider::get()->define("mod-developer-item-bg"_spr, { 255, 255, 255, 15 });
|
ColorProvider::get()->define("mod-developer-item-bg"_spr, { 255, 255, 255, 15 });
|
||||||
|
ColorProvider::get()->define("mod-list-paid-color"_spr, { 0, 255, 63, 255 });
|
||||||
|
|
||||||
// Only used when GD theme is active
|
// Only used when GD theme is active
|
||||||
ColorProvider::get()->define("mods-layer-gd-bg"_spr, { 0, 102, 255, 255 });
|
ColorProvider::get()->define("mods-layer-gd-bg"_spr, { 0, 102, 255, 255 });
|
||||||
|
|
|
@ -53,6 +53,7 @@ bool ModItem::init(ModSource&& source) {
|
||||||
|
|
||||||
m_titleLabel = CCLabelBMFont::create(m_source.getMetadata().getName().c_str(), "bigFont.fnt");
|
m_titleLabel = CCLabelBMFont::create(m_source.getMetadata().getName().c_str(), "bigFont.fnt");
|
||||||
m_titleLabel->setID("title-label");
|
m_titleLabel->setID("title-label");
|
||||||
|
m_titleLabel->setLayoutOptions(AxisLayoutOptions::create()->setScalePriority(1));
|
||||||
m_titleContainer->addChild(m_titleLabel);
|
m_titleContainer->addChild(m_titleLabel);
|
||||||
|
|
||||||
m_versionLabel = CCLabelBMFont::create("", "bigFont.fnt");
|
m_versionLabel = CCLabelBMFont::create("", "bigFont.fnt");
|
||||||
|
@ -182,16 +183,14 @@ bool ModItem::init(ModSource&& source) {
|
||||||
},
|
},
|
||||||
[this](server::ServerModMetadata const& metadata) {
|
[this](server::ServerModMetadata const& metadata) {
|
||||||
if (metadata.featured) {
|
if (metadata.featured) {
|
||||||
auto starBG = CCScale9Sprite::createWithSpriteFrameName("GJ_colorBtn_001.png");
|
auto star = CCSprite::createWithSpriteFrameName("tag-featured.png"_spr);
|
||||||
starBG->setContentSize({ 50, 38 });
|
star->setLayoutOptions(AxisLayoutOptions::create()->setScaleLimits(.1f, .8f));
|
||||||
starBG->setColor(to3B(ColorProvider::get()->color("mod-list-featured-color"_spr)));
|
m_titleContainer->addChild(star);
|
||||||
starBG->setOpacity(45);
|
}
|
||||||
|
if (metadata.tags.contains("paid")) {
|
||||||
auto star = CCSprite::createWithSpriteFrameName("GJ_starsIcon_001.png");
|
auto paidModLabel = CCSprite::createWithSpriteFrameName("tag-paid.png"_spr);
|
||||||
starBG->addChildAtPosition(star, Anchor::Center);
|
paidModLabel->setLayoutOptions(AxisLayoutOptions::create()->setScaleLimits(.1f, .8f));
|
||||||
starBG->setID("star-bg");
|
m_titleContainer->addChild(paidModLabel);
|
||||||
|
|
||||||
m_titleContainer->addChild(starBG);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show mod download count here already so people can make informed decisions
|
// Show mod download count here already so people can make informed decisions
|
||||||
|
@ -338,9 +337,15 @@ void ModItem::updateState() {
|
||||||
[this](server::ServerModMetadata const& metadata) {
|
[this](server::ServerModMetadata const& metadata) {
|
||||||
m_bg->setColor(isGeodeTheme() ? ccWHITE : ccBLACK);
|
m_bg->setColor(isGeodeTheme() ? ccWHITE : ccBLACK);
|
||||||
m_bg->setOpacity(isGeodeTheme() ? 25 : 90);
|
m_bg->setOpacity(isGeodeTheme() ? 25 : 90);
|
||||||
|
|
||||||
|
if (metadata.tags.contains("paid")) {
|
||||||
|
m_bg->setColor("mod-list-paid-color"_cc3b);
|
||||||
|
m_bg->setOpacity(55);
|
||||||
|
}
|
||||||
|
|
||||||
if (isGeodeTheme() && metadata.featured) {
|
if (isGeodeTheme() && metadata.featured) {
|
||||||
m_bg->setColor("mod-list-featured-color"_cc3b);
|
m_bg->setColor("mod-list-featured-color"_cc3b);
|
||||||
m_bg->setOpacity(40);
|
m_bg->setOpacity(65);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[this](ModSuggestion const& suggestion) {
|
[this](ModSuggestion const& suggestion) {
|
||||||
|
@ -449,6 +454,22 @@ void ModItem::onCheckUpdates(typename server::ServerRequest<std::optional<server
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModItem::onView(CCObject*) {
|
void ModItem::onView(CCObject*) {
|
||||||
|
// This is a local static and not a mod saved value because we might want
|
||||||
|
// to periodically remind users that paid mods are paid
|
||||||
|
static bool shownPaidNotif = false;
|
||||||
|
if (m_source.asServer() && m_source.asServer()->tags.contains("paid") && !shownPaidNotif) {
|
||||||
|
shownPaidNotif = true;
|
||||||
|
return FLAlertLayer::create(
|
||||||
|
nullptr,
|
||||||
|
"Paid Content",
|
||||||
|
"This mod contains <cg>Paid Content</c>. This means that some or all "
|
||||||
|
"features of the mod <cj>require money to use</c>.\n\n"
|
||||||
|
"<cy>Geode does not handle any payments. The mod handles all transactions in their own way.</c>\n\n"
|
||||||
|
"<cp>The paid content may not be available in your country.</c>",
|
||||||
|
"OK", nullptr, 360
|
||||||
|
)->show();
|
||||||
|
}
|
||||||
|
|
||||||
// Always open up the popup for the installed mod page if that is possible
|
// Always open up the popup for the installed mod page if that is possible
|
||||||
ModPopup::create(m_source.convertForPopup())->show();
|
ModPopup::create(m_source.convertForPopup())->show();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue