mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-22 15:37:53 -05:00
Settings + some list fixes (#1108)
* Made the force disable work as expected by replacing the NOT AND with an XOR * Made sure that the mods layer doesn't force disable the geode theme in the settings * Reverted the previous fix and properly migrated the force disable theme option * Fixed the name of the last argument of ListBorders::setSpriteFrames * Made a correction for the vanilla borders being gigantic * Added a missing force disable theme * Removed a test line * Fixed the scroll issue in the entire geode UI * Fixed the min height of the settings list * Applied the same fix the mod lists * Made the fuzzy search less random * Replaced as with a static cast
This commit is contained in:
parent
30542d794a
commit
a04edcfd54
11 changed files with 78 additions and 65 deletions
|
@ -86,7 +86,7 @@ namespace geode {
|
||||||
public:
|
public:
|
||||||
static ListBorders* create();
|
static ListBorders* create();
|
||||||
|
|
||||||
void setSpriteFrames(const char* topAndBottom, const char* sides, float topPadding = 7.5f);
|
void setSpriteFrames(const char* topAndBottom, const char* sides, float horizontalPadding = 7.5f);
|
||||||
void setSprites(
|
void setSprites(
|
||||||
cocos2d::extension::CCScale9Sprite* top,
|
cocos2d::extension::CCScale9Sprite* top,
|
||||||
cocos2d::extension::CCScale9Sprite* bottom,
|
cocos2d::extension::CCScale9Sprite* bottom,
|
||||||
|
|
|
@ -74,12 +74,17 @@ $on_mod(Loaded) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeodeSquareSprite::init(CCSprite* top, bool* state) {
|
bool isGeodeTheme(bool forceDisableTheme) {
|
||||||
if (!CCSprite::initWithFile(isGeodeTheme() ? "GE_button_05.png"_spr : "GJ_button_01.png"))
|
return !forceDisableTheme && Mod::get()->template getSettingValue<bool>("enable-geode-theme");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GeodeSquareSprite::init(CCSprite* top, bool* state, bool forceDisableTheme) {
|
||||||
|
if (!CCSprite::initWithFile(isGeodeTheme(forceDisableTheme) ? "GE_button_05.png"_spr : "GJ_button_01.png"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_stateSrc = state;
|
m_stateSrc = state;
|
||||||
m_topSprite = top;
|
m_topSprite = top;
|
||||||
|
m_forceDisableTheme = forceDisableTheme;
|
||||||
|
|
||||||
limitNodeSize(top, m_obContentSize * .65f, 2.f, .1f);
|
limitNodeSize(top, m_obContentSize * .65f, 2.f, .1f);
|
||||||
this->addChildAtPosition(top, Anchor::Center);
|
this->addChildAtPosition(top, Anchor::Center);
|
||||||
|
@ -94,7 +99,7 @@ bool GeodeSquareSprite::init(CCSprite* top, bool* state) {
|
||||||
|
|
||||||
void GeodeSquareSprite::updateImage() {
|
void GeodeSquareSprite::updateImage() {
|
||||||
this->setTexture(CCTextureCache::get()->addImage(
|
this->setTexture(CCTextureCache::get()->addImage(
|
||||||
(m_state ? "GJ_button_02.png" : (isGeodeTheme() ? "GE_button_05.png"_spr : "GJ_button_01.png")),
|
(m_state ? "GJ_button_02.png" : (isGeodeTheme(m_forceDisableTheme) ? "GE_button_05.png"_spr : "GJ_button_01.png")),
|
||||||
false
|
false
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -106,18 +111,18 @@ void GeodeSquareSprite::update(float dt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GeodeSquareSprite* GeodeSquareSprite::create(const char* top, bool* state) {
|
GeodeSquareSprite* GeodeSquareSprite::create(const char* top, bool* state, bool forceDisableTheme) {
|
||||||
auto ret = new GeodeSquareSprite();
|
auto ret = new GeodeSquareSprite();
|
||||||
if (ret->init(CCSprite::create(top), state)) {
|
if (ret->init(CCSprite::create(top), state, forceDisableTheme)) {
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
delete ret;
|
delete ret;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
GeodeSquareSprite* GeodeSquareSprite::createWithSpriteFrameName(const char* top, bool* state) {
|
GeodeSquareSprite* GeodeSquareSprite::createWithSpriteFrameName(const char* top, bool* state, bool forceDisableTheme) {
|
||||||
auto ret = new GeodeSquareSprite();
|
auto ret = new GeodeSquareSprite();
|
||||||
if (ret->init(CCSprite::createWithSpriteFrameName(top), state)) {
|
if (ret->init(CCSprite::createWithSpriteFrameName(top), state, forceDisableTheme)) {
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -142,8 +147,8 @@ CCNode* createLoadingCircle(float sideLength, const char* id) {
|
||||||
return spinner;
|
return spinner;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* getGeodeButtonSpriteName(GeodeButtonSprite spr) {
|
const char* getGeodeButtonSpriteName(GeodeButtonSprite spr, bool forceDisableTheme) {
|
||||||
if (isGeodeTheme()) {
|
if (isGeodeTheme(forceDisableTheme)) {
|
||||||
switch (spr) {
|
switch (spr) {
|
||||||
default:
|
default:
|
||||||
case GeodeButtonSprite::Default: return "GE_button_05.png"_spr;
|
case GeodeButtonSprite::Default: return "GE_button_05.png"_spr;
|
||||||
|
@ -165,18 +170,18 @@ const char* getGeodeButtonSpriteName(GeodeButtonSprite spr) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButtonSprite* createGeodeButton(CCNode* icon, std::string const& text, GeodeButtonSprite bg) {
|
IconButtonSprite* createGeodeButton(CCNode* icon, std::string const& text, GeodeButtonSprite bg, bool forceDisableTheme) {
|
||||||
return IconButtonSprite::create(getGeodeButtonSpriteName(bg), icon, text.c_str(), "bigFont.fnt");
|
return IconButtonSprite::create(getGeodeButtonSpriteName(bg, forceDisableTheme), icon, text.c_str(), "bigFont.fnt");
|
||||||
}
|
}
|
||||||
ButtonSprite* createGeodeButton(std::string const& text, int width, bool gold, bool absolute, GeodeButtonSprite bg) {
|
ButtonSprite* createGeodeButton(std::string const& text, int width, bool gold, bool absolute, GeodeButtonSprite bg, bool forceDisableTheme) {
|
||||||
return ButtonSprite::create(text.c_str(), width, absolute, gold ? "goldFont.fnt" : "bigFont.fnt", getGeodeButtonSpriteName(bg), 0.0f, .8f);
|
return ButtonSprite::create(text.c_str(), width, absolute, gold ? "goldFont.fnt" : "bigFont.fnt", getGeodeButtonSpriteName(bg, forceDisableTheme), 0.0f, .8f);
|
||||||
}
|
}
|
||||||
ButtonSprite* createGeodeButton(std::string const& text, bool gold, GeodeButtonSprite bg) {
|
ButtonSprite* createGeodeButton(std::string const& text, bool gold, GeodeButtonSprite bg, bool forceDisableTheme) {
|
||||||
return ButtonSprite::create(text.c_str(), gold ? "goldFont.fnt" : "bigFont.fnt", getGeodeButtonSpriteName(bg), .8f);
|
return ButtonSprite::create(text.c_str(), gold ? "goldFont.fnt" : "bigFont.fnt", getGeodeButtonSpriteName(bg, forceDisableTheme), .8f);
|
||||||
}
|
}
|
||||||
|
|
||||||
CircleButtonSprite* createGeodeCircleButton(CCSprite* top, float scale, CircleBaseSize size, bool altColor) {
|
CircleButtonSprite* createGeodeCircleButton(CCSprite* top, float scale, CircleBaseSize size, bool altColor, bool forceDisableTheme) {
|
||||||
const auto geodeTheme = isGeodeTheme();
|
const auto geodeTheme = isGeodeTheme(forceDisableTheme);
|
||||||
auto ret = CircleButtonSprite::create(
|
auto ret = CircleButtonSprite::create(
|
||||||
top, geodeTheme ? (altColor ? CircleBaseColor::DarkAqua : CircleBaseColor::DarkPurple) : CircleBaseColor::Green, size
|
top, geodeTheme ? (altColor ? CircleBaseColor::DarkAqua : CircleBaseColor::DarkPurple) : CircleBaseColor::Green, size
|
||||||
);
|
);
|
||||||
|
@ -217,19 +222,18 @@ std::string geodeTagName(std::string_view tag) {
|
||||||
return readable;
|
return readable;
|
||||||
}
|
}
|
||||||
|
|
||||||
ListBorders* createGeodeListBorders(CCSize const& size) {
|
ListBorders* createGeodeListBorders(CCSize const& size, bool forceDisableTheme) {
|
||||||
auto ret = ListBorders::create();
|
auto ret = ListBorders::create();
|
||||||
if (isGeodeTheme()) {
|
const bool geodeTheme = isGeodeTheme(forceDisableTheme);
|
||||||
|
if (geodeTheme) {
|
||||||
ret->setSpriteFrames("geode-list-top.png"_spr, "geode-list-side.png"_spr, 2);
|
ret->setSpriteFrames("geode-list-top.png"_spr, "geode-list-side.png"_spr, 2);
|
||||||
|
ret->setContentSize(size);
|
||||||
|
} else {
|
||||||
|
ret->setContentSize(size + ccp(5, 5));
|
||||||
}
|
}
|
||||||
ret->setContentSize(size);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isGeodeTheme() {
|
|
||||||
return Mod::get()->template getSettingValue<bool>("enable-geode-theme");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GeodeTabSprite::init(const char* iconFrame, const char* text, float width, bool altColor) {
|
bool GeodeTabSprite::init(const char* iconFrame, const char* text, float width, bool altColor) {
|
||||||
if (!CCNode::init())
|
if (!CCNode::init())
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -16,11 +16,16 @@ enum class GeodePopupStyle {
|
||||||
Alt2,
|
Alt2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool isGeodeTheme(bool forceDisableTheme = false);
|
||||||
|
|
||||||
template <class... Args>
|
template <class... Args>
|
||||||
class GeodePopup : public Popup<Args...> {
|
class GeodePopup : public Popup<Args...> {
|
||||||
protected:
|
protected:
|
||||||
|
bool m_forceDisableTheme = false;
|
||||||
|
|
||||||
bool init(float width, float height, Args... args, GeodePopupStyle style = GeodePopupStyle::Default, bool forceDisableTheme = false) {
|
bool init(float width, float height, Args... args, GeodePopupStyle style = GeodePopupStyle::Default, bool forceDisableTheme = false) {
|
||||||
const bool geodeTheme = !forceDisableTheme && Mod::get()->template getSettingValue<bool>("enable-geode-theme");
|
m_forceDisableTheme = forceDisableTheme;
|
||||||
|
const bool geodeTheme = isGeodeTheme(forceDisableTheme);
|
||||||
const char* bg;
|
const char* bg;
|
||||||
switch (style) {
|
switch (style) {
|
||||||
default:
|
default:
|
||||||
|
@ -49,16 +54,17 @@ class GeodeSquareSprite : public CCSprite {
|
||||||
protected:
|
protected:
|
||||||
bool* m_stateSrc = nullptr;
|
bool* m_stateSrc = nullptr;
|
||||||
bool m_state = false;
|
bool m_state = false;
|
||||||
|
bool m_forceDisableTheme = false;
|
||||||
CCSprite* m_topSprite;
|
CCSprite* m_topSprite;
|
||||||
|
|
||||||
bool init(CCSprite* top, bool* state);
|
bool init(CCSprite* top, bool* state, bool forceDisableTheme = false);
|
||||||
|
|
||||||
void update(float dt) override;
|
void update(float dt) override;
|
||||||
void updateImage();
|
void updateImage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static GeodeSquareSprite* create(const char* top, bool* state = nullptr);
|
static GeodeSquareSprite* create(const char* top, bool* state = nullptr, bool forceDisableTheme = false);
|
||||||
static GeodeSquareSprite* createWithSpriteFrameName(const char* top, bool* state = nullptr);
|
static GeodeSquareSprite* createWithSpriteFrameName(const char* top, bool* state = nullptr, bool forceDisableTheme = false);
|
||||||
|
|
||||||
CCSprite* getTopSprite() const;
|
CCSprite* getTopSprite() const;
|
||||||
void setState(bool state);
|
void setState(bool state);
|
||||||
|
@ -73,21 +79,19 @@ enum class GeodeButtonSprite {
|
||||||
Enable,
|
Enable,
|
||||||
Gray,
|
Gray,
|
||||||
};
|
};
|
||||||
const char* getGeodeButtonSpriteName(GeodeButtonSprite spr);
|
const char* getGeodeButtonSpriteName(GeodeButtonSprite spr, bool forceDisableTheme = false);
|
||||||
IconButtonSprite* createGeodeButton(CCNode* icon, std::string const& text, GeodeButtonSprite bg = GeodeButtonSprite::Default);
|
IconButtonSprite* createGeodeButton(CCNode* icon, std::string const& text, GeodeButtonSprite bg = GeodeButtonSprite::Default, bool forceDisableTheme = false);
|
||||||
ButtonSprite* createGeodeButton(std::string const& text, int width, bool absolute = false, bool gold = false, GeodeButtonSprite bg = GeodeButtonSprite::Default);
|
ButtonSprite* createGeodeButton(std::string const& text, int width, bool absolute = false, bool gold = false, GeodeButtonSprite bg = GeodeButtonSprite::Default, bool forceDisableTheme = false);
|
||||||
ButtonSprite* createGeodeButton(std::string const& text, bool gold = false, GeodeButtonSprite bg = GeodeButtonSprite::Default);
|
ButtonSprite* createGeodeButton(std::string const& text, bool gold = false, GeodeButtonSprite bg = GeodeButtonSprite::Default, bool forceDisableTheme = false);
|
||||||
|
|
||||||
CircleButtonSprite* createGeodeCircleButton(CCSprite* top, float scale = 1.f, CircleBaseSize size = CircleBaseSize::Medium, bool altColor = false);
|
CircleButtonSprite* createGeodeCircleButton(CCSprite* top, float scale = 1.f, CircleBaseSize size = CircleBaseSize::Medium, bool altColor = false, bool forceDisableTheme = false);
|
||||||
|
|
||||||
ButtonSprite* createTagLabel(std::string const& text, std::pair<ccColor3B, ccColor3B> const& color);
|
ButtonSprite* createTagLabel(std::string const& text, std::pair<ccColor3B, ccColor3B> const& color);
|
||||||
ButtonSprite* createGeodeTagLabel(std::string_view tag);
|
ButtonSprite* createGeodeTagLabel(std::string_view tag);
|
||||||
std::pair<ccColor3B, ccColor3B> geodeTagColors(std::string_view tag);
|
std::pair<ccColor3B, ccColor3B> geodeTagColors(std::string_view tag);
|
||||||
std::string geodeTagName(std::string_view tag);
|
std::string geodeTagName(std::string_view tag);
|
||||||
|
|
||||||
ListBorders* createGeodeListBorders(CCSize const& size);
|
ListBorders* createGeodeListBorders(CCSize const& size, bool forceDisableTheme = false);
|
||||||
|
|
||||||
bool isGeodeTheme();
|
|
||||||
|
|
||||||
class GeodeTabSprite : public CCNode {
|
class GeodeTabSprite : public CCNode {
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -705,7 +705,7 @@ void ModsLayer::onTheme(CCObject*) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
void ModsLayer::onSettings(CCObject*) {
|
void ModsLayer::onSettings(CCObject*) {
|
||||||
openSettingsPopup(Mod::get());
|
openSettingsPopup(Mod::get(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModsLayer* ModsLayer::create() {
|
ModsLayer* ModsLayer::create() {
|
||||||
|
|
|
@ -521,7 +521,7 @@ void ModList::updateTopContainer() {
|
||||||
auto oldPosition = oldPositionArea > 0.f ?
|
auto oldPosition = oldPositionArea > 0.f ?
|
||||||
m_list->m_contentLayer->getPositionY() / oldPositionArea :
|
m_list->m_contentLayer->getPositionY() / oldPositionArea :
|
||||||
-1.f;
|
-1.f;
|
||||||
|
|
||||||
// Update list size to account for the top menu
|
// Update list size to account for the top menu
|
||||||
// (giving a little bit of extra padding for it, the same size as gap)
|
// (giving a little bit of extra padding for it, the same size as gap)
|
||||||
m_list->setContentHeight(
|
m_list->setContentHeight(
|
||||||
|
@ -530,6 +530,8 @@ void ModList::updateTopContainer() {
|
||||||
static_cast<AxisLayout*>(m_list->m_contentLayer->getLayout())->getGap() :
|
static_cast<AxisLayout*>(m_list->m_contentLayer->getLayout())->getGap() :
|
||||||
this->getContentHeight()
|
this->getContentHeight()
|
||||||
);
|
);
|
||||||
|
static_cast<ColumnLayout*>(m_list->m_contentLayer->getLayout())->setAutoGrowAxis(m_list->getContentHeight());
|
||||||
|
m_list->m_contentLayer->updateLayout();
|
||||||
|
|
||||||
// Preserve relative scroll position
|
// Preserve relative scroll position
|
||||||
m_list->m_contentLayer->setPositionY((
|
m_list->m_contentLayer->setPositionY((
|
||||||
|
|
|
@ -131,7 +131,7 @@ bool FiltersPopup::setup(ModListSource* src) {
|
||||||
m_mainLayer->addChildAtPosition(inputContainer, Anchor::Bottom, ccp(0, 60), ccp(.5f, .5f));
|
m_mainLayer->addChildAtPosition(inputContainer, Anchor::Bottom, ccp(0, 60), ccp(.5f, .5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto okSpr = createGeodeButton("OK");
|
auto okSpr = createGeodeButton("OK", false, GeodeButtonSprite::Default, m_forceDisableTheme);
|
||||||
okSpr->setScale(.7f);
|
okSpr->setScale(.7f);
|
||||||
auto okBtn = CCMenuItemSpriteExtra::create(
|
auto okBtn = CCMenuItemSpriteExtra::create(
|
||||||
okSpr, this, menu_selector(FiltersPopup::onClose)
|
okSpr, this, menu_selector(FiltersPopup::onClose)
|
||||||
|
|
|
@ -336,7 +336,8 @@ bool ModPopup::setup(ModSource&& src) {
|
||||||
auto updateModSpr = createGeodeButton(
|
auto updateModSpr = createGeodeButton(
|
||||||
CCSprite::createWithSpriteFrameName("update.png"_spr),
|
CCSprite::createWithSpriteFrameName("update.png"_spr),
|
||||||
"Update",
|
"Update",
|
||||||
GeodeButtonSprite::Install
|
GeodeButtonSprite::Install,
|
||||||
|
m_forceDisableTheme
|
||||||
);
|
);
|
||||||
updateModSpr->setScale(.5f);
|
updateModSpr->setScale(.5f);
|
||||||
m_updateBtn = CCMenuItemSpriteExtra::create(
|
m_updateBtn = CCMenuItemSpriteExtra::create(
|
||||||
|
@ -347,13 +348,15 @@ bool ModPopup::setup(ModSource&& src) {
|
||||||
auto enableModOffSpr = createGeodeButton(
|
auto enableModOffSpr = createGeodeButton(
|
||||||
CCSprite::createWithSpriteFrameName("GJ_completesIcon_001.png"),
|
CCSprite::createWithSpriteFrameName("GJ_completesIcon_001.png"),
|
||||||
"Enable",
|
"Enable",
|
||||||
GeodeButtonSprite::Enable
|
GeodeButtonSprite::Enable,
|
||||||
|
m_forceDisableTheme
|
||||||
);
|
);
|
||||||
enableModOffSpr->setScale(.5f);
|
enableModOffSpr->setScale(.5f);
|
||||||
auto enableModOnSpr = createGeodeButton(
|
auto enableModOnSpr = createGeodeButton(
|
||||||
CCSprite::createWithSpriteFrameName("GJ_deleteIcon_001.png"),
|
CCSprite::createWithSpriteFrameName("GJ_deleteIcon_001.png"),
|
||||||
"Disable",
|
"Disable",
|
||||||
GeodeButtonSprite::Delete
|
GeodeButtonSprite::Delete,
|
||||||
|
m_forceDisableTheme
|
||||||
);
|
);
|
||||||
enableModOnSpr->setScale(.5f);
|
enableModOnSpr->setScale(.5f);
|
||||||
m_enableBtn = CCMenuItemToggler::create(
|
m_enableBtn = CCMenuItemToggler::create(
|
||||||
|
@ -366,7 +369,8 @@ bool ModPopup::setup(ModSource&& src) {
|
||||||
auto reenableModOffSpr = createGeodeButton(
|
auto reenableModOffSpr = createGeodeButton(
|
||||||
CCSprite::createWithSpriteFrameName("reset.png"_spr),
|
CCSprite::createWithSpriteFrameName("reset.png"_spr),
|
||||||
"Re-Enable",
|
"Re-Enable",
|
||||||
GeodeButtonSprite::Default
|
GeodeButtonSprite::Default,
|
||||||
|
m_forceDisableTheme
|
||||||
);
|
);
|
||||||
reenableModOffSpr->setScale(.5f);
|
reenableModOffSpr->setScale(.5f);
|
||||||
auto reenableModOnSpr = createGeodeButton(
|
auto reenableModOnSpr = createGeodeButton(
|
||||||
|
@ -385,7 +389,8 @@ bool ModPopup::setup(ModSource&& src) {
|
||||||
auto installModSpr = createGeodeButton(
|
auto installModSpr = createGeodeButton(
|
||||||
CCSprite::createWithSpriteFrameName("GJ_downloadsIcon_001.png"),
|
CCSprite::createWithSpriteFrameName("GJ_downloadsIcon_001.png"),
|
||||||
"Install",
|
"Install",
|
||||||
GeodeButtonSprite::Install
|
GeodeButtonSprite::Install,
|
||||||
|
m_forceDisableTheme
|
||||||
);
|
);
|
||||||
installModSpr->setScale(.5f);
|
installModSpr->setScale(.5f);
|
||||||
m_installBtn = CCMenuItemSpriteExtra::create(
|
m_installBtn = CCMenuItemSpriteExtra::create(
|
||||||
|
@ -396,7 +401,8 @@ bool ModPopup::setup(ModSource&& src) {
|
||||||
auto uninstallModSpr = createGeodeButton(
|
auto uninstallModSpr = createGeodeButton(
|
||||||
CCSprite::createWithSpriteFrameName("delete-white.png"_spr),
|
CCSprite::createWithSpriteFrameName("delete-white.png"_spr),
|
||||||
"Uninstall",
|
"Uninstall",
|
||||||
GeodeButtonSprite::Default
|
GeodeButtonSprite::Default,
|
||||||
|
m_forceDisableTheme
|
||||||
);
|
);
|
||||||
uninstallModSpr->setScale(.5f);
|
uninstallModSpr->setScale(.5f);
|
||||||
m_uninstallBtn = CCMenuItemSpriteExtra::create(
|
m_uninstallBtn = CCMenuItemSpriteExtra::create(
|
||||||
|
@ -407,7 +413,8 @@ bool ModPopup::setup(ModSource&& src) {
|
||||||
auto cancelDownloadSpr = createGeodeButton(
|
auto cancelDownloadSpr = createGeodeButton(
|
||||||
CCSprite::createWithSpriteFrameName("GJ_deleteIcon_001.png"),
|
CCSprite::createWithSpriteFrameName("GJ_deleteIcon_001.png"),
|
||||||
"Cancel",
|
"Cancel",
|
||||||
GeodeButtonSprite::Default
|
GeodeButtonSprite::Default,
|
||||||
|
m_forceDisableTheme
|
||||||
);
|
);
|
||||||
cancelDownloadSpr->setScale(.5f);
|
cancelDownloadSpr->setScale(.5f);
|
||||||
m_cancelBtn = CCMenuItemSpriteExtra::create(
|
m_cancelBtn = CCMenuItemSpriteExtra::create(
|
||||||
|
@ -567,7 +574,7 @@ bool ModPopup::setup(ModSource&& src) {
|
||||||
m_settingsBG->setContentSize(ccp(35, 30) / linksBG->getScale());
|
m_settingsBG->setContentSize(ccp(35, 30) / linksBG->getScale());
|
||||||
m_buttonMenu->addChildAtPosition(m_settingsBG, Anchor::BottomLeft, ccp(28, 25));
|
m_buttonMenu->addChildAtPosition(m_settingsBG, Anchor::BottomLeft, ccp(28, 25));
|
||||||
|
|
||||||
auto settingsSpr = createGeodeCircleButton(CCSprite::createWithSpriteFrameName("settings.png"_spr));
|
auto settingsSpr = createGeodeCircleButton(CCSprite::createWithSpriteFrameName("settings.png"_spr), 1.f, CircleBaseSize::Medium, false, m_forceDisableTheme);
|
||||||
settingsSpr->setScale(.6f);
|
settingsSpr->setScale(.6f);
|
||||||
auto settingsBtn = CCMenuItemSpriteExtra::create(
|
auto settingsBtn = CCMenuItemSpriteExtra::create(
|
||||||
settingsSpr, this, menu_selector(ModPopup::onSettings)
|
settingsSpr, this, menu_selector(ModPopup::onSettings)
|
||||||
|
@ -909,7 +916,7 @@ void ModPopup::onLoadTags(typename server::ServerRequest<std::unordered_set<std:
|
||||||
label->setScale(.35f);
|
label->setScale(.35f);
|
||||||
menu->addChildAtPosition(label, Anchor::Left, ccp(10, 0), ccp(0, .5f));
|
menu->addChildAtPosition(label, Anchor::Left, ccp(10, 0), ccp(0, .5f));
|
||||||
|
|
||||||
auto aboutSpr = createGeodeButton("About");
|
auto aboutSpr = createGeodeButton("About", false, GeodeButtonSprite::Default, m_forceDisableTheme);
|
||||||
aboutSpr->setScale(.35f);
|
aboutSpr->setScale(.35f);
|
||||||
auto aboutBtn = CCMenuItemSpriteExtra::create(
|
auto aboutBtn = CCMenuItemSpriteExtra::create(
|
||||||
aboutSpr, this, menu_selector(ModPopup::onModtoberInfo)
|
aboutSpr, this, menu_selector(ModPopup::onModtoberInfo)
|
||||||
|
|
|
@ -9,7 +9,7 @@ bool ModtoberPopup::setup() {
|
||||||
auto bg = CCSprite::createWithSpriteFrameName("modtober24-popup.png"_spr);
|
auto bg = CCSprite::createWithSpriteFrameName("modtober24-popup.png"_spr);
|
||||||
m_mainLayer->addChildAtPosition(bg, Anchor::Center);
|
m_mainLayer->addChildAtPosition(bg, Anchor::Center);
|
||||||
|
|
||||||
auto supportSpr = createGeodeButton("Join");
|
auto supportSpr = createGeodeButton("Join", false, GeodeButtonSprite::Default, m_forceDisableTheme);
|
||||||
supportSpr->setScale(.8f);
|
supportSpr->setScale(.8f);
|
||||||
auto supportBtn = CCMenuItemSpriteExtra::create(
|
auto supportBtn = CCMenuItemSpriteExtra::create(
|
||||||
supportSpr, this, menu_selector(ModtoberPopup::onDiscord)
|
supportSpr, this, menu_selector(ModtoberPopup::onDiscord)
|
||||||
|
|
|
@ -26,10 +26,7 @@ static bool matchSearch(SettingNodeV3* node, std::string const& query) {
|
||||||
else {
|
else {
|
||||||
addToList |= weightedFuzzyMatch(setting->getKey(), query, 1, weighted);
|
addToList |= weightedFuzzyMatch(setting->getKey(), query, 1, weighted);
|
||||||
}
|
}
|
||||||
if (auto desc = setting->getDescription()) {
|
if (weighted < 60 + 10 * query.size()) {
|
||||||
addToList |= weightedFuzzyMatch(*desc, query, 0.02, weighted);
|
|
||||||
}
|
|
||||||
if (weighted < 2) {
|
|
||||||
addToList = false;
|
addToList = false;
|
||||||
}
|
}
|
||||||
return addToList;
|
return addToList;
|
||||||
|
@ -63,7 +60,7 @@ bool ModSettingsPopup::setup(Mod* mod) {
|
||||||
m_searchInput->setID("search-input");
|
m_searchInput->setID("search-input");
|
||||||
searchContainer->addChildAtPosition(m_searchInput, Anchor::Left, ccp(7.5f, 0), ccp(0, .5f));
|
searchContainer->addChildAtPosition(m_searchInput, Anchor::Left, ccp(7.5f, 0), ccp(0, .5f));
|
||||||
|
|
||||||
auto searchClearSpr = GeodeSquareSprite::createWithSpriteFrameName("GJ_deleteIcon_001.png");
|
auto searchClearSpr = GeodeSquareSprite::createWithSpriteFrameName("GJ_deleteIcon_001.png", nullptr, m_forceDisableTheme);
|
||||||
searchClearSpr->setScale(.45f);
|
searchClearSpr->setScale(.45f);
|
||||||
m_searchClearBtn = CCMenuItemSpriteExtra::create(
|
m_searchClearBtn = CCMenuItemSpriteExtra::create(
|
||||||
searchClearSpr, this, menu_selector(ModSettingsPopup::onClearSearch)
|
searchClearSpr, this, menu_selector(ModSettingsPopup::onClearSearch)
|
||||||
|
@ -91,7 +88,7 @@ bool ModSettingsPopup::setup(Mod* mod) {
|
||||||
m_list->m_contentLayer->setLayout(
|
m_list->m_contentLayer->setLayout(
|
||||||
ColumnLayout::create()
|
ColumnLayout::create()
|
||||||
->setAxisReverse(true)
|
->setAxisReverse(true)
|
||||||
->setAutoGrowAxis(layerSize.height)
|
->setAutoGrowAxis(m_list->getContentHeight())
|
||||||
->setCrossAxisOverflow(false)
|
->setCrossAxisOverflow(false)
|
||||||
->setAxisAlignment(AxisAlignment::End)
|
->setAxisAlignment(AxisAlignment::End)
|
||||||
->setGap(0)
|
->setGap(0)
|
||||||
|
@ -107,7 +104,7 @@ bool ModSettingsPopup::setup(Mod* mod) {
|
||||||
|
|
||||||
// layer borders
|
// layer borders
|
||||||
|
|
||||||
m_mainLayer->addChildAtPosition(createGeodeListBorders(layerSize), Anchor::Center);
|
m_mainLayer->addChildAtPosition(createGeodeListBorders(layerSize, m_forceDisableTheme), Anchor::Center);
|
||||||
|
|
||||||
auto scrollBar = Scrollbar::create(m_list);
|
auto scrollBar = Scrollbar::create(m_list);
|
||||||
m_mainLayer->addChildAtPosition(
|
m_mainLayer->addChildAtPosition(
|
||||||
|
@ -122,14 +119,14 @@ bool ModSettingsPopup::setup(Mod* mod) {
|
||||||
m_applyMenu->getLayout()->ignoreInvisibleChildren(true);
|
m_applyMenu->getLayout()->ignoreInvisibleChildren(true);
|
||||||
m_applyMenu->setTouchPriority(buttonPriority);
|
m_applyMenu->setTouchPriority(buttonPriority);
|
||||||
|
|
||||||
auto restartBtnSpr = createGeodeButton("Restart Now", true);
|
auto restartBtnSpr = createGeodeButton("Restart Now", true, GeodeButtonSprite::Default, m_forceDisableTheme);
|
||||||
restartBtnSpr->setScale(.6f);
|
restartBtnSpr->setScale(.6f);
|
||||||
m_restartBtn = CCMenuItemSpriteExtra::create(
|
m_restartBtn = CCMenuItemSpriteExtra::create(
|
||||||
restartBtnSpr, this, menu_selector(ModSettingsPopup::onRestart)
|
restartBtnSpr, this, menu_selector(ModSettingsPopup::onRestart)
|
||||||
);
|
);
|
||||||
m_applyMenu->addChildAtPosition(m_restartBtn, Anchor::Bottom, ccp(0, 20));
|
m_applyMenu->addChildAtPosition(m_restartBtn, Anchor::Bottom, ccp(0, 20));
|
||||||
|
|
||||||
m_applyBtnSpr = createGeodeButton("Apply", true);
|
m_applyBtnSpr = createGeodeButton("Apply", true, GeodeButtonSprite::Default, m_forceDisableTheme);
|
||||||
m_applyBtnSpr->setScale(.6f);
|
m_applyBtnSpr->setScale(.6f);
|
||||||
m_applyBtn = CCMenuItemSpriteExtra::create(
|
m_applyBtn = CCMenuItemSpriteExtra::create(
|
||||||
m_applyBtnSpr, this, menu_selector(ModSettingsPopup::onApply)
|
m_applyBtnSpr, this, menu_selector(ModSettingsPopup::onApply)
|
||||||
|
@ -138,7 +135,7 @@ bool ModSettingsPopup::setup(Mod* mod) {
|
||||||
|
|
||||||
m_mainLayer->addChildAtPosition(m_applyMenu, Anchor::Bottom, ccp(0, 20));
|
m_mainLayer->addChildAtPosition(m_applyMenu, Anchor::Bottom, ccp(0, 20));
|
||||||
|
|
||||||
auto resetBtnSpr = createGeodeButton("Reset All", true);
|
auto resetBtnSpr = createGeodeButton("Reset All", true, GeodeButtonSprite::Default, m_forceDisableTheme);
|
||||||
resetBtnSpr->setScale(.6f);
|
resetBtnSpr->setScale(.6f);
|
||||||
|
|
||||||
auto resetBtn = CCMenuItemSpriteExtra::create(
|
auto resetBtn = CCMenuItemSpriteExtra::create(
|
||||||
|
@ -163,7 +160,7 @@ bool ModSettingsPopup::setup(Mod* mod) {
|
||||||
folderSprSub->setOpacity(155);
|
folderSprSub->setOpacity(155);
|
||||||
folderSprSub->setScale(.55f);
|
folderSprSub->setScale(.55f);
|
||||||
folderSpr->addChildAtPosition(folderSprSub, Anchor::Center, ccp(0, -3));
|
folderSpr->addChildAtPosition(folderSprSub, Anchor::Center, ccp(0, -3));
|
||||||
auto buttonSpr = createGeodeButton(folderSpr, "");
|
auto buttonSpr = createGeodeButton(folderSpr, "", GeodeButtonSprite::Default, m_forceDisableTheme);
|
||||||
buttonSpr->setScale(.6f);
|
buttonSpr->setScale(.6f);
|
||||||
buttonSpr->getIcon()->setScale(buttonSpr->getIcon()->getScale() * 1.4f);
|
buttonSpr->getIcon()->setScale(buttonSpr->getIcon()->getScale() * 1.4f);
|
||||||
auto folderBtn = CCMenuItemSpriteExtra::create(
|
auto folderBtn = CCMenuItemSpriteExtra::create(
|
||||||
|
|
|
@ -151,14 +151,14 @@ ListBorders* ListBorders::create() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListBorders::setSpriteFrames(const char* topAndBottom, const char* side, float topPadding) {
|
void ListBorders::setSpriteFrames(const char* topAndBottom, const char* side, float horizontalPadding) {
|
||||||
this->setSprites(
|
this->setSprites(
|
||||||
CCScale9Sprite::createWithSpriteFrameName(topAndBottom),
|
CCScale9Sprite::createWithSpriteFrameName(topAndBottom),
|
||||||
CCScale9Sprite::createWithSpriteFrameName(topAndBottom),
|
CCScale9Sprite::createWithSpriteFrameName(topAndBottom),
|
||||||
CCSprite::createWithSpriteFrameName(side),
|
CCSprite::createWithSpriteFrameName(side),
|
||||||
CCSprite::createWithSpriteFrameName(side),
|
CCSprite::createWithSpriteFrameName(side),
|
||||||
topPadding,
|
horizontalPadding,
|
||||||
topPadding
|
horizontalPadding
|
||||||
);
|
);
|
||||||
m_bottom->setScaleY(-1);
|
m_bottom->setScaleY(-1);
|
||||||
m_right->setFlipX(true);
|
m_right->setFlipX(true);
|
||||||
|
|
|
@ -151,7 +151,6 @@ void TextInput::setCallback(std::function<void(std::string const&)> onInput) {
|
||||||
m_onInput = onInput;
|
m_onInput = onInput;
|
||||||
}
|
}
|
||||||
void TextInput::setEnabled(bool enabled) {
|
void TextInput::setEnabled(bool enabled) {
|
||||||
m_input->setMouseEnabled(enabled);
|
|
||||||
m_input->setTouchEnabled(enabled);
|
m_input->setTouchEnabled(enabled);
|
||||||
m_input->m_placeholderLabel->setOpacity(enabled ? 255 : 150);
|
m_input->m_placeholderLabel->setOpacity(enabled ? 255 : 150);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue