Skip to content

Commit

Permalink
fix CustomizeObjectLayer bindings and menus not hiding on mode change
Browse files Browse the repository at this point in the history
  • Loading branch information
HJfod committed Jul 29, 2023
1 parent f78969c commit 138fdbb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
8 changes: 5 additions & 3 deletions bindings/GeometryDash.bro
Original file line number Diff line number Diff line change
Expand Up @@ -1017,22 +1017,24 @@ class CustomSongWidget : cocos2d::CCNode, MusicDownloadDelegate, FLAlertLayerPro
class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDelegate, ColorSelectDelegate, ColorSetupDelegate {
void onNextColorChannel(cocos2d::CCObject* sender) = win 0x56c80;
void onSelectColor(cocos2d::CCObject* sender) = win 0x577b0;
void onSelectMode(cocos2d::CCObject* sender) = mac 0xdf820, win 0x56db0;
int getActiveMode(bool unknown) = win 0x57210;
void onClose(cocos2d::CCObject*) = mac 0xdf660, win 0x57ac0;
void updateSelected(int channelID) = win 0x57850;
bool init(GameObject* target, cocos2d::CCArray* targets) = mac 0xdd560, win 0x53e00;
void onHSV(cocos2d::CCObject* sender) = win 0x567c0;
void toggleVisible() = mac 0xe1140, win 0x56fb0;
virtual void hsvPopupClosed(HSVWidgetPopup* popup, cocos2d::ccHSVValue value) = win 0x56990;
inline CustomizeObjectLayer() {}
~CustomizeObjectLayer() = win 0x53c30;

GameObject* m_targetObject;
cocos2d::CCArray* m_targetObjects;
cocos2d::CCArray* m_colorButtons;
cocos2d::CCArray* m_colorNodes;
cocos2d::CCArray* m_textInputNodes;
cocos2d::CCArray* m_baseTabNodes;
cocos2d::CCArray* m_textTabNodes;
PAD = win 0x4;
cocos2d::CCArray* m_detailColorButtons;
cocos2d::CCArray* m_detailTabNodes;
int m_selectedMode;
int m_customColorChannel;
bool m_unk0x200;
Expand Down
32 changes: 31 additions & 1 deletion loader/src/ids/CustomizeObjectLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ using namespace geode::prelude;
textActionsMenu->setPositionX(winSize.width / 2 + 110.f);
textActionsMenu->updateLayout();

detachAndCreateMenu(
auto clearTextMenu = detachAndCreateMenu(
m_mainLayer,
"clear-text-menu",
nullptr,
Expand Down Expand Up @@ -280,11 +280,41 @@ struct CustomizeObjectLayerIDs : Modify<CustomizeObjectLayerIDs, CustomizeObject
}
}

void toggleMenuIf(const char* id, int mode) {
if (auto menu = m_mainLayer->getChildByID(id)) {
menu->setVisible(m_selectedMode == mode);
}
}

void toggleMenuIfNot(const char* id, int mode) {
if (auto menu = m_mainLayer->getChildByID(id)) {
menu->setVisible(m_selectedMode != mode);
}
}

void toggleVisible() {
CustomizeObjectLayer::toggleVisible();
// have to manually toggle menu visibility to allow touches being correctly passed
this->toggleMenuIf("base-hsv-menu", 1);
this->toggleMenuIf("detail-hsv-menu", 2);
this->toggleMenuIf("text-actions-menu", 3);
this->toggleMenuIf("clear-text-menu", 3);
this->toggleMenuIfNot("next-free-menu", 3);
this->toggleMenuIfNot("toggles-menu", 3);
this->toggleMenuIfNot("channels-menu", 3);
this->toggleMenuIfNot("special-channels-menu", 3);
this->toggleMenuIfNot("selected-channel-menu", 3);
this->toggleMenuIfNot("browse-menu", 3);
this->toggleMenuIfNot("copy-paste-menu", 3);
this->toggleMenuIfNot("select-channel-menu", 3);
}

bool init(GameObject* obj, CCArray* objs) {
if (!CustomizeObjectLayer::init(obj, objs))
return false;

NodeIDs::get()->provide(this);
this->toggleVisible();

return true;
}
Expand Down

0 comments on commit 138fdbb

Please sign in to comment.