mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-27 09:55:34 -05:00
fix index ui with show installed filter on
This commit is contained in:
parent
3d2e447333
commit
a9cce769d5
3 changed files with 11 additions and 5 deletions
|
@ -686,6 +686,8 @@ bool IndexItemInfoPopup::init(IndexItemHandle item, ModListLayer* list) {
|
||||||
|
|
||||||
if (!ModInfoPopup::init(item->getMetadata(), list)) return false;
|
if (!ModInfoPopup::init(item->getMetadata(), list)) return false;
|
||||||
|
|
||||||
|
if (item->isInstalled()) return true;
|
||||||
|
|
||||||
m_installBtnSpr = IconButtonSprite::create(
|
m_installBtnSpr = IconButtonSprite::create(
|
||||||
"GE_button_01.png"_spr,
|
"GE_button_01.png"_spr,
|
||||||
CCSprite::createWithSpriteFrameName("install.png"_spr),
|
CCSprite::createWithSpriteFrameName("install.png"_spr),
|
||||||
|
|
|
@ -387,9 +387,11 @@ bool IndexItemCell::init(
|
||||||
|
|
||||||
m_item = item;
|
m_item = item;
|
||||||
|
|
||||||
this->setupInfo(item->getMetadata(), item->getTags().size(), display, item->isInstalled());
|
bool justInstalled = item->isInstalled() && !Loader::get()->isModInstalled(item->getMetadata().getID());
|
||||||
|
|
||||||
if (item->isInstalled()) {
|
this->setupInfo(item->getMetadata(), item->getTags().size(), display, justInstalled);
|
||||||
|
|
||||||
|
if (justInstalled) {
|
||||||
auto restartSpr = ButtonSprite::create("Restart", "bigFont.fnt", "GJ_button_03.png", .8f);
|
auto restartSpr = ButtonSprite::create("Restart", "bigFont.fnt", "GJ_button_03.png", .8f);
|
||||||
restartSpr->setScale(.65f);
|
restartSpr->setScale(.65f);
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ static std::optional<int> queryMatch(ModListQuery const& query, IndexItemHandle
|
||||||
|
|
||||||
static std::optional<int> queryMatch(ModListQuery const& query, InvalidGeodeFile const& info) {
|
static std::optional<int> queryMatch(ModListQuery const& query, InvalidGeodeFile const& info) {
|
||||||
// if any explicit filters were provided, no match
|
// if any explicit filters were provided, no match
|
||||||
if (query.tags.size() || query.keywords.has_value()) {
|
if (!query.tags.empty() || query.keywords.has_value()) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -162,9 +162,11 @@ CCArray* ModListLayer::createModCells(ModListType type, ModListQuery const& quer
|
||||||
|
|
||||||
// newly installed
|
// newly installed
|
||||||
for (auto const& item : Index::get()->getItems()) {
|
for (auto const& item : Index::get()->getItems()) {
|
||||||
if (!item->isInstalled())
|
if (!item->isInstalled() ||
|
||||||
|
Loader::get()->isModInstalled(item->getMetadata().getID()))
|
||||||
continue;
|
continue;
|
||||||
if (auto match = queryMatch(query, item)) {
|
// match the same as other installed mods
|
||||||
|
if (auto match = queryMatchKeywords(query, item->getMetadata())) {
|
||||||
auto cell = IndexItemCell::create(item, this, m_display, this->getCellSize());
|
auto cell = IndexItemCell::create(item, this, m_display, this->getCellSize());
|
||||||
sorted.insert({ match.value(), cell });
|
sorted.insert({ match.value(), cell });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue