mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
only display more button for devs on server mods
This commit is contained in:
parent
93c12a6757
commit
1c40a63e33
3 changed files with 33 additions and 27 deletions
|
@ -23,7 +23,8 @@ bool ModDeveloperItem::init(
|
|||
DevListPopup* popup,
|
||||
std::string developer,
|
||||
CCSize const& size,
|
||||
std::optional<std::string> displayName
|
||||
std::optional<std::string> displayName,
|
||||
bool addMoreButton
|
||||
) {
|
||||
if (!CCNode::init()) {
|
||||
return false;
|
||||
|
@ -66,6 +67,7 @@ bool ModDeveloperItem::init(
|
|||
{5, 0}
|
||||
);
|
||||
|
||||
if (addMoreButton) {
|
||||
auto menu = CCMenu::create();
|
||||
menu->setAnchorPoint({1.0f, 0.5f});
|
||||
|
||||
|
@ -90,6 +92,7 @@ bool ModDeveloperItem::init(
|
|||
Anchor::Right,
|
||||
{-3, 0}
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -104,10 +107,11 @@ ModDeveloperItem* ModDeveloperItem::create(
|
|||
DevListPopup* popup,
|
||||
std::string developer,
|
||||
CCSize const& size,
|
||||
std::optional<std::string> displayName
|
||||
std::optional<std::string> displayName,
|
||||
bool addMoreButton
|
||||
) {
|
||||
auto ret = new ModDeveloperItem();
|
||||
if (!ret || !ret->init(popup, developer, size, displayName)) {
|
||||
if (!ret || !ret->init(popup, developer, size, displayName, addMoreButton)) {
|
||||
CC_SAFE_DELETE(ret);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -19,14 +19,16 @@ public:
|
|||
DevListPopup* popup,
|
||||
std::string developer,
|
||||
CCSize const& size,
|
||||
std::optional<std::string> displayName = std::nullopt
|
||||
std::optional<std::string> displayName = std::nullopt,
|
||||
bool addMoreButton = true
|
||||
);
|
||||
private:
|
||||
bool init(
|
||||
DevListPopup* popup,
|
||||
std::string developer,
|
||||
CCSize const& size,
|
||||
std::optional<std::string> displayName
|
||||
std::optional<std::string> displayName,
|
||||
bool addMoreButton
|
||||
);
|
||||
void onMoreByThisDev(CCObject* sender);
|
||||
};
|
||||
|
|
|
@ -56,7 +56,7 @@ bool ModDeveloperList::init(DevListPopup* popup, ModSource const& source, CCSize
|
|||
m_source.visit(makeVisitor {
|
||||
[this, popup, itemSize](Mod* mod) {
|
||||
for (std::string& dev : mod->getMetadata().getDevelopers()) {
|
||||
m_list->m_contentLayer->addChild(ModDeveloperItem::create(popup, dev, itemSize));
|
||||
m_list->m_contentLayer->addChild(ModDeveloperItem::create(popup, dev, itemSize, std::nullopt, false));
|
||||
}
|
||||
},
|
||||
[this, popup, itemSize](server::ServerModMetadata const& metadata) {
|
||||
|
@ -66,7 +66,7 @@ bool ModDeveloperList::init(DevListPopup* popup, ModSource const& source, CCSize
|
|||
},
|
||||
[this, popup, itemSize](ModSuggestion const& suggestion) {
|
||||
for (std::string& dev : suggestion.suggestion.getDevelopers()) {
|
||||
m_list->m_contentLayer->addChild(ModDeveloperItem::create(popup, dev, itemSize));
|
||||
m_list->m_contentLayer->addChild(ModDeveloperItem::create(popup, dev, itemSize, std::nullopt, false));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue