mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-22 02:45:49 -04:00
disable sort button on non-server since they have no sorting options
This commit is contained in:
parent
6304e8c6d7
commit
399a67f56b
3 changed files with 17 additions and 2 deletions
loader/src/ui/mods
|
@ -21,6 +21,7 @@ bool GeodeSquareSprite::init(CCSprite* top, bool* state) {
|
|||
return false;
|
||||
|
||||
m_stateSrc = state;
|
||||
m_topSprite = top;
|
||||
|
||||
limitNodeSize(top, m_obContentSize * .65f, 2.f, .1f);
|
||||
this->addChildAtPosition(top, Anchor::Center);
|
||||
|
@ -63,6 +64,10 @@ GeodeSquareSprite* GeodeSquareSprite::createWithSpriteFrameName(const char* top,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
CCSprite* GeodeSquareSprite::getTopSprite() const {
|
||||
return m_topSprite;
|
||||
}
|
||||
|
||||
CCNode* createLoadingCircle(float sideLength, const char* id) {
|
||||
auto spinnerContainer = CCNode::create();
|
||||
spinnerContainer->setContentSize({ sideLength, sideLength });
|
||||
|
|
|
@ -38,6 +38,7 @@ class GeodeSquareSprite : public CCSprite {
|
|||
protected:
|
||||
bool* m_stateSrc = nullptr;
|
||||
bool m_state = false;
|
||||
CCSprite* m_topSprite;
|
||||
|
||||
bool init(CCSprite* top, bool* state);
|
||||
|
||||
|
@ -46,6 +47,8 @@ protected:
|
|||
public:
|
||||
static GeodeSquareSprite* create(const char* top, bool* state = nullptr);
|
||||
static GeodeSquareSprite* createWithSpriteFrameName(const char* top, bool* state = nullptr);
|
||||
|
||||
CCSprite* getTopSprite() const;
|
||||
};
|
||||
|
||||
CCNode* createLoadingCircle(float sideLength, const char* id = "loading-spinner");
|
||||
|
|
|
@ -71,10 +71,17 @@ bool ModList::init(ModListSource* src, CCSize const& size) {
|
|||
searchFiltersMenu->setAnchorPoint({ 1, .5f });
|
||||
searchFiltersMenu->setScale(.75f);
|
||||
|
||||
auto sortSpr = GeodeSquareSprite::createWithSpriteFrameName("GJ_sortIcon_001.png");
|
||||
auto sortBtn = CCMenuItemSpriteExtra::create(
|
||||
GeodeSquareSprite::createWithSpriteFrameName("GJ_sortIcon_001.png"),
|
||||
this, menu_selector(ModList::onSort)
|
||||
sortSpr, this, menu_selector(ModList::onSort)
|
||||
);
|
||||
if (!typeinfo_cast<ServerModListSource*>(m_source)) {
|
||||
sortBtn->setEnabled(false);
|
||||
sortSpr->setColor({ 150, 150, 150 });
|
||||
sortSpr->setOpacity(105);
|
||||
sortSpr->getTopSprite()->setColor({ 150, 150, 150 });
|
||||
sortSpr->getTopSprite()->setOpacity(105);
|
||||
}
|
||||
searchFiltersMenu->addChild(sortBtn);
|
||||
|
||||
auto filterBtn = CCMenuItemSpriteExtra::create(
|
||||
|
|
Loading…
Reference in a new issue