mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-26 01:18:01 -05:00
update invalid mods (show a popup + make the N/A button gray)
This commit is contained in:
parent
33f23cf173
commit
6944f80e78
3 changed files with 24 additions and 17 deletions
|
@ -150,6 +150,7 @@ const char* getGeodeButtonSpriteName(GeodeButtonSprite spr) {
|
||||||
case GeodeButtonSprite::Install: return "GE_button_01.png"_spr;
|
case GeodeButtonSprite::Install: return "GE_button_01.png"_spr;
|
||||||
case GeodeButtonSprite::Delete: return "GJ_button_06.png";
|
case GeodeButtonSprite::Delete: return "GJ_button_06.png";
|
||||||
case GeodeButtonSprite::Enable: return "GJ_button_01.png";
|
case GeodeButtonSprite::Enable: return "GJ_button_01.png";
|
||||||
|
case GeodeButtonSprite::Gray: return "GJ_button_05.png";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -159,6 +160,7 @@ const char* getGeodeButtonSpriteName(GeodeButtonSprite spr) {
|
||||||
case GeodeButtonSprite::Install: return "GE_button_01.png"_spr;
|
case GeodeButtonSprite::Install: return "GE_button_01.png"_spr;
|
||||||
case GeodeButtonSprite::Delete: return "GJ_button_06.png";
|
case GeodeButtonSprite::Delete: return "GJ_button_06.png";
|
||||||
case GeodeButtonSprite::Enable: return "GJ_button_02.png";
|
case GeodeButtonSprite::Enable: return "GJ_button_02.png";
|
||||||
|
case GeodeButtonSprite::Gray: return "GJ_button_05.png";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ enum class GeodeButtonSprite {
|
||||||
Install,
|
Install,
|
||||||
Delete,
|
Delete,
|
||||||
Enable,
|
Enable,
|
||||||
|
Gray,
|
||||||
};
|
};
|
||||||
const char* getGeodeButtonSpriteName(GeodeButtonSprite spr);
|
const char* getGeodeButtonSpriteName(GeodeButtonSprite spr);
|
||||||
IconButtonSprite* createGeodeButton(CCNode* icon, std::string const& text, GeodeButtonSprite bg = GeodeButtonSprite::Default);
|
IconButtonSprite* createGeodeButton(CCNode* icon, std::string const& text, GeodeButtonSprite bg = GeodeButtonSprite::Default);
|
||||||
|
|
|
@ -143,7 +143,7 @@ bool ModItem::init(ModSource&& source) {
|
||||||
auto gdValid = gameVersion == "*" || gameVersion == GEODE_STR(GEODE_GD_VERSION);
|
auto gdValid = gameVersion == "*" || gameVersion == GEODE_STR(GEODE_GD_VERSION);
|
||||||
|
|
||||||
if (!geodeValid || !gdValid) {
|
if (!geodeValid || !gdValid) {
|
||||||
spr = createGeodeButton("N/A", 50, false, true, GeodeButtonSprite::Default);
|
spr = createGeodeButton("N/A", 50, false, true, GeodeButtonSprite::Gray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,22 +493,26 @@ void ModItem::onView(CCObject*) {
|
||||||
)->show();
|
)->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto serverMod = m_source.asServer(); serverMod != nullptr) {
|
// Show popups for invalid mods
|
||||||
auto version = serverMod->latestVersion();
|
if (m_source.asServer()) {
|
||||||
auto geodeVersion = version.getGeodeVersion();
|
auto version = m_source.asServer()->latestVersion();
|
||||||
auto geodeValid = Loader::get()->isModVersionSupported(geodeVersion);
|
if (!Loader::get()->isModVersionSupported(version.getGeodeVersion())) {
|
||||||
|
return FLAlertLayer::create(
|
||||||
if (auto res = version.checkGameVersion(); !res) {
|
nullptr,
|
||||||
FLAlertLayer::create(nullptr, "Unavailable", res.unwrapErr(), "Close", nullptr)->show();
|
"Outdated",
|
||||||
return;
|
"This mod is targets an <cr>outdated version of Geode</c>. "
|
||||||
} else if (!geodeValid) {
|
"<co>Please wait for its developer to update it.</c>",
|
||||||
auto msg = fmt::format(
|
"OK", nullptr, 360
|
||||||
"Geode {} is required to view this mod. You currently have {}.",
|
)->show();
|
||||||
geodeVersion.toVString(),
|
}
|
||||||
Loader::get()->getVersion().toVString()
|
if (version.getGameVersion() != "*" && version.getGameVersion() != GEODE_STR(GEODE_GD_VERSION)) {
|
||||||
);
|
return FLAlertLayer::create(
|
||||||
FLAlertLayer::create(nullptr, "Unavailable", msg, "Close", nullptr)->show();
|
nullptr,
|
||||||
return;
|
"Outdated",
|
||||||
|
"This mod is targets a <cr>different version of Geometry Dash</c>. "
|
||||||
|
"<co>Please wait for its developer to update it.</c>",
|
||||||
|
"OK", nullptr, 360
|
||||||
|
)->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue