-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a04c043
commit e20f24e
Showing
12 changed files
with
164 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,18 @@ | ||
#include "PackCell.h" | ||
#include "PackCell.h" | ||
|
||
bool PackCell::init(PackInfo* packInfo) { | ||
if (!CCNode::init()) return false; | ||
|
||
this->m_packInfo = packInfo; | ||
|
||
m_bg = CCScale9Sprite::create("square02b_small.png"); | ||
m_bg->setID("bg"); | ||
m_bg->setOpacity(0); | ||
m_bg->ignoreAnchorPointForPosition(false); | ||
m_bg->setAnchorPoint({ .0f, .0f }); | ||
m_bg->setScale(.7f); | ||
m_bg->setColor(ccWHITE); | ||
m_bg->setOpacity(25); | ||
this->addChild(m_bg); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,29 @@ | ||
#pragma once | ||
|
||
#include <Geode/Geode.hpp> | ||
#include "utils/PackInfo.h" | ||
|
||
using namespace geode::prelude; | ||
|
||
class PackCell : public CCNode { | ||
protected: | ||
bool init(PackInfo* packInfo); | ||
|
||
void onEnable(CCObject*); | ||
|
||
public: | ||
CCScale9Sprite* m_bg; | ||
CCNode* m_logo; | ||
CCNode* m_infoContainer; | ||
CCNode* m_titleContainer; | ||
CCLabelBMFont* m_titleLabel; | ||
CCLabelBMFont* m_versionLabel; | ||
CCNode* m_developers; | ||
CCLabelBMFont* m_developerLabel; | ||
CCMenu* m_viewMenu; | ||
CCMenuItemToggler* m_enableToggle = nullptr; | ||
|
||
PackInfo* m_packInfo; | ||
|
||
using namespace geode::prelude; | ||
static PackCell* create(PackInfo* packInfo); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,72 @@ | ||
#include "PackSelectList.h" | ||
#include "PackSelectList.h" | ||
|
||
using namespace geode::prelude; | ||
|
||
bool PackSelectList::init(CCSize const& size) { | ||
if (!CCNode::init()) return false; | ||
|
||
this->setContentSize(size); | ||
this->setAnchorPoint({.5f, .5f}); | ||
this->setID("pack-select-list"); | ||
|
||
m_list = ScrollLayer::create(size); | ||
m_list->m_contentLayer->setLayout( | ||
ColumnLayout::create() | ||
->setAxisReverse(true) | ||
->setAxisAlignment(AxisAlignment::End) | ||
->setAutoGrowAxis(size.height) | ||
->setGap(2.5f) | ||
); | ||
m_list->scrollToTop(); | ||
this->addChildAtPosition(m_list, Anchor::Bottom, ccp(-m_list->getScaledContentWidth() / 2, 0)); | ||
|
||
m_topContainer = CCNode::create(); | ||
m_topContainer->setID("top-container"); | ||
m_topContainer->ignoreAnchorPointForPosition(false); | ||
m_topContainer->setContentWidth(size.width); | ||
m_topContainer->setAnchorPoint({ .5f, 1.f }); | ||
|
||
float totalHeight = .0f; | ||
|
||
m_btnMenu = CCMenu::create(); | ||
m_btnMenu->setID("button-menu"); | ||
|
||
auto importPackBtnSpr = ButtonSprite::create("Import Pack", "bigFont.fnt", "geode-button.png"_spr); | ||
importPackBtnSpr->setScale(0.65f); | ||
m_importPackBtn = CCMenuItemSpriteExtra::create( | ||
importPackBtnSpr, this, menu_selector(PackSelectList::onImportPack) | ||
); | ||
m_btnMenu->addChild(m_importPackBtn); | ||
m_btnMenu->setLayout(RowLayout::create()); | ||
m_btnMenu->getLayout()->ignoreInvisibleChildren(true); | ||
|
||
this->addChildAtPosition(m_btnMenu, Anchor::Bottom, ccp(0, -13.f)); | ||
|
||
this->getAllPacks(); | ||
|
||
return true; | ||
} | ||
|
||
void PackSelectList::getAllPacks() { | ||
Zip* zip = new Zip(""); | ||
if (!fs::exists(fmt::format("{}/geodepacks", geode::dirs::getGeodeDir()))) { | ||
fs::create_directory(fmt::format("{}/geodepacks", geode::dirs::getGeodeDir())); | ||
} | ||
for (auto file : fs::directory_iterator(fmt::format("{}/geodepacks", geode::dirs::getGeodeDir()))) { | ||
zip->unzipIntoFolder(file.path().string(), fmt::format("{}/geodepacks/{}", geode::dirs::getGeodeDir(), file.path().stem().string())); | ||
} | ||
} | ||
|
||
void PackSelectList::onImportPack(CCObject*) { | ||
|
||
} | ||
|
||
PackSelectList* PackSelectList::create(CCSize const& size) { | ||
auto ret = new PackSelectList(); | ||
if (ret && ret->init(size)) { | ||
ret->autorelease(); | ||
return ret; | ||
} | ||
CC_SAFE_DELETE(ret); | ||
return nullptr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
#include <Geode/Geode.hpp> | ||
|
||
using namespace geode::prelude; | ||
using namespace geode::prelude; | ||
#include <filesystem> | ||
#include "utils/PackInfo.h" | ||
#include "utils/ziputils.h" | ||
using namespace geode::prelude; | ||
namespace fs = std::filesystem; | ||
using FileTask = Task<Result<fs::path>>; | ||
|
||
class PackSelectList : public CCNode { | ||
protected: | ||
ScrollLayer* m_list; | ||
CCNode* m_topContainer; | ||
CCMenu* m_btnMenu; | ||
CCMenuItemSpriteExtra* m_importPackBtn; | ||
|
||
bool init(CCSize const& size); | ||
void getAllPacks(); | ||
|
||
void onImportPack(CCObject*); | ||
|
||
public: | ||
static PackSelectList* create(CCSize const& size); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters