Skip to content

Commit

Permalink
Merge pull request #2 from Alphalaneous/android-fix
Browse files Browse the repository at this point in the history
Android fix
  • Loading branch information
Alphalaneous authored May 22, 2024
2 parents 7a47293 + 66da33a commit 5be1801
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 121 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
- name: Windows
os: windows-latest

# - name: macOS
# os: macos-latest
- name: macOS
os: macos-latest

- name: Android32
os: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"win": "2.204",
"android": "2.205"
},
"version": "v1.1.1",
"version": "v1.1.3",
"id": "alphalaneous.happy_textures",
"name": "Happy Textures :3",
"developer": "Alphalaneous",
Expand Down
6 changes: 3 additions & 3 deletions src/NodeModding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using namespace geode::prelude;


#include <Geode/modify/CCNode.hpp>
modifyNodeForType(CCNode, init, (), ());

Expand All @@ -15,8 +16,8 @@ modifyNodeForType(CCSprite, initWithSpriteFrameName, (const char *p0), (p0));
modifyNodeForType(CCSprite, initWithFile, (const char *p0, const CCRect& p1), (p0, p1));

#include <Geode/modify/CCMenu.hpp>
modifyNodeForType(CCMenu, init, (), ());
modifyNodeForType(CCMenu, initWithArray, (CCArray* p0), (p0));
modifyNodeForTypeCreate(CCMenu, create, (), ());
modifyNodeForTypeCreate(CCMenu, createWithArray, (CCArray* p0), (p0));

#include <Geode/modify/CCMenuItemSpriteExtra.hpp>
modifyNodeForTypeCreate(CCMenuItemSpriteExtra, create, (cocos2d::CCNode* p0, cocos2d::CCNode* p1, cocos2d::CCObject* p2, cocos2d::SEL_MenuHandler p3), (p0, p1, p2, p3));
Expand Down Expand Up @@ -91,4 +92,3 @@ modifyNodeForType(GJDifficultySprite, init, (int p0, GJDifficultyName p1), (p0,
#include <Geode/modify/GJCommentListLayer.hpp>
modifyNodeForTypeCreate(GJCommentListLayer, create, (BoomListView* p0, char const* p1, cocos2d::ccColor4B p2, float p3, float p4, bool p5), (p0, p1, p2, p3, p4, p5));


6 changes: 5 additions & 1 deletion src/nodes/CCMenuItemSpriteExtra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ void EventCCMenuItemSpriteExtra::activate(){

CCMenuItemSpriteExtra* EventCCMenuItemSpriteExtra::create(cocos2d::CCNode* p0, cocos2d::CCNode* p1, cocos2d::CCObject* p2, cocos2d::SEL_MenuHandler p3){
auto ret = CCMenuItemSpriteExtra::create(p0, p1, p2, p3);
ret->schedule(schedule_selector(EventCCMenuItemSpriteExtra::checkTouch), 1/30);
if(UIModding::get()->doModify){
#ifndef GEODE_IS_ANDROID
ret->schedule(schedule_selector(EventCCMenuItemSpriteExtra::checkTouch), 1/30);
#endif
}
return ret;
}

Expand Down
92 changes: 47 additions & 45 deletions src/nodes/CommentCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,58 +17,60 @@ class $modify(CommentCell) {
void updateBGColor(int p0) {

CommentCell::updateBGColor(p0);
CCLayerColor* child = getChildOfType<CCLayerColor>(this, 0);
CCLayer* layer = getChildOfType<CCLayer>(this, 1);
CCScale9Sprite* bg = getChildOfType<CCScale9Sprite>(layer, 0);
if(UIModding::get()->doModify){
CCLayerColor* child = getChildOfType<CCLayerColor>(this, 0);
CCLayer* layer = getChildOfType<CCLayer>(this, 1);
CCScale9Sprite* bg = getChildOfType<CCScale9Sprite>(layer, 0);

if(child->getColor() == ccColor3B{161,88,44}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("comment-cell-odd");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);
}
if(bg){
std::optional<ColorData> dataOpt2 = UIModding::get()->getColors("comment-cell-bg-odd");
if(dataOpt2.has_value()){
ColorData data = dataOpt2.value();
bg->setColor(data.color);
bg->setOpacity(data.alpha);
if(child->getColor() == ccColor3B{161,88,44}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("comment-cell-odd");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);
}
if(bg){
std::optional<ColorData> dataOpt2 = UIModding::get()->getColors("comment-cell-bg-odd");
if(dataOpt2.has_value()){
ColorData data = dataOpt2.value();
bg->setColor(data.color);
bg->setOpacity(data.alpha);
}
}
}
}
else if(child->getColor() == ccColor3B{194,114,62}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("comment-cell-even");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);
}
if(bg){
std::optional<ColorData> dataOpt2 = UIModding::get()->getColors("comment-cell-bg-even");
if(dataOpt2.has_value()){
ColorData data = dataOpt2.value();
bg->setColor(data.color);
bg->setOpacity(data.alpha);
else if(child->getColor() == ccColor3B{194,114,62}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("comment-cell-even");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);
}
if(bg){
std::optional<ColorData> dataOpt2 = UIModding::get()->getColors("comment-cell-bg-even");
if(dataOpt2.has_value()){
ColorData data = dataOpt2.value();
bg->setColor(data.color);
bg->setOpacity(data.alpha);
}
}
}
}
else if(child->getColor() == ccColor3B{156,85,42}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("comment-cell-small-odd");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);
else if(child->getColor() == ccColor3B{156,85,42}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("comment-cell-small-odd");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);
}
}
}
else if(child->getColor() == ccColor3B{144,79,39}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("comment-cell-small-even");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);
else if(child->getColor() == ccColor3B{144,79,39}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("comment-cell-small-even");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);
}
}
}
}
}
};

Expand Down
16 changes: 9 additions & 7 deletions src/nodes/GJCommentListLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ class $modify(MyGJCommentListLayer, GJCommentListLayer) {

static GJCommentListLayer* create(BoomListView* p0, char const* p1, cocos2d::ccColor4B p2, float p3, float p4, bool p5) {
auto ret = GJCommentListLayer::create(p0, p1, p2, p3, p4, p5);
if(ret->getColor() == ccColor3B{191,114,62}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("comment-list-layer-bg");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
ret->setColor(data.color);
ret->setOpacity(data.alpha);
}
if(UIModding::get()->doModify){
if(ret->getColor() == ccColor3B{191,114,62}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("comment-list-layer-bg");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
ret->setColor(data.color);
ret->setOpacity(data.alpha);
}
}
}
return ret;
}
Expand Down
24 changes: 13 additions & 11 deletions src/nodes/GJDropDownLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,23 @@ class $modify(MyGJDropDownLayer, GJDropDownLayer){

void showLayer(bool p0){
GJDropDownLayer::showLayer(p0);
removeFromParent();
CCScene* currentScene = CCDirector::get()->getRunningScene();
currentScene->addChild(this);
if(UIModding::get()->doModify){
removeFromParent();
CCScene* currentScene = CCDirector::get()->getRunningScene();
currentScene->addChild(this);

CCMoveTo* moveTo = CCMoveTo::create(0.5, m_endPosition);
CCEaseInOut* easeInOut = CCEaseInOut::create(moveTo, 2.0);
CCSequence* sequence = CCSequence::create(easeInOut, 0);
CCMoveTo* moveTo = CCMoveTo::create(0.5, m_endPosition);
CCEaseInOut* easeInOut = CCEaseInOut::create(moveTo, 2.0);
CCSequence* sequence = CCSequence::create(easeInOut, 0);

m_mainLayer->runAction(sequence);
m_mainLayer->runAction(sequence);

CCFadeTo* fadeTo = CCFadeTo::create(0.5, 125);
runAction(fadeTo);
CCFadeTo* fadeTo = CCFadeTo::create(0.5, 125);
runAction(fadeTo);

if(UIModding::get()->doModify){
UIModding::get()->doUICheck(this);
if(UIModding::get()->doModify){
UIModding::get()->doUICheck(this);
}
}
}
};
Expand Down
16 changes: 9 additions & 7 deletions src/nodes/GJListLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ class $modify(MyGJListLayer, GJListLayer) {

static GJListLayer* create(BoomListView* p0, char const* p1, cocos2d::ccColor4B p2, float p3, float p4, int p5) {
auto ret = GJListLayer::create(p0, p1, p2, p3, p4, p5);
if(ret->getColor() == ccColor3B{191,114,62}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("list-layer-bg");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
ret->setColor(data.color);
ret->setOpacity(data.alpha);
}
if(UIModding::get()->doModify){
if(ret->getColor() == ccColor3B{191,114,62}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("list-layer-bg");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
ret->setColor(data.color);
ret->setOpacity(data.alpha);
}
}
}
return ret;
}
Expand Down
35 changes: 19 additions & 16 deletions src/nodes/LevelCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,27 @@ class $modify(MyLevelCell, LevelCell) {
void updateBGColor(int p0) {

LevelCell::updateBGColor(p0);
CCLayerColor* child = getChildOfType<CCLayerColor>(this, 0);

if(child->getColor() == ccColor3B{161,88,44}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("list-cell-odd");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);

if(UIModding::get()->doModify){
CCLayerColor* child = getChildOfType<CCLayerColor>(this, 0);

if(child->getColor() == ccColor3B{161,88,44}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("list-cell-odd");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);
}
}
}
else if(child->getColor() == ccColor3B{194,114,62}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("list-cell-even");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);
else if(child->getColor() == ccColor3B{194,114,62}){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("list-cell-even");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);
}
}
}
}
}
};

