From 138fdbb1a4de0444b63fa0e6f39992d6a9d81bf6 Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Sat, 29 Jul 2023 23:58:13 +0300 Subject: [PATCH] fix CustomizeObjectLayer bindings and menus not hiding on mode change --- bindings/GeometryDash.bro | 8 ++++--- loader/src/ids/CustomizeObjectLayer.cpp | 32 ++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index c876ae9e..a9d54608 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1017,11 +1017,13 @@ 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; @@ -1029,10 +1031,10 @@ class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDele 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; diff --git a/loader/src/ids/CustomizeObjectLayer.cpp b/loader/src/ids/CustomizeObjectLayer.cpp index cca62b58..292f02a7 100644 --- a/loader/src/ids/CustomizeObjectLayer.cpp +++ b/loader/src/ids/CustomizeObjectLayer.cpp @@ -205,7 +205,7 @@ $register_ids(CustomizeObjectLayer) { textActionsMenu->setPositionX(winSize.width / 2 + 110.f); textActionsMenu->updateLayout(); - detachAndCreateMenu( + auto clearTextMenu = detachAndCreateMenu( m_mainLayer, "clear-text-menu", nullptr, @@ -280,11 +280,41 @@ struct CustomizeObjectLayerIDs : ModifygetChildByID(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; }