From 7adb29a7b234084a9d880f7c8f29c80660784155 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Wed, 22 May 2024 04:25:30 -0400 Subject: [PATCH] fixes --- src/nodes/CCMenuItemSpriteExtra.cpp | 4 +- src/nodes/CommentCell.h | 92 +++++++++++++++-------------- src/nodes/GJCommentListLayer.h | 16 ++--- src/nodes/GJDropDownLayer.h | 24 ++++---- src/nodes/GJListLayer.h | 16 ++--- src/nodes/LevelCell.h | 35 ++++++----- src/nodes/MenuGameLayer.h | 59 +++++++++--------- 7 files changed, 131 insertions(+), 115 deletions(-) diff --git a/src/nodes/CCMenuItemSpriteExtra.cpp b/src/nodes/CCMenuItemSpriteExtra.cpp index 5cfed30..96b681f 100644 --- a/src/nodes/CCMenuItemSpriteExtra.cpp +++ b/src/nodes/CCMenuItemSpriteExtra.cpp @@ -79,9 +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); + if(UIModding::get()->doModify){ #ifndef GEODE_IS_ANDROID - ret->schedule(schedule_selector(EventCCMenuItemSpriteExtra::checkTouch), 1/30); + ret->schedule(schedule_selector(EventCCMenuItemSpriteExtra::checkTouch), 1/30); #endif + } return ret; } diff --git a/src/nodes/CommentCell.h b/src/nodes/CommentCell.h index d132ae1..29208ab 100644 --- a/src/nodes/CommentCell.h +++ b/src/nodes/CommentCell.h @@ -17,58 +17,60 @@ class $modify(CommentCell) { void updateBGColor(int p0) { CommentCell::updateBGColor(p0); - CCLayerColor* child = getChildOfType(this, 0); - CCLayer* layer = getChildOfType(this, 1); - CCScale9Sprite* bg = getChildOfType(layer, 0); + if(UIModding::get()->doModify){ + CCLayerColor* child = getChildOfType(this, 0); + CCLayer* layer = getChildOfType(this, 1); + CCScale9Sprite* bg = getChildOfType(layer, 0); - if(child->getColor() == ccColor3B{161,88,44}){ - std::optional 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 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 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 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 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 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 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 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 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 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 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 dataOpt = UIModding::get()->getColors("comment-cell-small-even"); + if(dataOpt.has_value()){ + ColorData data = dataOpt.value(); + child->setColor(data.color); + child->setOpacity(data.alpha); + } } - } + } } }; diff --git a/src/nodes/GJCommentListLayer.h b/src/nodes/GJCommentListLayer.h index 427d149..7f2ead3 100644 --- a/src/nodes/GJCommentListLayer.h +++ b/src/nodes/GJCommentListLayer.h @@ -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 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 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; } diff --git a/src/nodes/GJDropDownLayer.h b/src/nodes/GJDropDownLayer.h index 65ac506..03ee2c1 100644 --- a/src/nodes/GJDropDownLayer.h +++ b/src/nodes/GJDropDownLayer.h @@ -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); + } } } }; diff --git a/src/nodes/GJListLayer.h b/src/nodes/GJListLayer.h index 49eaab1..57a31cd 100644 --- a/src/nodes/GJListLayer.h +++ b/src/nodes/GJListLayer.h @@ -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 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 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; } diff --git a/src/nodes/LevelCell.h b/src/nodes/LevelCell.h index 9378095..a1f86e9 100644 --- a/src/nodes/LevelCell.h +++ b/src/nodes/LevelCell.h @@ -17,24 +17,27 @@ class $modify(MyLevelCell, LevelCell) { void updateBGColor(int p0) { LevelCell::updateBGColor(p0); - CCLayerColor* child = getChildOfType(this, 0); - - if(child->getColor() == ccColor3B{161,88,44}){ - std::optional 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(this, 0); + + if(child->getColor() == ccColor3B{161,88,44}){ + std::optional 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 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 dataOpt = UIModding::get()->getColors("list-cell-even"); + if(dataOpt.has_value()){ + ColorData data = dataOpt.value(); + child->setColor(data.color); + child->setOpacity(data.alpha); + } } - } + } } }; diff --git a/src/nodes/MenuGameLayer.h b/src/nodes/MenuGameLayer.h index 88ae7ad..0270175 100644 --- a/src/nodes/MenuGameLayer.h +++ b/src/nodes/MenuGameLayer.h @@ -17,37 +17,40 @@ class $modify(MyMenuGameLayer, MenuGameLayer){ void update(float p0){ MenuGameLayer::update(p0); - CCSprite* bg = getChildOfType(this, 0); - GJGroundLayer* ground = getChildOfType(this, 0); - - if(bg){ - std::optional 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(this, 0); + GJGroundLayer* ground = getChildOfType(this, 0); + + if(bg){ + std::optional 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(ground, 0); - if(groundBatch){ - CCSprite* groundSprite = getChildOfType(groundBatch, 0); - if(groundSprite){ - for(CCNode* node : CCArrayExt(groundSprite->getChildren())){ - if(CCSprite* child = dynamic_cast(node)){ - std::optional 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(ground, 0); + if(groundBatch){ + CCSprite* groundSprite = getChildOfType(groundBatch, 0); + if(groundSprite){ + for(CCNode* node : CCArrayExt(groundSprite->getChildren())){ + if(CCSprite* child = dynamic_cast(node)){ + std::optional 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 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 dataOpt = UIModding::get()->getColors("main-menu-ground"); + if(dataOpt.has_value()){ + ColorData data = dataOpt.value(); + groundSprite->setColor(data.color); + groundSprite->setOpacity(data.alpha); + } } } }