ModProblems: add "Fix" button check

This commit is contained in:
Fleeym 2024-06-03 19:25:05 +03:00
parent cc119d8843
commit 669eef4358
3 changed files with 17 additions and 4 deletions

View file

@ -566,13 +566,13 @@ Result<> ModMetadata::checkGameVersion() const {
if (LoaderImpl::get()->isForwardCompatMode()) {
// this means current gd version is > GEODE_GD_VERSION
if (modTargetVer <= GEODE_GD_VERSION) {
return Err(fmt::format("Mod doesn't support this version of Geometry Dash ({})", ver));
return Err(fmt::format("This mod doesn't support this version of Geometry Dash ({})", ver));
}
} else if (ver != GEODE_STR(GEODE_GD_VERSION)) {
// we are not in forward compat mode, so GEODE_GD_VERSION is the current gd version
return Err(
fmt::format(
"Mod was created for a different version of Geometry Dash ({}). You currently have version {}.",
"This mod was created for a different version of Geometry Dash ({}). You currently have version {}.",
ver,
GEODE_STR(GEODE_GD_VERSION)
)

View file

@ -61,12 +61,19 @@ bool ModProblemItem::init(Mod* source, LoadProblem problem, CCSize const& size)
label->setWrappingMode(WrappingMode::WORD_WRAP);
label->setAnchorPoint({ 0.0f, 0.5f });
label->setMaxLines(4);
label->setWidth(size.width * 0.7f);
if (this->showFixButton()) {
label->setWidth(size.width * 0.7f);
} else {
// Left + Right + Space between
constexpr float paddings = 30.0f;
float calc = size.width - paddings - icon->getScaledContentWidth();
label->setWidth(calc);
}
label->setScale(0.4f);
this->addChildAtPosition(
label,
Anchor::Left,
CCPoint { 15.0f + icon->getScaledContentWidth(), 0.0f }
CCPoint { 20.0f + icon->getScaledContentWidth(), 0.0f }
);
return true;
@ -91,6 +98,11 @@ CCSprite* ModProblemItem::createSeverityIcon() {
}
}
bool ModProblemItem::showFixButton() {
// TODO: Actually implement the fix button ;)
return false;
}
std::string ModProblemItem::createProblemMessage() {
std::stringstream ss;
ss << m_source->getName() << " ";

View file

@ -23,6 +23,7 @@ public:
protected:
bool init(Mod* source, LoadProblem problem, CCSize const& size);
ModProblemItem::Severity computeSeverity();
bool showFixButton();
CCSprite* createSeverityIcon();
std::string createProblemMessage();
};