mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-24 05:14:40 -04:00
add open config button
This commit is contained in:
parent
0a0a34eb5c
commit
cecc96cb33
4 changed files with 28 additions and 1 deletions
loader
BIN
loader/resources/pencil.png
Normal file
BIN
loader/resources/pencil.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 2.9 KiB |
|
@ -281,6 +281,28 @@ bool ModInfoLayer::init(ModObject* obj, ModListView* list) {
|
|||
);
|
||||
m_buttonMenu->addChild(settingsBtn);
|
||||
|
||||
// Check if a config directory for the mod exists
|
||||
// Mod::getConfigDir auto-creates the directory for user convenience, so
|
||||
// have to do it manually
|
||||
if (ghc::filesystem::exists(
|
||||
Loader::get()->getGeodeDirectory() /
|
||||
GEODE_CONFIG_DIRECTORY / m_mod->getID()
|
||||
)) {
|
||||
auto configSpr = CircleButtonSprite::createWithSpriteFrameName(
|
||||
"pencil.png"_spr, 1.f, CircleBaseColor::Green, CircleBaseSize::Medium2
|
||||
);
|
||||
configSpr->setScale(.65f);
|
||||
|
||||
auto configBtn = CCMenuItemSpriteExtra::create(
|
||||
configSpr, this, menu_selector(ModInfoLayer::onOpenConfigDir)
|
||||
);
|
||||
configBtn->setPosition(
|
||||
-size.width / 2 + 65.f,
|
||||
-size.height / 2 + 25.f
|
||||
);
|
||||
m_buttonMenu->addChild(configBtn);
|
||||
}
|
||||
|
||||
if (!m_mod->hasSettings()) {
|
||||
settingsSpr->setColor({ 150, 150, 150 });
|
||||
settingsBtn->setTarget(
|
||||
|
@ -543,6 +565,10 @@ void ModInfoLayer::onCancelInstall(CCObject*) {
|
|||
}
|
||||
}
|
||||
|
||||
void ModInfoLayer::onOpenConfigDir(CCObject*) {
|
||||
file::openFolder(m_mod->getConfigDir());
|
||||
}
|
||||
|
||||
void ModInfoLayer::onUninstall(CCObject*) {
|
||||
auto layer = FLAlertLayer::create(
|
||||
this,
|
||||
|
|
|
@ -57,6 +57,7 @@ protected:
|
|||
void onIssues(CCObject*);
|
||||
void onRepository(CCObject*);
|
||||
void onSupport(CCObject*);
|
||||
void onOpenConfigDir(CCObject*);
|
||||
void install();
|
||||
void uninstall();
|
||||
void updateInstallStatus(std::string const& status, uint8_t progress);
|
||||
|
|
|
@ -155,7 +155,7 @@ bool ModSettingsPopup::setup(Mod* mod) {
|
|||
auto openDirBtn = CCMenuItemSpriteExtra::create(
|
||||
openDirBtnSpr, this, menu_selector(ModSettingsPopup::onOpenSaveDirectory)
|
||||
);
|
||||
openDirBtn->setPosition(m_size.width / 2 - 45.f, -m_size.height / 2 + 20.f);
|
||||
openDirBtn->setPosition(m_size.width / 2 - 53.f, -m_size.height / 2 + 20.f);
|
||||
m_buttonMenu->addChild(openDirBtn);
|
||||
|
||||
this->settingValueChanged(nullptr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue