mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-13 22:49:52 -04:00
it's finished holy moly
This commit is contained in:
parent
2e039a9cea
commit
cded0523a5
2 changed files with 27 additions and 22 deletions
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
@ -716,30 +716,35 @@ void ModsLayer::onSettings(CCObject*) {
|
|||
void ModsLayer::onCopy(CCObject*) {
|
||||
auto text = "No mods installed";
|
||||
auto mods = Loader::get()->getAllMods();
|
||||
if (!mods.empty()) text = "Mods list copied to clipboard!";
|
||||
if (!mods.empty()) {
|
||||
text = "Mods list copied to clipboard!";
|
||||
std::sort(mods.begin(), mods.end(), [](Mod* a, Mod* b) {
|
||||
auto const s1 = a->getID();
|
||||
auto const s2 = b->getID();
|
||||
return std::lexicographical_compare(s1.begin(), s1.end(), s2.begin(), s2.end(), [](auto a, auto b) {
|
||||
return std::tolower(a) < std::tolower(b);
|
||||
});
|
||||
});
|
||||
|
||||
auto* label = CCLabelBMFont::create(text, "bigFont.fnt");
|
||||
label->setPosition(CCDirector::get()->getWinSize() / 2);
|
||||
label->setOpacity(0);
|
||||
label->runAction(CCSequence::create(
|
||||
CCFadeIn::create(.5f),
|
||||
CCDelayTime::create(1.f),
|
||||
CCFadeOut::create(.5f),
|
||||
nullptr
|
||||
));
|
||||
this->addChild(label);
|
||||
|
||||
std::stringstream ss;
|
||||
using namespace std::string_view_literals;
|
||||
for (auto& mod : mods) {
|
||||
ss << fmt::format("{} | [{}] {}\n",
|
||||
mod->isEnabled() ? "x"sv :
|
||||
mod->hasProblems() ? "!"sv :
|
||||
" "sv,
|
||||
mod->getVersion().toVString(), mod->getID()
|
||||
);
|
||||
std::stringstream ss;
|
||||
using namespace std::string_view_literals;
|
||||
for (int i = 0; i < mods.size(); i++) {
|
||||
auto& mod = mods[i];
|
||||
ss << fmt::format("{} | [{}] {}",
|
||||
mod->isEnabled() ? "x"sv :
|
||||
mod->hasProblems() ? "!"sv :
|
||||
" "sv,
|
||||
mod->getVersion().toVString(), mod->getID()
|
||||
);
|
||||
if (i != mods.size() - 1) {
|
||||
ss << "\n";
|
||||
}
|
||||
}
|
||||
clipboard::write(ss.str());
|
||||
}
|
||||
clipboard::write(ss.str());
|
||||
|
||||
auto popup = TextAlertPopup::create(text, 0.5f, 0.6f, 150, "bigFont.fnt");
|
||||
this->addChild(popup, 100);
|
||||
}
|
||||
|
||||
ModsLayer* ModsLayer::create() {
|
||||
|
|
Loading…
Reference in a new issue