Expand Down
59 changes: 31 additions & 28 deletions src/nodes/MenuGameLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,40 @@ class $modify(MyMenuGameLayer, MenuGameLayer){
void update(float p0){
MenuGameLayer::update(p0);

CCSprite* bg = getChildOfType<CCSprite>(this, 0);
GJGroundLayer* ground = getChildOfType<GJGroundLayer>(this, 0);

if(bg){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("main-menu-bg");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
bg->setColor(data.color);
bg->setOpacity(data.alpha);
if(UIModding::get()->doModify){

CCSprite* bg = getChildOfType<CCSprite>(this, 0);
GJGroundLayer* ground = getChildOfType<GJGroundLayer>(this, 0);

if(bg){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("main-menu-bg");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
bg->setColor(data.color);
bg->setOpacity(data.alpha);
}
}
}
if(ground){
CCSpriteBatchNode* groundBatch = getChildOfType<CCSpriteBatchNode>(ground, 0);
if(groundBatch){
CCSprite* groundSprite = getChildOfType<CCSprite>(groundBatch, 0);
if(groundSprite){
for(CCNode* node : CCArrayExt<CCNode*>(groundSprite->getChildren())){
if(CCSprite* child = dynamic_cast<CCSprite*>(node)){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("main-menu-ground");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);
if(ground){
CCSpriteBatchNode* groundBatch = getChildOfType<CCSpriteBatchNode>(ground, 0);
if(groundBatch){
CCSprite* groundSprite = getChildOfType<CCSprite>(groundBatch, 0);
if(groundSprite){
for(CCNode* node : CCArrayExt<CCNode*>(groundSprite->getChildren())){
if(CCSprite* child = dynamic_cast<CCSprite*>(node)){
std::optional<ColorData> dataOpt = UIModding::get()->getColors("main-menu-ground");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
child->setColor(data.color);
child->setOpacity(data.alpha);
}
}
}
}
std::optional<ColorData> dataOpt = UIModding::get()->getColors("main-menu-ground");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
groundSprite->setColor(data.color);
groundSprite->setOpacity(data.alpha);
std::optional<ColorData> dataOpt = UIModding::get()->getColors("main-menu-ground");
if(dataOpt.has_value()){
ColorData data = dataOpt.value();
groundSprite->setColor(data.color);
groundSprite->setOpacity(data.alpha);
}
}
}
}
Expand Down

0 comments on commit 5be1801

Please sign in to comment.