mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-23 07:57:51 -05:00
fix CustomizeObjectLayer bindings and menus not hiding on mode change
This commit is contained in:
parent
f78969ca83
commit
138fdbb1a4
2 changed files with 36 additions and 4 deletions
|
@ -1017,11 +1017,13 @@ class CustomSongWidget : cocos2d::CCNode, MusicDownloadDelegate, FLAlertLayerPro
|
||||||
class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDelegate, ColorSelectDelegate, ColorSetupDelegate {
|
class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDelegate, ColorSelectDelegate, ColorSetupDelegate {
|
||||||
void onNextColorChannel(cocos2d::CCObject* sender) = win 0x56c80;
|
void onNextColorChannel(cocos2d::CCObject* sender) = win 0x56c80;
|
||||||
void onSelectColor(cocos2d::CCObject* sender) = win 0x577b0;
|
void onSelectColor(cocos2d::CCObject* sender) = win 0x577b0;
|
||||||
|
void onSelectMode(cocos2d::CCObject* sender) = mac 0xdf820, win 0x56db0;
|
||||||
int getActiveMode(bool unknown) = win 0x57210;
|
int getActiveMode(bool unknown) = win 0x57210;
|
||||||
void onClose(cocos2d::CCObject*) = mac 0xdf660, win 0x57ac0;
|
void onClose(cocos2d::CCObject*) = mac 0xdf660, win 0x57ac0;
|
||||||
void updateSelected(int channelID) = win 0x57850;
|
void updateSelected(int channelID) = win 0x57850;
|
||||||
bool init(GameObject* target, cocos2d::CCArray* targets) = mac 0xdd560, win 0x53e00;
|
bool init(GameObject* target, cocos2d::CCArray* targets) = mac 0xdd560, win 0x53e00;
|
||||||
void onHSV(cocos2d::CCObject* sender) = win 0x567c0;
|
void onHSV(cocos2d::CCObject* sender) = win 0x567c0;
|
||||||
|
void toggleVisible() = mac 0xe1140, win 0x56fb0;
|
||||||
virtual void hsvPopupClosed(HSVWidgetPopup* popup, cocos2d::ccHSVValue value) = win 0x56990;
|
virtual void hsvPopupClosed(HSVWidgetPopup* popup, cocos2d::ccHSVValue value) = win 0x56990;
|
||||||
inline CustomizeObjectLayer() {}
|
inline CustomizeObjectLayer() {}
|
||||||
~CustomizeObjectLayer() = win 0x53c30;
|
~CustomizeObjectLayer() = win 0x53c30;
|
||||||
|
@ -1029,10 +1031,10 @@ class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDele
|
||||||
GameObject* m_targetObject;
|
GameObject* m_targetObject;
|
||||||
cocos2d::CCArray* m_targetObjects;
|
cocos2d::CCArray* m_targetObjects;
|
||||||
cocos2d::CCArray* m_colorButtons;
|
cocos2d::CCArray* m_colorButtons;
|
||||||
cocos2d::CCArray* m_colorNodes;
|
cocos2d::CCArray* m_baseTabNodes;
|
||||||
cocos2d::CCArray* m_textInputNodes;
|
cocos2d::CCArray* m_textTabNodes;
|
||||||
PAD = win 0x4;
|
PAD = win 0x4;
|
||||||
cocos2d::CCArray* m_detailColorButtons;
|
cocos2d::CCArray* m_detailTabNodes;
|
||||||
int m_selectedMode;
|
int m_selectedMode;
|
||||||
int m_customColorChannel;
|
int m_customColorChannel;
|
||||||
bool m_unk0x200;
|
bool m_unk0x200;
|
||||||
|
|
|
@ -205,7 +205,7 @@ $register_ids(CustomizeObjectLayer) {
|
||||||
textActionsMenu->setPositionX(winSize.width / 2 + 110.f);
|
textActionsMenu->setPositionX(winSize.width / 2 + 110.f);
|
||||||
textActionsMenu->updateLayout();
|
textActionsMenu->updateLayout();
|
||||||
|
|
||||||
detachAndCreateMenu(
|
auto clearTextMenu = detachAndCreateMenu(
|
||||||
m_mainLayer,
|
m_mainLayer,
|
||||||
"clear-text-menu",
|
"clear-text-menu",
|
||||||
nullptr,
|
nullptr,
|
||||||
|
@ -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) {
|
bool init(GameObject* obj, CCArray* objs) {
|
||||||
if (!CustomizeObjectLayer::init(obj, objs))
|
if (!CustomizeObjectLayer::init(obj, objs))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
NodeIDs::get()->provide(this);
|
NodeIDs::get()->provide(this);
|
||||||
|
this->toggleVisible();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue