mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-22 23:48:08 -05:00
comment out ids except menulayer
This commit is contained in:
parent
0ed0e25401
commit
f021b726be
16 changed files with 1838 additions and 1850 deletions
|
@ -1,15 +0,0 @@
|
|||
#include <Geode/modify/GJBaseGameLayer.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
struct PickupTriggerFix : Modify<PickupTriggerFix, GJBaseGameLayer> {
|
||||
void collectItem(int item, int count) {
|
||||
item = std::clamp(item, 0, 1099);
|
||||
GJBaseGameLayer::collectItem(item, count);
|
||||
}
|
||||
|
||||
void collectedObject(EffectGameObject* object) {
|
||||
object->m_itemBlockAID = std::clamp(object->m_itemBlockAID, 0, 1099);
|
||||
GJBaseGameLayer::collectedObject(object);
|
||||
}
|
||||
};
|
|
@ -6,26 +6,26 @@
|
|||
// ignoreAnchorPointForPosition which causes the content size of
|
||||
// text input nodes to be way off
|
||||
|
||||
struct $modify(CCTextInputNode) {
|
||||
bool init(float width, float height, const char* caption, const char* thonburi, int maxCharCount, const char* font) {
|
||||
if (!CCTextInputNode::init(width, height, caption, thonburi, maxCharCount, font))
|
||||
return false;
|
||||
// struct $modify(CCTextInputNode) {
|
||||
// bool init(float width, float height, const char* caption, const char* thonburi, int maxCharCount, const char* font) {
|
||||
// if (!CCTextInputNode::init(width, height, caption, thonburi, maxCharCount, font))
|
||||
// return false;
|
||||
|
||||
this->ignoreAnchorPointForPosition(false);
|
||||
this->fixPosition();
|
||||
// this->ignoreAnchorPointForPosition(false);
|
||||
// this->fixPosition();
|
||||
|
||||
return true;
|
||||
}
|
||||
// return true;
|
||||
// }
|
||||
|
||||
void fixPosition() {
|
||||
if (!m_bIgnoreAnchorPointForPosition && m_placeholderLabel) {
|
||||
this->setAnchorPoint(m_placeholderLabel->getAnchorPoint());
|
||||
m_placeholderLabel->setPosition(m_obContentSize * m_obAnchorPoint);
|
||||
}
|
||||
}
|
||||
// void fixPosition() {
|
||||
// if (!m_bIgnoreAnchorPointForPosition && m_placeholderLabel) {
|
||||
// this->setAnchorPoint(m_placeholderLabel->getAnchorPoint());
|
||||
// m_placeholderLabel->setPosition(m_obContentSize * m_obAnchorPoint);
|
||||
// }
|
||||
// }
|
||||
|
||||
void updateLabel(gd::string text) {
|
||||
CCTextInputNode::updateLabel(text);
|
||||
this->fixPosition();
|
||||
}
|
||||
};
|
||||
// void updateLabel(gd::string text) {
|
||||
// CCTextInputNode::updateLabel(text);
|
||||
// this->fixPosition();
|
||||
// }
|
||||
// };
|
||||
|
|
|
@ -17,121 +17,121 @@ static void reorderButtons(Args... args) {
|
|||
}
|
||||
}
|
||||
|
||||
$register_ids(CreatorLayer) {
|
||||
setIDSafe<CCSprite>(this, 0, "background");
|
||||
// $register_ids(CreatorLayer) {
|
||||
// setIDSafe<CCSprite>(this, 0, "background");
|
||||
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
// auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("creator-buttons-menu");
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
// menu->setID("creator-buttons-menu");
|
||||
|
||||
// move vault button to its own menu
|
||||
if (auto lockBtn = setIDSafe(menu, -2, "vault-button")) {
|
||||
auto menu = detachAndCreateMenu(
|
||||
this,
|
||||
"top-right-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
lockBtn
|
||||
);
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() - 150.f / 2 +
|
||||
lockBtn->getScaledContentSize().height / 2
|
||||
);
|
||||
menu->setContentSize({ 60.f, 150.f });
|
||||
menu->updateLayout();
|
||||
}
|
||||
// // move vault button to its own menu
|
||||
// if (auto lockBtn = setIDSafe(menu, -2, "vault-button")) {
|
||||
// auto menu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "top-right-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisReverse(true)
|
||||
// ->setAxisAlignment(AxisAlignment::End),
|
||||
// lockBtn
|
||||
// );
|
||||
// menu->setPositionY(
|
||||
// menu->getPositionY() - 150.f / 2 +
|
||||
// lockBtn->getScaledContentSize().height / 2
|
||||
// );
|
||||
// menu->setContentSize({ 60.f, 150.f });
|
||||
// menu->updateLayout();
|
||||
// }
|
||||
|
||||
// move treasure room button to its own menu
|
||||
if (auto roomBtn = setIDSafe(menu, -1, "treasure-room-button")) {
|
||||
auto menu = detachAndCreateMenu(
|
||||
this,
|
||||
"bottom-right-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
roomBtn
|
||||
);
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() + 125.f / 2 -
|
||||
roomBtn->getScaledContentSize().height / 2
|
||||
);
|
||||
menu->setContentSize({ 60.f, 125.f });
|
||||
menu->updateLayout();
|
||||
}
|
||||
// // move treasure room button to its own menu
|
||||
// if (auto roomBtn = setIDSafe(menu, -1, "treasure-room-button")) {
|
||||
// auto menu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "bottom-right-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start),
|
||||
// roomBtn
|
||||
// );
|
||||
// menu->setPositionY(
|
||||
// menu->getPositionY() + 125.f / 2 -
|
||||
// roomBtn->getScaledContentSize().height / 2
|
||||
// );
|
||||
// menu->setContentSize({ 60.f, 125.f });
|
||||
// menu->updateLayout();
|
||||
// }
|
||||
|
||||
// row order is inverted because of layout
|
||||
// // row order is inverted because of layout
|
||||
|
||||
reorderButtons(
|
||||
setIDSafe(menu, 6, "featured-button"),
|
||||
setIDSafe(menu, 7, "hall-of-fame-button"),
|
||||
setIDSafe(menu, 8, "map-packs-button"),
|
||||
// reorderButtons(
|
||||
// setIDSafe(menu, 6, "featured-button"),
|
||||
// setIDSafe(menu, 7, "hall-of-fame-button"),
|
||||
// setIDSafe(menu, 8, "map-packs-button"),
|
||||
|
||||
setIDSafe(menu, 9, "search-button"),
|
||||
setIDSafe(menu, 3, "quests-button"),
|
||||
setIDSafe(menu, 4, "daily-button"),
|
||||
setIDSafe(menu, 5, "weekly-button"),
|
||||
// setIDSafe(menu, 9, "search-button"),
|
||||
// setIDSafe(menu, 3, "quests-button"),
|
||||
// setIDSafe(menu, 4, "daily-button"),
|
||||
// setIDSafe(menu, 5, "weekly-button"),
|
||||
|
||||
setIDSafe(menu, 10, "gauntlets-button"),
|
||||
setIDSafe(menu, 0, "create-button"),
|
||||
setIDSafe(menu, 1, "saved-button"),
|
||||
setIDSafe(menu, 2, "scores-button")
|
||||
);
|
||||
// setIDSafe(menu, 10, "gauntlets-button"),
|
||||
// setIDSafe(menu, 0, "create-button"),
|
||||
// setIDSafe(menu, 1, "saved-button"),
|
||||
// setIDSafe(menu, 2, "scores-button")
|
||||
// );
|
||||
|
||||
if (winSize.width / winSize.height <= 5.1f / 3.f) {
|
||||
menu->setContentSize({ winSize.width - 80.f, 310.f });
|
||||
}
|
||||
else {
|
||||
menu->setContentSize({ winSize.width - 120.f, 310.f });
|
||||
}
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setGap(12.f)
|
||||
->setCrossAxisReverse(true)
|
||||
->setGrowCrossAxis(true)
|
||||
->setCrossAxisOverflow(false)
|
||||
);
|
||||
}
|
||||
// if (winSize.width / winSize.height <= 5.1f / 3.f) {
|
||||
// menu->setContentSize({ winSize.width - 80.f, 310.f });
|
||||
// }
|
||||
// else {
|
||||
// menu->setContentSize({ winSize.width - 120.f, 310.f });
|
||||
// }
|
||||
// menu->setLayout(
|
||||
// RowLayout::create()
|
||||
// ->setGap(12.f)
|
||||
// ->setCrossAxisReverse(true)
|
||||
// ->setGrowCrossAxis(true)
|
||||
// ->setCrossAxisOverflow(false)
|
||||
// );
|
||||
// }
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("exit-menu");
|
||||
auto exitBtn = setIDSafe(menu, 0, "exit-button");
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() - 125.f / 2 +
|
||||
getSizeSafe(exitBtn).height / 2
|
||||
);
|
||||
menu->setContentSize({ 60.f, 125.f });
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
);
|
||||
}
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
// menu->setID("exit-menu");
|
||||
// auto exitBtn = setIDSafe(menu, 0, "exit-button");
|
||||
// menu->setPositionY(
|
||||
// menu->getPositionY() - 125.f / 2 +
|
||||
// getSizeSafe(exitBtn).height / 2
|
||||
// );
|
||||
// menu->setContentSize({ 60.f, 125.f });
|
||||
// menu->setLayout(
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::End)
|
||||
// );
|
||||
// }
|
||||
|
||||
// add a menu to the bottom left corner that is empty but prolly a place mods
|
||||
// want to add stuff to
|
||||
auto menu = CCMenu::create();
|
||||
menu->setPosition(24.f, 0.f + 125.f / 2);
|
||||
menu->setID("bottom-left-menu");
|
||||
menu->setContentSize({ 60.f, 125.f });
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
this->addChild(menu);
|
||||
}
|
||||
// // add a menu to the bottom left corner that is empty but prolly a place mods
|
||||
// // want to add stuff to
|
||||
// auto menu = CCMenu::create();
|
||||
// menu->setPosition(24.f, 0.f + 125.f / 2);
|
||||
// menu->setID("bottom-left-menu");
|
||||
// menu->setContentSize({ 60.f, 125.f });
|
||||
// menu->setLayout(
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// );
|
||||
// this->addChild(menu);
|
||||
// }
|
||||
|
||||
struct CreatorLayerIDs : Modify<CreatorLayerIDs, CreatorLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("CreatorLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set CreatorLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
// struct CreatorLayerIDs : Modify<CreatorLayerIDs, CreatorLayer> {
|
||||
// static void onModify(auto& self) {
|
||||
// if (!self.setHookPriority("CreatorLayer::init", GEODE_ID_PRIORITY)) {
|
||||
// log::warn("Failed to set CreatorLayer::init hook priority, node IDs may not work properly");
|
||||
// }
|
||||
// }
|
||||
|
||||
bool init() {
|
||||
if (!CreatorLayer::init()) return false;
|
||||
// bool init() {
|
||||
// if (!CreatorLayer::init()) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
// NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
|
|
|
@ -6,35 +6,35 @@
|
|||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(CustomSongWidget) {
|
||||
setIDSafe<CCScale9Sprite>(this, 0, "bg");
|
||||
setIDSafe<CCSprite>(this, 0, "loading-bar");
|
||||
setIDSafe<CCLabelBMFont>(this, 0, "song-name-label");
|
||||
setIDSafe<CCLabelBMFont>(this, 1, "author-name-label");
|
||||
setIDSafe<CCLabelBMFont>(this, 2, "id-and-size-label");
|
||||
setIDSafe<CCLabelBMFont>(this, 3, "error-label");
|
||||
setIDSafe<CCMenu>(this, 0, "buttons-menu");
|
||||
auto customSongWidgetMenu = this->getChildByID("buttons-menu");
|
||||
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 0, "download-button");
|
||||
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 1, "cancel-button");
|
||||
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 2, "use-button");
|
||||
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 3, "refresh-button");
|
||||
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 4, "play-song-button");
|
||||
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 5, "more-button");
|
||||
};
|
||||
// $register_ids(CustomSongWidget) {
|
||||
// setIDSafe<CCScale9Sprite>(this, 0, "bg");
|
||||
// setIDSafe<CCSprite>(this, 0, "loading-bar");
|
||||
// setIDSafe<CCLabelBMFont>(this, 0, "song-name-label");
|
||||
// setIDSafe<CCLabelBMFont>(this, 1, "author-name-label");
|
||||
// setIDSafe<CCLabelBMFont>(this, 2, "id-and-size-label");
|
||||
// setIDSafe<CCLabelBMFont>(this, 3, "error-label");
|
||||
// setIDSafe<CCMenu>(this, 0, "buttons-menu");
|
||||
// auto customSongWidgetMenu = this->getChildByID("buttons-menu");
|
||||
// setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 0, "download-button");
|
||||
// setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 1, "cancel-button");
|
||||
// setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 2, "use-button");
|
||||
// setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 3, "refresh-button");
|
||||
// setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 4, "play-song-button");
|
||||
// setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 5, "more-button");
|
||||
// };
|
||||
|
||||
struct CustomSongWidgetIDs : Modify<CustomSongWidgetIDs, CustomSongWidget> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("CustomSongWidget::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set CustomSongWidget::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
// struct CustomSongWidgetIDs : Modify<CustomSongWidgetIDs, CustomSongWidget> {
|
||||
// static void onModify(auto& self) {
|
||||
// if (!self.setHookPriority("CustomSongWidget::init", GEODE_ID_PRIORITY)) {
|
||||
// log::warn("Failed to set CustomSongWidget::init hook priority, node IDs may not work properly");
|
||||
// }
|
||||
// }
|
||||
|
||||
bool init(SongInfoObject* s, LevelSettingsObject* l, bool b1, bool b2, bool b3, bool b4, bool hideBackground) {
|
||||
if (!CustomSongWidget::init(s, l, b1, b2, b3, b4, hideBackground)) return false;
|
||||
// bool init(SongInfoObject* s, LevelSettingsObject* l, bool b1, bool b2, bool b3, bool b4, bool hideBackground) {
|
||||
// if (!CustomSongWidget::init(s, l, b1, b2, b3, b4, hideBackground)) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
// NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// return true;
|
||||
// }
|
||||
// };
|
|
@ -4,327 +4,327 @@
|
|||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(CustomizeObjectLayer) {
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
// $register_ids(CustomizeObjectLayer) {
|
||||
// auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
setIDs(
|
||||
m_mainLayer, 0,
|
||||
"alert-bg",
|
||||
"title-label",
|
||||
"button-menu",
|
||||
"selected-channel-label",
|
||||
"channel-input-bg",
|
||||
"channel-input",
|
||||
"text-input-bg",
|
||||
"text-input",
|
||||
"glow-label"
|
||||
);
|
||||
// setIDs(
|
||||
// m_mainLayer, 0,
|
||||
// "alert-bg",
|
||||
// "title-label",
|
||||
// "button-menu",
|
||||
// "selected-channel-label",
|
||||
// "channel-input-bg",
|
||||
// "channel-input",
|
||||
// "text-input-bg",
|
||||
// "text-input",
|
||||
// "glow-label"
|
||||
// );
|
||||
|
||||
m_buttonMenu->setID("ok-menu");
|
||||
// m_buttonMenu->setID("ok-menu");
|
||||
|
||||
setIDs(
|
||||
m_buttonMenu,
|
||||
0,
|
||||
"ok-button",
|
||||
"info-button",
|
||||
// 2
|
||||
"base-tab-button",
|
||||
"detail-tab-button",
|
||||
"base-hsv-button",
|
||||
"detail-hsv-button",
|
||||
"text-tab-button",
|
||||
// 7
|
||||
"player-color-1-button",
|
||||
"player-color-2-button",
|
||||
"light-bg-button",
|
||||
"default-button",
|
||||
"channel-1-button",
|
||||
"channel-2-button",
|
||||
"channel-3-button",
|
||||
"channel-4-button",
|
||||
"channel-5-button",
|
||||
"channel-6-button",
|
||||
"channel-7-button",
|
||||
"channel-8-button",
|
||||
"channel-9-button",
|
||||
"channel-custom-button",
|
||||
// 21
|
||||
"select-channel-up-button",
|
||||
"select-channel-down-button",
|
||||
"select-channel-button",
|
||||
// 24
|
||||
"split-text-button",
|
||||
"clear-text-button",
|
||||
// 26
|
||||
"next-free-button"
|
||||
// 27
|
||||
);
|
||||
// setIDs(
|
||||
// m_buttonMenu,
|
||||
// 0,
|
||||
// "ok-button",
|
||||
// "info-button",
|
||||
// // 2
|
||||
// "base-tab-button",
|
||||
// "detail-tab-button",
|
||||
// "base-hsv-button",
|
||||
// "detail-hsv-button",
|
||||
// "text-tab-button",
|
||||
// // 7
|
||||
// "player-color-1-button",
|
||||
// "player-color-2-button",
|
||||
// "light-bg-button",
|
||||
// "default-button",
|
||||
// "channel-1-button",
|
||||
// "channel-2-button",
|
||||
// "channel-3-button",
|
||||
// "channel-4-button",
|
||||
// "channel-5-button",
|
||||
// "channel-6-button",
|
||||
// "channel-7-button",
|
||||
// "channel-8-button",
|
||||
// "channel-9-button",
|
||||
// "channel-custom-button",
|
||||
// // 21
|
||||
// "select-channel-up-button",
|
||||
// "select-channel-down-button",
|
||||
// "select-channel-button",
|
||||
// // 24
|
||||
// "split-text-button",
|
||||
// "clear-text-button",
|
||||
// // 26
|
||||
// "next-free-button"
|
||||
// // 27
|
||||
// );
|
||||
|
||||
if (m_targetObject) {
|
||||
setIDs(
|
||||
m_buttonMenu,
|
||||
27,
|
||||
"copy-button",
|
||||
"paste-button",
|
||||
// if (m_targetObject) {
|
||||
// setIDs(
|
||||
// m_buttonMenu,
|
||||
// 27,
|
||||
// "copy-button",
|
||||
// "paste-button",
|
||||
|
||||
"browse-button",
|
||||
// "browse-button",
|
||||
|
||||
"glow-toggle"
|
||||
);
|
||||
}
|
||||
else {
|
||||
setIDs(
|
||||
m_buttonMenu,
|
||||
27,
|
||||
"browse-button",
|
||||
// "glow-toggle"
|
||||
// );
|
||||
// }
|
||||
// else {
|
||||
// setIDs(
|
||||
// m_buttonMenu,
|
||||
// 27,
|
||||
// "browse-button",
|
||||
|
||||
"glow-toggle"
|
||||
);
|
||||
}
|
||||
// "glow-toggle"
|
||||
// );
|
||||
// }
|
||||
|
||||
auto tabsLayout = RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Center)
|
||||
->setCrossAxisAlignment(AxisAlignment::Center);
|
||||
tabsLayout->ignoreInvisibleChildren(true);
|
||||
auto tabsMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"tabs-menu",
|
||||
tabsLayout,
|
||||
m_buttonMenu->getChildByID("base-tab-button"),
|
||||
m_buttonMenu->getChildByID("detail-tab-button"),
|
||||
SpacerNode::create(),
|
||||
m_buttonMenu->getChildByID("text-tab-button")
|
||||
);
|
||||
tabsMenu->setContentSize({ 360.f, 50.f });
|
||||
tabsMenu->setPositionX(winSize.width / 2);
|
||||
tabsMenu->updateLayout();
|
||||
// auto tabsLayout = RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Center)
|
||||
// ->setCrossAxisAlignment(AxisAlignment::Center);
|
||||
// tabsLayout->ignoreInvisibleChildren(true);
|
||||
// auto tabsMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "tabs-menu",
|
||||
// tabsLayout,
|
||||
// m_buttonMenu->getChildByID("base-tab-button"),
|
||||
// m_buttonMenu->getChildByID("detail-tab-button"),
|
||||
// SpacerNode::create(),
|
||||
// m_buttonMenu->getChildByID("text-tab-button")
|
||||
// );
|
||||
// tabsMenu->setContentSize({ 360.f, 50.f });
|
||||
// tabsMenu->setPositionX(winSize.width / 2);
|
||||
// tabsMenu->updateLayout();
|
||||
|
||||
auto specialChannelsMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"special-channels-menu",
|
||||
RowLayout::create()
|
||||
->setCrossAxisOverflow(false)
|
||||
->setGrowCrossAxis(true)
|
||||
->setAxisAlignment(AxisAlignment::Center)
|
||||
->setCrossAxisAlignment(AxisAlignment::Center)
|
||||
->setGap(14.f),
|
||||
m_buttonMenu->getChildByID("player-color-1-button"),
|
||||
m_buttonMenu->getChildByID("player-color-2-button"),
|
||||
m_buttonMenu->getChildByID("light-bg-button"),
|
||||
m_buttonMenu->getChildByID("default-button")
|
||||
);
|
||||
specialChannelsMenu->setContentSize({ 350.f, 50.f });
|
||||
specialChannelsMenu->setPositionX(winSize.width / 2);
|
||||
specialChannelsMenu->updateLayout();
|
||||
// auto specialChannelsMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "special-channels-menu",
|
||||
// RowLayout::create()
|
||||
// ->setCrossAxisOverflow(false)
|
||||
// ->setGrowCrossAxis(true)
|
||||
// ->setAxisAlignment(AxisAlignment::Center)
|
||||
// ->setCrossAxisAlignment(AxisAlignment::Center)
|
||||
// ->setGap(14.f),
|
||||
// m_buttonMenu->getChildByID("player-color-1-button"),
|
||||
// m_buttonMenu->getChildByID("player-color-2-button"),
|
||||
// m_buttonMenu->getChildByID("light-bg-button"),
|
||||
// m_buttonMenu->getChildByID("default-button")
|
||||
// );
|
||||
// specialChannelsMenu->setContentSize({ 350.f, 50.f });
|
||||
// specialChannelsMenu->setPositionX(winSize.width / 2);
|
||||
// specialChannelsMenu->updateLayout();
|
||||
|
||||
auto channelsMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"channels-menu",
|
||||
RowLayout::create()
|
||||
->setCrossAxisOverflow(false)
|
||||
->setGrowCrossAxis(true)
|
||||
->setAxisAlignment(AxisAlignment::Center)
|
||||
->setCrossAxisAlignment(AxisAlignment::Center)
|
||||
->setGap(20.f),
|
||||
m_buttonMenu->getChildByID("channel-1-button"),
|
||||
m_buttonMenu->getChildByID("channel-2-button"),
|
||||
m_buttonMenu->getChildByID("channel-3-button"),
|
||||
m_buttonMenu->getChildByID("channel-4-button"),
|
||||
m_buttonMenu->getChildByID("channel-5-button"),
|
||||
m_buttonMenu->getChildByID("channel-6-button"),
|
||||
m_buttonMenu->getChildByID("channel-7-button"),
|
||||
m_buttonMenu->getChildByID("channel-8-button"),
|
||||
m_buttonMenu->getChildByID("channel-9-button"),
|
||||
m_buttonMenu->getChildByID("channel-custom-button")
|
||||
);
|
||||
channelsMenu->setContentSize({ 350.f, 100.f });
|
||||
channelsMenu->setPosition(winSize.width / 2, winSize.height / 2 - 25.f);
|
||||
channelsMenu->updateLayout();
|
||||
// auto channelsMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "channels-menu",
|
||||
// RowLayout::create()
|
||||
// ->setCrossAxisOverflow(false)
|
||||
// ->setGrowCrossAxis(true)
|
||||
// ->setAxisAlignment(AxisAlignment::Center)
|
||||
// ->setCrossAxisAlignment(AxisAlignment::Center)
|
||||
// ->setGap(20.f),
|
||||
// m_buttonMenu->getChildByID("channel-1-button"),
|
||||
// m_buttonMenu->getChildByID("channel-2-button"),
|
||||
// m_buttonMenu->getChildByID("channel-3-button"),
|
||||
// m_buttonMenu->getChildByID("channel-4-button"),
|
||||
// m_buttonMenu->getChildByID("channel-5-button"),
|
||||
// m_buttonMenu->getChildByID("channel-6-button"),
|
||||
// m_buttonMenu->getChildByID("channel-7-button"),
|
||||
// m_buttonMenu->getChildByID("channel-8-button"),
|
||||
// m_buttonMenu->getChildByID("channel-9-button"),
|
||||
// m_buttonMenu->getChildByID("channel-custom-button")
|
||||
// );
|
||||
// channelsMenu->setContentSize({ 350.f, 100.f });
|
||||
// channelsMenu->setPosition(winSize.width / 2, winSize.height / 2 - 25.f);
|
||||
// channelsMenu->updateLayout();
|
||||
|
||||
auto selectedChannelMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"selected-channel-menu",
|
||||
nullptr,
|
||||
m_buttonMenu->getChildByID("select-channel-button"),
|
||||
m_mainLayer->getChildByID("selected-channel-label")
|
||||
);
|
||||
selectedChannelMenu->setContentSize({ 120.f, 40.f });
|
||||
selectedChannelMenu->setPosition(
|
||||
winSize.width / 2 + 110.f,
|
||||
winSize.height / 2 - 90.f
|
||||
);
|
||||
if (auto label = selectedChannelMenu->getChildByID("selected-channel-label")) {
|
||||
label->setPosition(75.f, 20.f);
|
||||
}
|
||||
if (auto button = selectedChannelMenu->getChildByID("select-channel-button")) {
|
||||
button->setPosition(100.f, 20.f);
|
||||
}
|
||||
// auto selectedChannelMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "selected-channel-menu",
|
||||
// nullptr,
|
||||
// m_buttonMenu->getChildByID("select-channel-button"),
|
||||
// m_mainLayer->getChildByID("selected-channel-label")
|
||||
// );
|
||||
// selectedChannelMenu->setContentSize({ 120.f, 40.f });
|
||||
// selectedChannelMenu->setPosition(
|
||||
// winSize.width / 2 + 110.f,
|
||||
// winSize.height / 2 - 90.f
|
||||
// );
|
||||
// if (auto label = selectedChannelMenu->getChildByID("selected-channel-label")) {
|
||||
// label->setPosition(75.f, 20.f);
|
||||
// }
|
||||
// if (auto button = selectedChannelMenu->getChildByID("select-channel-button")) {
|
||||
// button->setPosition(100.f, 20.f);
|
||||
// }
|
||||
|
||||
auto togglesMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"toggles-menu",
|
||||
nullptr,
|
||||
m_mainLayer->getChildByID("glow-label"),
|
||||
m_buttonMenu->getChildByID("glow-toggle")
|
||||
);
|
||||
togglesMenu->setContentSize({ 75.f, 120.f });
|
||||
togglesMenu->setPosition(55.f, 90.f);
|
||||
if (auto label = togglesMenu->getChildByID("glow-label")) {
|
||||
label->setPosition(57.f, 20.f);
|
||||
}
|
||||
if (auto toggle = togglesMenu->getChildByID("glow-toggle")) {
|
||||
toggle->setPosition(57.f, 5.f);
|
||||
}
|
||||
// auto togglesMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "toggles-menu",
|
||||
// nullptr,
|
||||
// m_mainLayer->getChildByID("glow-label"),
|
||||
// m_buttonMenu->getChildByID("glow-toggle")
|
||||
// );
|
||||
// togglesMenu->setContentSize({ 75.f, 120.f });
|
||||
// togglesMenu->setPosition(55.f, 90.f);
|
||||
// if (auto label = togglesMenu->getChildByID("glow-label")) {
|
||||
// label->setPosition(57.f, 20.f);
|
||||
// }
|
||||
// if (auto toggle = togglesMenu->getChildByID("glow-toggle")) {
|
||||
// toggle->setPosition(57.f, 5.f);
|
||||
// }
|
||||
|
||||
auto baseHSVMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"base-hsv-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
m_buttonMenu->getChildByID("base-hsv-button")
|
||||
);
|
||||
baseHSVMenu->setContentSize({ 80.f, 60.f });
|
||||
baseHSVMenu->setPositionX(winSize.width / 2 - 132.5f);
|
||||
baseHSVMenu->updateLayout();
|
||||
// auto baseHSVMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "base-hsv-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start),
|
||||
// m_buttonMenu->getChildByID("base-hsv-button")
|
||||
// );
|
||||
// baseHSVMenu->setContentSize({ 80.f, 60.f });
|
||||
// baseHSVMenu->setPositionX(winSize.width / 2 - 132.5f);
|
||||
// baseHSVMenu->updateLayout();
|
||||
|
||||
auto detailHSVMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"detail-hsv-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
m_buttonMenu->getChildByID("detail-hsv-button")
|
||||
);
|
||||
detailHSVMenu->setContentSize({ 80.f, 60.f });
|
||||
detailHSVMenu->setPositionX(baseHSVMenu->getPositionX());
|
||||
detailHSVMenu->updateLayout();
|
||||
// auto detailHSVMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "detail-hsv-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start),
|
||||
// m_buttonMenu->getChildByID("detail-hsv-button")
|
||||
// );
|
||||
// detailHSVMenu->setContentSize({ 80.f, 60.f });
|
||||
// detailHSVMenu->setPositionX(baseHSVMenu->getPositionX());
|
||||
// detailHSVMenu->updateLayout();
|
||||
|
||||
auto nextFreeMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"next-free-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
m_buttonMenu->getChildByID("next-free-button")
|
||||
);
|
||||
nextFreeMenu->setContentSize({ 120.f, 60.f });
|
||||
nextFreeMenu->setPositionX(winSize.width / 2 - 110.f);
|
||||
nextFreeMenu->updateLayout();
|
||||
// auto nextFreeMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "next-free-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start),
|
||||
// m_buttonMenu->getChildByID("next-free-button")
|
||||
// );
|
||||
// nextFreeMenu->setContentSize({ 120.f, 60.f });
|
||||
// nextFreeMenu->setPositionX(winSize.width / 2 - 110.f);
|
||||
// nextFreeMenu->updateLayout();
|
||||
|
||||
auto textActionsMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"text-actions-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setAxisReverse(true),
|
||||
m_buttonMenu->getChildByID("split-text-button")
|
||||
);
|
||||
textActionsMenu->setContentSize({ 120.f, 60.f });
|
||||
textActionsMenu->setPositionX(winSize.width / 2 + 110.f);
|
||||
textActionsMenu->updateLayout();
|
||||
// auto textActionsMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "text-actions-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::End)
|
||||
// ->setAxisReverse(true),
|
||||
// m_buttonMenu->getChildByID("split-text-button")
|
||||
// );
|
||||
// textActionsMenu->setContentSize({ 120.f, 60.f });
|
||||
// textActionsMenu->setPositionX(winSize.width / 2 + 110.f);
|
||||
// textActionsMenu->updateLayout();
|
||||
|
||||
auto clearTextMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"clear-text-menu",
|
||||
nullptr,
|
||||
m_buttonMenu->getChildByID("clear-text-button")
|
||||
);
|
||||
// auto clearTextMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "clear-text-menu",
|
||||
// nullptr,
|
||||
// m_buttonMenu->getChildByID("clear-text-button")
|
||||
// );
|
||||
|
||||
auto infoMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"info-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setAxisReverse(true),
|
||||
m_buttonMenu->getChildByID("info-button")
|
||||
);
|
||||
infoMenu->setContentSize({ 80.f, 60.f });
|
||||
infoMenu->setPosition(winSize.width / 2 + 132.5f, baseHSVMenu->getPositionY());
|
||||
infoMenu->updateLayout();
|
||||
// auto infoMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "info-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::End)
|
||||
// ->setAxisReverse(true),
|
||||
// m_buttonMenu->getChildByID("info-button")
|
||||
// );
|
||||
// infoMenu->setContentSize({ 80.f, 60.f });
|
||||
// infoMenu->setPosition(winSize.width / 2 + 132.5f, baseHSVMenu->getPositionY());
|
||||
// infoMenu->updateLayout();
|
||||
|
||||
auto browseMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"browse-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setAxisReverse(true),
|
||||
m_buttonMenu->getChildByID("browse-button")
|
||||
);
|
||||
browseMenu->setContentSize({ 100.f, 140.f });
|
||||
browseMenu->setPositionY(winSize.height / 2 - 70.f);
|
||||
browseMenu->updateLayout();
|
||||
// auto browseMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "browse-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// ->setAxisReverse(true),
|
||||
// m_buttonMenu->getChildByID("browse-button")
|
||||
// );
|
||||
// browseMenu->setContentSize({ 100.f, 140.f });
|
||||
// browseMenu->setPositionY(winSize.height / 2 - 70.f);
|
||||
// browseMenu->updateLayout();
|
||||
|
||||
auto copyPasteMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"copy-paste-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setAxisReverse(true),
|
||||
m_buttonMenu->getChildByID("copy-button"),
|
||||
m_buttonMenu->getChildByID("paste-button")
|
||||
);
|
||||
copyPasteMenu->setContentSize({ 100.f, 140.f });
|
||||
copyPasteMenu->setPositionY(winSize.height / 2 + 100.f);
|
||||
copyPasteMenu->updateLayout();
|
||||
// auto copyPasteMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "copy-paste-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::End)
|
||||
// ->setAxisReverse(true),
|
||||
// m_buttonMenu->getChildByID("copy-button"),
|
||||
// m_buttonMenu->getChildByID("paste-button")
|
||||
// );
|
||||
// copyPasteMenu->setContentSize({ 100.f, 140.f });
|
||||
// copyPasteMenu->setPositionY(winSize.height / 2 + 100.f);
|
||||
// copyPasteMenu->updateLayout();
|
||||
|
||||
auto selectChannelMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"select-channel-menu",
|
||||
nullptr,
|
||||
m_buttonMenu->getChildByID("select-channel-up-button"),
|
||||
m_buttonMenu->getChildByID("select-channel-down-button")
|
||||
);
|
||||
selectChannelMenu->setPosition(m_customColorInputBG->getPosition());
|
||||
selectChannelMenu->setContentSize({ 60.f, 140.f });
|
||||
if (auto btn = selectChannelMenu->getChildByID("select-channel-up-button")) {
|
||||
btn->setPosition({ 30.f, 110.f });
|
||||
}
|
||||
if (auto btn = selectChannelMenu->getChildByID("select-channel-down-button")) {
|
||||
btn->setPosition({ 30.f, 30.f });
|
||||
}
|
||||
}
|
||||
// auto selectChannelMenu = detachAndCreateMenu(
|
||||
// m_mainLayer,
|
||||
// "select-channel-menu",
|
||||
// nullptr,
|
||||
// m_buttonMenu->getChildByID("select-channel-up-button"),
|
||||
// m_buttonMenu->getChildByID("select-channel-down-button")
|
||||
// );
|
||||
// selectChannelMenu->setPosition(m_customColorInputBG->getPosition());
|
||||
// selectChannelMenu->setContentSize({ 60.f, 140.f });
|
||||
// if (auto btn = selectChannelMenu->getChildByID("select-channel-up-button")) {
|
||||
// btn->setPosition({ 30.f, 110.f });
|
||||
// }
|
||||
// if (auto btn = selectChannelMenu->getChildByID("select-channel-down-button")) {
|
||||
// btn->setPosition({ 30.f, 30.f });
|
||||
// }
|
||||
// }
|
||||
|
||||
struct CustomizeObjectLayerIDs : Modify<CustomizeObjectLayerIDs, CustomizeObjectLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("CustomizeObjectLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set CustomizeObjectLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
// struct CustomizeObjectLayerIDs : Modify<CustomizeObjectLayerIDs, CustomizeObjectLayer> {
|
||||
// static void onModify(auto& self) {
|
||||
// if (!self.setHookPriority("CustomizeObjectLayer::init", GEODE_ID_PRIORITY)) {
|
||||
// log::warn("Failed to set CustomizeObjectLayer::init hook priority, node IDs may not work properly");
|
||||
// }
|
||||
// }
|
||||
|
||||
void toggleMenuIf(const char* id, int mode) {
|
||||
if (auto menu = m_mainLayer->getChildByID(id)) {
|
||||
menu->setVisible(m_selectedMode == mode);
|
||||
}
|
||||
}
|
||||
// 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 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);
|
||||
}
|
||||
// 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;
|
||||
// bool init(GameObject* obj, CCArray* objs) {
|
||||
// if (!CustomizeObjectLayer::init(obj, objs))
|
||||
// return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
this->toggleVisible();
|
||||
// NodeIDs::get()->provide(this);
|
||||
// this->toggleVisible();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
|
|
|
@ -7,120 +7,120 @@
|
|||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(EditLevelLayer) {
|
||||
setIDs(
|
||||
this,
|
||||
0,
|
||||
"background",
|
||||
"bottom-left-art",
|
||||
"bottom-right-art",
|
||||
"level-name-background",
|
||||
"level-name-input",
|
||||
"description-background",
|
||||
"description-input",
|
||||
"description-text-area",
|
||||
"level-edit-menu",
|
||||
"level-length",
|
||||
"level-song",
|
||||
"level-verified",
|
||||
"version-label",
|
||||
"level-id-label",
|
||||
"level-actions-menu",
|
||||
"back-menu",
|
||||
"info-button-menu"
|
||||
);
|
||||
// $register_ids(EditLevelLayer) {
|
||||
// setIDs(
|
||||
// this,
|
||||
// 0,
|
||||
// "background",
|
||||
// "bottom-left-art",
|
||||
// "bottom-right-art",
|
||||
// "level-name-background",
|
||||
// "level-name-input",
|
||||
// "description-background",
|
||||
// "description-input",
|
||||
// "description-text-area",
|
||||
// "level-edit-menu",
|
||||
// "level-length",
|
||||
// "level-song",
|
||||
// "level-verified",
|
||||
// "version-label",
|
||||
// "level-id-label",
|
||||
// "level-actions-menu",
|
||||
// "back-menu",
|
||||
// "info-button-menu"
|
||||
// );
|
||||
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
auto descBG = this->getChildByID("description-background");
|
||||
// auto winSize = CCDirector::get()->getWinSize();
|
||||
// auto descBG = this->getChildByID("description-background");
|
||||
|
||||
auto descMenu = CCMenu::create();
|
||||
descMenu->setID("description-menu");
|
||||
descMenu->setLayout(ColumnLayout::create());
|
||||
descMenu->setPosition(
|
||||
descBG->getPositionX() - descBG->getScaledContentSize().width / 2 - 35.f,
|
||||
descBG->getPositionY()
|
||||
);
|
||||
descMenu->setContentSize({ 40.f, 80.f });
|
||||
this->addChild(descMenu);
|
||||
// auto descMenu = CCMenu::create();
|
||||
// descMenu->setID("description-menu");
|
||||
// descMenu->setLayout(ColumnLayout::create());
|
||||
// descMenu->setPosition(
|
||||
// descBG->getPositionX() - descBG->getScaledContentSize().width / 2 - 35.f,
|
||||
// descBG->getPositionY()
|
||||
// );
|
||||
// descMenu->setContentSize({ 40.f, 80.f });
|
||||
// this->addChild(descMenu);
|
||||
|
||||
if (auto menu = this->getChildByID("level-edit-menu")) {
|
||||
setIDs(menu, 0, "edit-button", "play-button", "share-button");
|
||||
if (menu->getChildrenCount() == 4) {
|
||||
auto btn = static_cast<CCNode*>(menu->getChildren()->objectAtIndex(3));
|
||||
btn->setID("update-desc-button");
|
||||
btn->retain();
|
||||
btn->removeFromParent();
|
||||
descMenu->addChild(btn);
|
||||
btn->release();
|
||||
descMenu->updateLayout();
|
||||
}
|
||||
menu->setContentSize({ winSize.width - 160.f, 100.f });
|
||||
menu->setLayout(RowLayout::create()->setGap(25.f));
|
||||
}
|
||||
// if (auto menu = this->getChildByID("level-edit-menu")) {
|
||||
// setIDs(menu, 0, "edit-button", "play-button", "share-button");
|
||||
// if (menu->getChildrenCount() == 4) {
|
||||
// auto btn = static_cast<CCNode*>(menu->getChildren()->objectAtIndex(3));
|
||||
// btn->setID("update-desc-button");
|
||||
// btn->retain();
|
||||
// btn->removeFromParent();
|
||||
// descMenu->addChild(btn);
|
||||
// btn->release();
|
||||
// descMenu->updateLayout();
|
||||
// }
|
||||
// menu->setContentSize({ winSize.width - 160.f, 100.f });
|
||||
// menu->setLayout(RowLayout::create()->setGap(25.f));
|
||||
// }
|
||||
|
||||
if (auto menu = this->getChildByID("level-actions-menu")) {
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"delete-button",
|
||||
"help-button",
|
||||
"duplicate-button",
|
||||
"move-to-top-button",
|
||||
"folder-button"
|
||||
);
|
||||
// if (auto menu = this->getChildByID("level-actions-menu")) {
|
||||
// setIDs(
|
||||
// menu,
|
||||
// 0,
|
||||
// "delete-button",
|
||||
// "help-button",
|
||||
// "duplicate-button",
|
||||
// "move-to-top-button",
|
||||
// "folder-button"
|
||||
// );
|
||||
|
||||
auto folderMenu = detachAndCreateMenu(
|
||||
this, "folder-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("folder-button")
|
||||
);
|
||||
folderMenu->setContentSize({ 50.f, 215.f });
|
||||
folderMenu->updateLayout();
|
||||
// auto folderMenu = detachAndCreateMenu(
|
||||
// this, "folder-menu",
|
||||
// ColumnLayout::create(),
|
||||
// menu->getChildByID("folder-button")
|
||||
// );
|
||||
// folderMenu->setContentSize({ 50.f, 215.f });
|
||||
// folderMenu->updateLayout();
|
||||
|
||||
menu->setPosition(
|
||||
menu->getPositionX() + static_cast<CCNode*>(
|
||||
menu->getChildren()->firstObject()
|
||||
)->getPositionX(),
|
||||
winSize.height / 2
|
||||
);
|
||||
menu->setContentSize({ 60.f, winSize.height - 15.f });
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setGap(7.f)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setAxisReverse(true)
|
||||
);
|
||||
menu->setZOrder(1);
|
||||
}
|
||||
// menu->setPosition(
|
||||
// menu->getPositionX() + static_cast<CCNode*>(
|
||||
// menu->getChildren()->firstObject()
|
||||
// )->getPositionX(),
|
||||
// winSize.height / 2
|
||||
// );
|
||||
// menu->setContentSize({ 60.f, winSize.height - 15.f });
|
||||
// menu->setLayout(
|
||||
// ColumnLayout::create()
|
||||
// ->setGap(7.f)
|
||||
// ->setAxisAlignment(AxisAlignment::End)
|
||||
// ->setAxisReverse(true)
|
||||
// );
|
||||
// menu->setZOrder(1);
|
||||
// }
|
||||
|
||||
if (auto menu = this->getChildByID("back-menu")) {
|
||||
auto backBtn = setIDSafe(menu, 0, "back-button");
|
||||
menu->setPositionX(
|
||||
menu->getPositionX() + 100.f / 2 -
|
||||
getSizeSafe(backBtn).width / 2
|
||||
);
|
||||
menu->setContentSize({ 100.f, 50.f });
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
}
|
||||
// if (auto menu = this->getChildByID("back-menu")) {
|
||||
// auto backBtn = setIDSafe(menu, 0, "back-button");
|
||||
// menu->setPositionX(
|
||||
// menu->getPositionX() + 100.f / 2 -
|
||||
// getSizeSafe(backBtn).width / 2
|
||||
// );
|
||||
// menu->setContentSize({ 100.f, 50.f });
|
||||
// menu->setLayout(
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// );
|
||||
// }
|
||||
|
||||
if (auto menu = this->getChildByID("info-button-menu")) setIDSafe(menu, 0, "info-button");
|
||||
}
|
||||
// if (auto menu = this->getChildByID("info-button-menu")) setIDSafe(menu, 0, "info-button");
|
||||
// }
|
||||
|
||||
struct EditLevelLayerIDs : Modify<EditLevelLayerIDs, EditLevelLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("EditLevelLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set EditLevelLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
// struct EditLevelLayerIDs : Modify<EditLevelLayerIDs, EditLevelLayer> {
|
||||
// static void onModify(auto& self) {
|
||||
// if (!self.setHookPriority("EditLevelLayer::init", GEODE_ID_PRIORITY)) {
|
||||
// log::warn("Failed to set EditLevelLayer::init hook priority, node IDs may not work properly");
|
||||
// }
|
||||
// }
|
||||
|
||||
bool init(GJGameLevel* l) {
|
||||
if (!EditLevelLayer::init(l)) return false;
|
||||
// bool init(GJGameLevel* l) {
|
||||
// if (!EditLevelLayer::init(l)) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
// NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
|
|
|
@ -6,269 +6,269 @@ using namespace geode::prelude;
|
|||
|
||||
// special class for this because making it a CCMenuItemToggler would be very UB
|
||||
// (not gonna reinterpret_cast that into the members)
|
||||
class GuidelinesButton : public CCMenuItemSpriteExtra {
|
||||
protected:
|
||||
bool init() override {
|
||||
if (!CCMenuItemSpriteExtra::init(
|
||||
CCSprite::createWithSpriteFrameName("GJ_audioOffBtn_001.png"),
|
||||
nullptr,
|
||||
this, nullptr
|
||||
)) return false;
|
||||
// class GuidelinesButton : public CCMenuItemSpriteExtra {
|
||||
// protected:
|
||||
// bool init() override {
|
||||
// if (!CCMenuItemSpriteExtra::init(
|
||||
// CCSprite::createWithSpriteFrameName("GJ_audioOffBtn_001.png"),
|
||||
// nullptr,
|
||||
// this, nullptr
|
||||
// )) return false;
|
||||
|
||||
this->updateSprite();
|
||||
// this->updateSprite();
|
||||
|
||||
return true;
|
||||
}
|
||||
// return true;
|
||||
// }
|
||||
|
||||
void updateSprite() {
|
||||
this->setNormalImage(CCSprite::createWithSpriteFrameName(
|
||||
GameManager::get()->m_showSongMarkers ?
|
||||
"GJ_audioOnBtn_001.png" :
|
||||
"GJ_audioOffBtn_001.png"
|
||||
));
|
||||
}
|
||||
// void updateSprite() {
|
||||
// this->setNormalImage(CCSprite::createWithSpriteFrameName(
|
||||
// GameManager::get()->m_showSongMarkers ?
|
||||
// "GJ_audioOnBtn_001.png" :
|
||||
// "GJ_audioOffBtn_001.png"
|
||||
// ));
|
||||
// }
|
||||
|
||||
void activate() override {
|
||||
CCMenuItemSpriteExtra::activate();
|
||||
GameManager::get()->m_showSongMarkers ^= 1;
|
||||
this->updateSprite();
|
||||
}
|
||||
// void activate() override {
|
||||
// CCMenuItemSpriteExtra::activate();
|
||||
// GameManager::get()->m_showSongMarkers ^= 1;
|
||||
// this->updateSprite();
|
||||
// }
|
||||
|
||||
public:
|
||||
static GuidelinesButton* create() {
|
||||
auto ret = new GuidelinesButton();
|
||||
if (ret && ret->init()) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
CC_SAFE_DELETE(ret);
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
// public:
|
||||
// static GuidelinesButton* create() {
|
||||
// auto ret = new GuidelinesButton();
|
||||
// if (ret && ret->init()) {
|
||||
// ret->autorelease();
|
||||
// return ret;
|
||||
// }
|
||||
// CC_SAFE_DELETE(ret);
|
||||
// return nullptr;
|
||||
// }
|
||||
// };
|
||||
|
||||
$register_ids(EditorPauseLayer) {
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
// $register_ids(EditorPauseLayer) {
|
||||
// auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("resume-menu");
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
// menu->setID("resume-menu");
|
||||
|
||||
setIDs(
|
||||
menu, 0,
|
||||
"resume-button",
|
||||
"save-and-play-button",
|
||||
"save-and-exit-button",
|
||||
"save-button",
|
||||
"exit-button"
|
||||
);
|
||||
// setIDs(
|
||||
// menu, 0,
|
||||
// "resume-button",
|
||||
// "save-and-play-button",
|
||||
// "save-and-exit-button",
|
||||
// "save-button",
|
||||
// "exit-button"
|
||||
// );
|
||||
|
||||
menu->setContentSize({ 100.f, 220.f });
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setGap(12.5f)
|
||||
->setAxisReverse(true)
|
||||
);
|
||||
}
|
||||
// menu->setContentSize({ 100.f, 220.f });
|
||||
// menu->setLayout(
|
||||
// ColumnLayout::create()
|
||||
// ->setGap(12.5f)
|
||||
// ->setAxisReverse(true)
|
||||
// );
|
||||
// }
|
||||
|
||||
setIDs(
|
||||
this, 2,
|
||||
"ignore-damage-label",
|
||||
"follow-player-label",
|
||||
"select-filter-label",
|
||||
"show-grid-label",
|
||||
"show-object-info-label",
|
||||
"show-ground-label",
|
||||
"preview-mode-label",
|
||||
// setIDs(
|
||||
// this, 2,
|
||||
// "ignore-damage-label",
|
||||
// "follow-player-label",
|
||||
// "select-filter-label",
|
||||
// "show-grid-label",
|
||||
// "show-object-info-label",
|
||||
// "show-ground-label",
|
||||
// "preview-mode-label",
|
||||
|
||||
"object-count-label",
|
||||
"length-label",
|
||||
"length-name-label"
|
||||
);
|
||||
// "object-count-label",
|
||||
// "length-label",
|
||||
// "length-name-label"
|
||||
// );
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("bottom-menu");
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
// menu->setID("bottom-menu");
|
||||
|
||||
setIDs(
|
||||
menu, 0,
|
||||
"guidelines-enable-button",
|
||||
"help-button",
|
||||
"guidelines-disable-button",
|
||||
// setIDs(
|
||||
// menu, 0,
|
||||
// "guidelines-enable-button",
|
||||
// "help-button",
|
||||
// "guidelines-disable-button",
|
||||
|
||||
"uncheck-portals-button",
|
||||
"reset-unused-button",
|
||||
"create-edges-button",
|
||||
"create-outlines-button",
|
||||
"create-base-button",
|
||||
"build-helper-button",
|
||||
// "uncheck-portals-button",
|
||||
// "reset-unused-button",
|
||||
// "create-edges-button",
|
||||
// "create-outlines-button",
|
||||
// "create-base-button",
|
||||
// "build-helper-button",
|
||||
|
||||
"align-x-button",
|
||||
"align-y-button",
|
||||
"select-all-button",
|
||||
"select-all-left-button",
|
||||
"select-all-right-button",
|
||||
// "align-x-button",
|
||||
// "align-y-button",
|
||||
// "select-all-button",
|
||||
// "select-all-left-button",
|
||||
// "select-all-right-button",
|
||||
|
||||
"ignore-damage-toggle",
|
||||
"follow-player-toggle",
|
||||
"select-filter-toggle",
|
||||
"show-grid-toggle",
|
||||
"show-object-info-toggle",
|
||||
"show-ground-toggle",
|
||||
"preview-mode-toggle",
|
||||
// "ignore-damage-toggle",
|
||||
// "follow-player-toggle",
|
||||
// "select-filter-toggle",
|
||||
// "show-grid-toggle",
|
||||
// "show-object-info-toggle",
|
||||
// "show-ground-toggle",
|
||||
// "preview-mode-toggle",
|
||||
|
||||
"keys-button",
|
||||
"settings-button"
|
||||
);
|
||||
// "keys-button",
|
||||
// "settings-button"
|
||||
// );
|
||||
|
||||
auto smallActionsMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"small-actions-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setAxisReverse(true),
|
||||
menu->getChildByID("align-x-button"),
|
||||
menu->getChildByID("align-y-button"),
|
||||
menu->getChildByID("select-all-button"),
|
||||
menu->getChildByID("select-all-left-button"),
|
||||
menu->getChildByID("select-all-right-button")
|
||||
);
|
||||
smallActionsMenu->setContentSize({ 100.f, 240.f });
|
||||
smallActionsMenu->setPositionY(130.f);
|
||||
smallActionsMenu->updateLayout();
|
||||
// auto smallActionsMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "small-actions-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// ->setAxisReverse(true),
|
||||
// menu->getChildByID("align-x-button"),
|
||||
// menu->getChildByID("align-y-button"),
|
||||
// menu->getChildByID("select-all-button"),
|
||||
// menu->getChildByID("select-all-left-button"),
|
||||
// menu->getChildByID("select-all-right-button")
|
||||
// );
|
||||
// smallActionsMenu->setContentSize({ 100.f, 240.f });
|
||||
// smallActionsMenu->setPositionY(130.f);
|
||||
// smallActionsMenu->updateLayout();
|
||||
|
||||
auto actionsMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"actions-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setAxisReverse(true),
|
||||
menu->getChildByID("keys-button"),
|
||||
menu->getChildByID("build-helper-button"),
|
||||
menu->getChildByID("create-base-button"),
|
||||
menu->getChildByID("create-outlines-button"),
|
||||
menu->getChildByID("create-edges-button"),
|
||||
menu->getChildByID("reset-unused-button"),
|
||||
menu->getChildByID("uncheck-portals-button")
|
||||
);
|
||||
if (auto keysBtn = actionsMenu->getChildByID("keys-button")) {
|
||||
keysBtn->setLayoutOptions(AxisLayoutOptions::create()->setPrevGap(10.f));
|
||||
}
|
||||
actionsMenu->setContentSize({ 100.f, 240.f });
|
||||
actionsMenu->setPositionY(130.f);
|
||||
actionsMenu->updateLayout();
|
||||
// auto actionsMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "actions-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// ->setAxisReverse(true),
|
||||
// menu->getChildByID("keys-button"),
|
||||
// menu->getChildByID("build-helper-button"),
|
||||
// menu->getChildByID("create-base-button"),
|
||||
// menu->getChildByID("create-outlines-button"),
|
||||
// menu->getChildByID("create-edges-button"),
|
||||
// menu->getChildByID("reset-unused-button"),
|
||||
// menu->getChildByID("uncheck-portals-button")
|
||||
// );
|
||||
// if (auto keysBtn = actionsMenu->getChildByID("keys-button")) {
|
||||
// keysBtn->setLayoutOptions(AxisLayoutOptions::create()->setPrevGap(10.f));
|
||||
// }
|
||||
// actionsMenu->setContentSize({ 100.f, 240.f });
|
||||
// actionsMenu->setPositionY(130.f);
|
||||
// actionsMenu->updateLayout();
|
||||
|
||||
auto optionsMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"options-menu",
|
||||
RowLayout::create()
|
||||
->setGap(0.f)
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setGrowCrossAxis(true)
|
||||
->setCrossAxisAlignment(AxisAlignment::Start)
|
||||
->setCrossAxisOverflow(false),
|
||||
menu->getChildByID("preview-mode-toggle"),
|
||||
this->getChildByID("preview-mode-label"),
|
||||
menu->getChildByID("show-ground-toggle"),
|
||||
this->getChildByID("show-ground-label"),
|
||||
menu->getChildByID("show-object-info-toggle"),
|
||||
this->getChildByID("show-object-info-label"),
|
||||
menu->getChildByID("show-grid-toggle"),
|
||||
this->getChildByID("show-grid-label"),
|
||||
menu->getChildByID("select-filter-toggle"),
|
||||
this->getChildByID("select-filter-label"),
|
||||
menu->getChildByID("follow-player-toggle"),
|
||||
this->getChildByID("follow-player-label"),
|
||||
menu->getChildByID("ignore-damage-toggle"),
|
||||
this->getChildByID("ignore-damage-label")
|
||||
);
|
||||
for (auto node : CCArrayExt<CCNode>(optionsMenu->getChildren())) {
|
||||
if (auto label = typeinfo_cast<CCLabelBMFont*>(node)) {
|
||||
label->setLayoutOptions(
|
||||
AxisLayoutOptions::create()
|
||||
->setSameLine(true)
|
||||
->setBreakLine(true)
|
||||
->setPrevGap(5.f)
|
||||
->setMinScale(.1f)
|
||||
->setMaxScale(.5f)
|
||||
->setScalePriority(1)
|
||||
);
|
||||
}
|
||||
}
|
||||
optionsMenu->setContentSize({ 120.f, winSize.height - 100.f });
|
||||
optionsMenu->setPosition(70.f, winSize.height / 2 - 50.f + 10.f);
|
||||
optionsMenu->updateLayout();
|
||||
// auto optionsMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "options-menu",
|
||||
// RowLayout::create()
|
||||
// ->setGap(0.f)
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// ->setGrowCrossAxis(true)
|
||||
// ->setCrossAxisAlignment(AxisAlignment::Start)
|
||||
// ->setCrossAxisOverflow(false),
|
||||
// menu->getChildByID("preview-mode-toggle"),
|
||||
// this->getChildByID("preview-mode-label"),
|
||||
// menu->getChildByID("show-ground-toggle"),
|
||||
// this->getChildByID("show-ground-label"),
|
||||
// menu->getChildByID("show-object-info-toggle"),
|
||||
// this->getChildByID("show-object-info-label"),
|
||||
// menu->getChildByID("show-grid-toggle"),
|
||||
// this->getChildByID("show-grid-label"),
|
||||
// menu->getChildByID("select-filter-toggle"),
|
||||
// this->getChildByID("select-filter-label"),
|
||||
// menu->getChildByID("follow-player-toggle"),
|
||||
// this->getChildByID("follow-player-label"),
|
||||
// menu->getChildByID("ignore-damage-toggle"),
|
||||
// this->getChildByID("ignore-damage-label")
|
||||
// );
|
||||
// for (auto node : CCArrayExt<CCNode>(optionsMenu->getChildren())) {
|
||||
// if (auto label = typeinfo_cast<CCLabelBMFont*>(node)) {
|
||||
// label->setLayoutOptions(
|
||||
// AxisLayoutOptions::create()
|
||||
// ->setSameLine(true)
|
||||
// ->setBreakLine(true)
|
||||
// ->setPrevGap(5.f)
|
||||
// ->setMinScale(.1f)
|
||||
// ->setMaxScale(.5f)
|
||||
// ->setScalePriority(1)
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// optionsMenu->setContentSize({ 120.f, winSize.height - 100.f });
|
||||
// optionsMenu->setPosition(70.f, winSize.height / 2 - 50.f + 10.f);
|
||||
// optionsMenu->updateLayout();
|
||||
|
||||
auto settingsMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"settings-menu",
|
||||
RowLayout::create()
|
||||
->setAxisReverse(true),
|
||||
menu->getChildByID("settings-button")
|
||||
);
|
||||
settingsMenu->setContentSize({ 95.f, 50.f });
|
||||
settingsMenu->updateLayout();
|
||||
// auto settingsMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "settings-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisReverse(true),
|
||||
// menu->getChildByID("settings-button")
|
||||
// );
|
||||
// settingsMenu->setContentSize({ 95.f, 50.f });
|
||||
// settingsMenu->updateLayout();
|
||||
|
||||
auto guidelinesMenu = menu;
|
||||
// auto guidelinesMenu = menu;
|
||||
|
||||
// replace the two guidelines buttons with a single toggle
|
||||
guidelinesMenu->getChildByID("guidelines-enable-button")->removeFromParent();
|
||||
guidelinesMenu->getChildByID("guidelines-disable-button")->removeFromParent();
|
||||
// // replace the two guidelines buttons with a single toggle
|
||||
// guidelinesMenu->getChildByID("guidelines-enable-button")->removeFromParent();
|
||||
// guidelinesMenu->getChildByID("guidelines-disable-button")->removeFromParent();
|
||||
|
||||
auto glToggle = GuidelinesButton::create();
|
||||
glToggle->setID("guidelines-enable-toggle");
|
||||
guidelinesMenu->insertBefore(glToggle, nullptr);
|
||||
m_guidelinesOffButton = m_guidelinesOnButton = nullptr;
|
||||
// this->updateSongButton();
|
||||
// auto glToggle = GuidelinesButton::create();
|
||||
// glToggle->setID("guidelines-enable-toggle");
|
||||
// guidelinesMenu->insertBefore(glToggle, nullptr);
|
||||
// m_guidelinesOffButton = m_guidelinesOnButton = nullptr;
|
||||
// // this->updateSongButton();
|
||||
|
||||
guidelinesMenu->setID("guidelines-menu");
|
||||
guidelinesMenu->setContentSize({ winSize.width / 2, 50.f });
|
||||
guidelinesMenu->setLayout(RowLayout::create());
|
||||
// guidelinesMenu->setID("guidelines-menu");
|
||||
// guidelinesMenu->setContentSize({ winSize.width / 2, 50.f });
|
||||
// guidelinesMenu->setLayout(RowLayout::create());
|
||||
|
||||
auto topMenu = CCMenu::create();
|
||||
topMenu->setContentSize({ winSize.width / 2, 50.f });
|
||||
topMenu->setPosition(winSize.width / 2, winSize.height - 30.f);
|
||||
topMenu->setID("top-menu");
|
||||
topMenu->setLayout(RowLayout::create());
|
||||
this->addChild(topMenu);
|
||||
}
|
||||
// auto topMenu = CCMenu::create();
|
||||
// topMenu->setContentSize({ winSize.width / 2, 50.f });
|
||||
// topMenu->setPosition(winSize.width / 2, winSize.height - 30.f);
|
||||
// topMenu->setID("top-menu");
|
||||
// topMenu->setLayout(RowLayout::create());
|
||||
// this->addChild(topMenu);
|
||||
// }
|
||||
|
||||
if (auto menu = detachAndCreateMenu(
|
||||
this, "info-menu",
|
||||
ColumnLayout::create()
|
||||
->setGap(10.f)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setAxisReverse(true)
|
||||
->setCrossAxisOverflow(false)
|
||||
->setCrossAxisAlignment(AxisAlignment::Start)
|
||||
->setCrossAxisLineAlignment(AxisAlignment::Start),
|
||||
this->getChildByID("object-count-label"),
|
||||
this->getChildByID("length-label"),
|
||||
this->getChildByID("length-name-label")
|
||||
)) {
|
||||
for (auto child : CCArrayExt<CCNode>(menu->getChildren())) {
|
||||
child->setLayoutOptions(
|
||||
AxisLayoutOptions::create()
|
||||
->setMinScale(.1f)
|
||||
->setMaxScale(.5f)
|
||||
->setBreakLine(true)
|
||||
);
|
||||
}
|
||||
menu->setContentSize({ 180.f, 100.f });
|
||||
menu->setPosition(100.f, winSize.height - 55.f);
|
||||
menu->updateLayout();
|
||||
}
|
||||
}
|
||||
// if (auto menu = detachAndCreateMenu(
|
||||
// this, "info-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setGap(10.f)
|
||||
// ->setAxisAlignment(AxisAlignment::End)
|
||||
// ->setAxisReverse(true)
|
||||
// ->setCrossAxisOverflow(false)
|
||||
// ->setCrossAxisAlignment(AxisAlignment::Start)
|
||||
// ->setCrossAxisLineAlignment(AxisAlignment::Start),
|
||||
// this->getChildByID("object-count-label"),
|
||||
// this->getChildByID("length-label"),
|
||||
// this->getChildByID("length-name-label")
|
||||
// )) {
|
||||
// for (auto child : CCArrayExt<CCNode>(menu->getChildren())) {
|
||||
// child->setLayoutOptions(
|
||||
// AxisLayoutOptions::create()
|
||||
// ->setMinScale(.1f)
|
||||
// ->setMaxScale(.5f)
|
||||
// ->setBreakLine(true)
|
||||
// );
|
||||
// }
|
||||
// menu->setContentSize({ 180.f, 100.f });
|
||||
// menu->setPosition(100.f, winSize.height - 55.f);
|
||||
// menu->updateLayout();
|
||||
// }
|
||||
// }
|
||||
|
||||
struct EditorPauseLayerIDs : Modify<EditorPauseLayerIDs, EditorPauseLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("EditorPauseLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set EditorPauseLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
// struct EditorPauseLayerIDs : Modify<EditorPauseLayerIDs, EditorPauseLayer> {
|
||||
// static void onModify(auto& self) {
|
||||
// if (!self.setHookPriority("EditorPauseLayer::init", GEODE_ID_PRIORITY)) {
|
||||
// log::warn("Failed to set EditorPauseLayer::init hook priority, node IDs may not work properly");
|
||||
// }
|
||||
// }
|
||||
|
||||
bool init(LevelEditorLayer* lel) {
|
||||
if (!EditorPauseLayer::init(lel)) return false;
|
||||
// bool init(LevelEditorLayer* lel) {
|
||||
// if (!EditorPauseLayer::init(lel)) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
// NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
|
|
|
@ -6,340 +6,340 @@
|
|||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(EditorUI) {
|
||||
setIDSafe(this, 0, "position-slider");
|
||||
setIDSafe(this, this->getChildrenCount() - 2, "layer-index-label");
|
||||
setIDSafe(this, this->getChildrenCount() - 1, "object-info-label");
|
||||
// $register_ids(EditorUI) {
|
||||
// setIDSafe(this, 0, "position-slider");
|
||||
// setIDSafe(this, this->getChildrenCount() - 2, "layer-index-label");
|
||||
// setIDSafe(this, this->getChildrenCount() - 1, "object-info-label");
|
||||
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
// auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("toolbar-categories-menu");
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
// menu->setID("toolbar-categories-menu");
|
||||
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"build-button",
|
||||
"edit-button",
|
||||
"delete-button",
|
||||
// setIDs(
|
||||
// menu,
|
||||
// 0,
|
||||
// "build-button",
|
||||
// "edit-button",
|
||||
// "delete-button",
|
||||
|
||||
"swipe-button",
|
||||
"free-move-button",
|
||||
"snap-button",
|
||||
"rotate-button",
|
||||
// "swipe-button",
|
||||
// "free-move-button",
|
||||
// "snap-button",
|
||||
// "rotate-button",
|
||||
|
||||
"undo-button",
|
||||
"redo-button",
|
||||
"delete-trash-button",
|
||||
// "undo-button",
|
||||
// "redo-button",
|
||||
// "delete-trash-button",
|
||||
|
||||
"music-playback-button",
|
||||
// "music-playback-button",
|
||||
|
||||
"playtest-button",
|
||||
"stop-playtest-button",
|
||||
// "playtest-button",
|
||||
// "stop-playtest-button",
|
||||
|
||||
"zoom-in-button",
|
||||
"zoom-out-button",
|
||||
// "zoom-in-button",
|
||||
// "zoom-out-button",
|
||||
|
||||
"link-button",
|
||||
"unlink-button"
|
||||
);
|
||||
// "link-button",
|
||||
// "unlink-button"
|
||||
// );
|
||||
|
||||
auto toolbarTogglesMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"toolbar-toggles-menu",
|
||||
RowLayout::create()
|
||||
->setCrossAxisOverflow(false)
|
||||
->setGrowCrossAxis(true)
|
||||
->setAxisAlignment(AxisAlignment::Center)
|
||||
->setCrossAxisAlignment(AxisAlignment::Center),
|
||||
menu->getChildByID("swipe-button"),
|
||||
menu->getChildByID("rotate-button"),
|
||||
menu->getChildByID("free-move-button"),
|
||||
menu->getChildByID("snap-button")
|
||||
);
|
||||
toolbarTogglesMenu->setPosition(
|
||||
winSize.width - 47.f,
|
||||
45.f
|
||||
);
|
||||
toolbarTogglesMenu->setContentSize({ 90.f, 90.f });
|
||||
toolbarTogglesMenu->updateLayout();
|
||||
// auto toolbarTogglesMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "toolbar-toggles-menu",
|
||||
// RowLayout::create()
|
||||
// ->setCrossAxisOverflow(false)
|
||||
// ->setGrowCrossAxis(true)
|
||||
// ->setAxisAlignment(AxisAlignment::Center)
|
||||
// ->setCrossAxisAlignment(AxisAlignment::Center),
|
||||
// menu->getChildByID("swipe-button"),
|
||||
// menu->getChildByID("rotate-button"),
|
||||
// menu->getChildByID("free-move-button"),
|
||||
// menu->getChildByID("snap-button")
|
||||
// );
|
||||
// toolbarTogglesMenu->setPosition(
|
||||
// winSize.width - 47.f,
|
||||
// 45.f
|
||||
// );
|
||||
// toolbarTogglesMenu->setContentSize({ 90.f, 90.f });
|
||||
// toolbarTogglesMenu->updateLayout();
|
||||
|
||||
auto undoMenuWidth = winSize.width / 2 - 90.f;
|
||||
auto undoMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"undo-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setGap(10.f),
|
||||
menu->getChildByID("undo-button"),
|
||||
menu->getChildByID("redo-button"),
|
||||
menu->getChildByID("delete-trash-button")
|
||||
);
|
||||
undoMenu->setContentSize({ undoMenuWidth, 50.f });
|
||||
undoMenu->setPositionX(
|
||||
undoMenu->getPositionX() + undoMenuWidth / 2 -
|
||||
getSizeSafe(undoMenu->getChildByID("undo-button")).width / 2
|
||||
);
|
||||
undoMenu->updateLayout();
|
||||
// auto undoMenuWidth = winSize.width / 2 - 90.f;
|
||||
// auto undoMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "undo-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// ->setGap(10.f),
|
||||
// menu->getChildByID("undo-button"),
|
||||
// menu->getChildByID("redo-button"),
|
||||
// menu->getChildByID("delete-trash-button")
|
||||
// );
|
||||
// undoMenu->setContentSize({ undoMenuWidth, 50.f });
|
||||
// undoMenu->setPositionX(
|
||||
// undoMenu->getPositionX() + undoMenuWidth / 2 -
|
||||
// getSizeSafe(undoMenu->getChildByID("undo-button")).width / 2
|
||||
// );
|
||||
// undoMenu->updateLayout();
|
||||
|
||||
auto playBackMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"playback-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
menu->getChildByID("music-playback-button")
|
||||
);
|
||||
playBackMenu->setContentSize({ 100.f, 50.f });
|
||||
playBackMenu->setPositionX(
|
||||
playBackMenu->getPositionX() + 100.f / 2 -
|
||||
getSizeSafe(playBackMenu->getChildByID("music-playback-button")).width / 2
|
||||
);
|
||||
playBackMenu->updateLayout();
|
||||
// auto playBackMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "playback-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start),
|
||||
// menu->getChildByID("music-playback-button")
|
||||
// );
|
||||
// playBackMenu->setContentSize({ 100.f, 50.f });
|
||||
// playBackMenu->setPositionX(
|
||||
// playBackMenu->getPositionX() + 100.f / 2 -
|
||||
// getSizeSafe(playBackMenu->getChildByID("music-playback-button")).width / 2
|
||||
// );
|
||||
// playBackMenu->updateLayout();
|
||||
|
||||
auto playTestMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"playtest-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
menu->getChildByID("playtest-button"),
|
||||
menu->getChildByID("stop-playtest-button")
|
||||
);
|
||||
playTestMenu->setContentSize({ 100.f, 50.f });
|
||||
playTestMenu->setPositionX(
|
||||
playTestMenu->getPositionX() + 100.f / 2 -
|
||||
getSizeSafe(playTestMenu->getChildByID("playtest-button")).width / 2
|
||||
);
|
||||
playTestMenu->updateLayout();
|
||||
// auto playTestMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "playtest-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start),
|
||||
// menu->getChildByID("playtest-button"),
|
||||
// menu->getChildByID("stop-playtest-button")
|
||||
// );
|
||||
// playTestMenu->setContentSize({ 100.f, 50.f });
|
||||
// playTestMenu->setPositionX(
|
||||
// playTestMenu->getPositionX() + 100.f / 2 -
|
||||
// getSizeSafe(playTestMenu->getChildByID("playtest-button")).width / 2
|
||||
// );
|
||||
// playTestMenu->updateLayout();
|
||||
|
||||
auto zoomMenuHeight = winSize.height - 245.f;
|
||||
auto zoomMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"zoom-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
menu->getChildByID("zoom-out-button"),
|
||||
menu->getChildByID("zoom-in-button")
|
||||
);
|
||||
zoomMenu->setPositionY(150.f * winSize.height / 320);
|
||||
zoomMenu->setContentSize({ 50.f, zoomMenuHeight });
|
||||
zoomMenu->updateLayout();
|
||||
// auto zoomMenuHeight = winSize.height - 245.f;
|
||||
// auto zoomMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "zoom-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start),
|
||||
// menu->getChildByID("zoom-out-button"),
|
||||
// menu->getChildByID("zoom-in-button")
|
||||
// );
|
||||
// zoomMenu->setPositionY(150.f * winSize.height / 320);
|
||||
// zoomMenu->setContentSize({ 50.f, zoomMenuHeight });
|
||||
// zoomMenu->updateLayout();
|
||||
|
||||
auto linkMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"link-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setGrowCrossAxis(true),
|
||||
menu->getChildByID("unlink-button"),
|
||||
menu->getChildByID("link-button")
|
||||
);
|
||||
linkMenu->setPositionY(150.f * winSize.height / 320);
|
||||
linkMenu->setContentSize({ 125.f, zoomMenuHeight });
|
||||
linkMenu->updateLayout();
|
||||
// auto linkMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "link-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// ->setGrowCrossAxis(true),
|
||||
// menu->getChildByID("unlink-button"),
|
||||
// menu->getChildByID("link-button")
|
||||
// );
|
||||
// linkMenu->setPositionY(150.f * winSize.height / 320);
|
||||
// linkMenu->setContentSize({ 125.f, zoomMenuHeight });
|
||||
// linkMenu->updateLayout();
|
||||
|
||||
menu->setPosition(42.f, 45.f);
|
||||
menu->setContentSize({ 100.f, 90.f });
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setGap(4.f)
|
||||
->setAxisReverse(true)
|
||||
);
|
||||
}
|
||||
// menu->setPosition(42.f, 45.f);
|
||||
// menu->setContentSize({ 100.f, 90.f });
|
||||
// menu->setLayout(
|
||||
// ColumnLayout::create()
|
||||
// ->setGap(4.f)
|
||||
// ->setAxisReverse(true)
|
||||
// );
|
||||
// }
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("delete-category-menu");
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
// menu->setID("delete-category-menu");
|
||||
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"delete-button",
|
||||
"delete-startpos-button",
|
||||
"delete-all-of-button",
|
||||
// setIDs(
|
||||
// menu,
|
||||
// 0,
|
||||
// "delete-button",
|
||||
// "delete-startpos-button",
|
||||
// "delete-all-of-button",
|
||||
|
||||
"delete-filter-none",
|
||||
"delete-filter-static",
|
||||
"delete-filter-detail",
|
||||
"delete-filter-custom",
|
||||
// "delete-filter-none",
|
||||
// "delete-filter-static",
|
||||
// "delete-filter-detail",
|
||||
// "delete-filter-custom",
|
||||
|
||||
"delete-help-icon"
|
||||
);
|
||||
// "delete-help-icon"
|
||||
// );
|
||||
|
||||
auto deleteButtonMenu = detachAndCreateMenu(
|
||||
menu,
|
||||
"delete-button-menu",
|
||||
ColumnLayout::create()
|
||||
->setCrossAxisOverflow(false)
|
||||
->setGrowCrossAxis(true)
|
||||
->setAxisReverse(true)
|
||||
->setCrossAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setCrossAxisAlignment(AxisAlignment::Center),
|
||||
menu->getChildByID("delete-button"),
|
||||
menu->getChildByID("delete-all-of-button"),
|
||||
menu->getChildByID("delete-startpos-button")
|
||||
);
|
||||
deleteButtonMenu->setPosition(-88.5f, 0.f);
|
||||
deleteButtonMenu->setContentSize({ winSize.width / 2 - 120.f, 80.f });
|
||||
deleteButtonMenu->updateLayout();
|
||||
// auto deleteButtonMenu = detachAndCreateMenu(
|
||||
// menu,
|
||||
// "delete-button-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setCrossAxisOverflow(false)
|
||||
// ->setGrowCrossAxis(true)
|
||||
// ->setAxisReverse(true)
|
||||
// ->setCrossAxisReverse(true)
|
||||
// ->setAxisAlignment(AxisAlignment::End)
|
||||
// ->setCrossAxisAlignment(AxisAlignment::Center),
|
||||
// menu->getChildByID("delete-button"),
|
||||
// menu->getChildByID("delete-all-of-button"),
|
||||
// menu->getChildByID("delete-startpos-button")
|
||||
// );
|
||||
// deleteButtonMenu->setPosition(-88.5f, 0.f);
|
||||
// deleteButtonMenu->setContentSize({ winSize.width / 2 - 120.f, 80.f });
|
||||
// deleteButtonMenu->updateLayout();
|
||||
|
||||
auto filterMenuWidth = winSize.width / 2 - 150.f;
|
||||
auto deleteFilterMenu = detachAndCreateMenu(
|
||||
menu,
|
||||
"delete-filter-menu",
|
||||
ColumnLayout::create()
|
||||
->setCrossAxisOverflow(false)
|
||||
->setGrowCrossAxis(true)
|
||||
->setAxisReverse(true)
|
||||
->setCrossAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setCrossAxisAlignment(AxisAlignment::Start),
|
||||
menu->getChildByID("delete-filter-none"),
|
||||
menu->getChildByID("delete-filter-static"),
|
||||
menu->getChildByID("delete-filter-detail"),
|
||||
menu->getChildByID("delete-filter-custom")
|
||||
);
|
||||
deleteFilterMenu->setPosition(48.5f + filterMenuWidth / 2, 0.f);
|
||||
deleteFilterMenu->setContentSize({ filterMenuWidth, 80.f });
|
||||
deleteFilterMenu->updateLayout();
|
||||
}
|
||||
// auto filterMenuWidth = winSize.width / 2 - 150.f;
|
||||
// auto deleteFilterMenu = detachAndCreateMenu(
|
||||
// menu,
|
||||
// "delete-filter-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setCrossAxisOverflow(false)
|
||||
// ->setGrowCrossAxis(true)
|
||||
// ->setAxisReverse(true)
|
||||
// ->setCrossAxisReverse(true)
|
||||
// ->setAxisAlignment(AxisAlignment::End)
|
||||
// ->setCrossAxisAlignment(AxisAlignment::Start),
|
||||
// menu->getChildByID("delete-filter-none"),
|
||||
// menu->getChildByID("delete-filter-static"),
|
||||
// menu->getChildByID("delete-filter-detail"),
|
||||
// menu->getChildByID("delete-filter-custom")
|
||||
// );
|
||||
// deleteFilterMenu->setPosition(48.5f + filterMenuWidth / 2, 0.f);
|
||||
// deleteFilterMenu->setContentSize({ filterMenuWidth, 80.f });
|
||||
// deleteFilterMenu->updateLayout();
|
||||
// }
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 2)) {
|
||||
menu->setID("build-tabs-menu");
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 2)) {
|
||||
// menu->setID("build-tabs-menu");
|
||||
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"block-tab",
|
||||
"half-block-tab",
|
||||
"outline-tab",
|
||||
"slope-tab",
|
||||
"hazard-tab",
|
||||
"3d-tab",
|
||||
"portal-tab",
|
||||
"ground-deco-tab",
|
||||
"air-deco-tab",
|
||||
"pulse-deco-tab",
|
||||
"sawblade-tab",
|
||||
"trigger-tab",
|
||||
"custom-tab"
|
||||
);
|
||||
// setIDs(
|
||||
// menu,
|
||||
// 0,
|
||||
// "block-tab",
|
||||
// "half-block-tab",
|
||||
// "outline-tab",
|
||||
// "slope-tab",
|
||||
// "hazard-tab",
|
||||
// "3d-tab",
|
||||
// "portal-tab",
|
||||
// "ground-deco-tab",
|
||||
// "air-deco-tab",
|
||||
// "pulse-deco-tab",
|
||||
// "sawblade-tab",
|
||||
// "trigger-tab",
|
||||
// "custom-tab"
|
||||
// );
|
||||
|
||||
menu->setPosition(winSize.width / 2, 100.f);
|
||||
menu->setContentSize({ winSize.width, 50.f });
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setGap(-4.f)
|
||||
);
|
||||
}
|
||||
// menu->setPosition(winSize.width / 2, 100.f);
|
||||
// menu->setContentSize({ winSize.width, 50.f });
|
||||
// menu->setLayout(
|
||||
// RowLayout::create()
|
||||
// ->setGap(-4.f)
|
||||
// );
|
||||
// }
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 3)) {
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"pause-button",
|
||||
"settings-button",
|
||||
"copy-paste-button",
|
||||
"copy-button",
|
||||
"paste-button",
|
||||
"hsv-button",
|
||||
"edit-special-button",
|
||||
"edit-object-button",
|
||||
"deselect-button",
|
||||
"edit-group-button",
|
||||
"portal-check",
|
||||
"copy-values-button",
|
||||
"paste-state-button",
|
||||
"paste-color-button",
|
||||
"go-to-layer-button",
|
||||
"next-layer-button",
|
||||
"prev-layer-button",
|
||||
"all-layers-button"
|
||||
);
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 3)) {
|
||||
// setIDs(
|
||||
// menu,
|
||||
// 0,
|
||||
// "pause-button",
|
||||
// "settings-button",
|
||||
// "copy-paste-button",
|
||||
// "copy-button",
|
||||
// "paste-button",
|
||||
// "hsv-button",
|
||||
// "edit-special-button",
|
||||
// "edit-object-button",
|
||||
// "deselect-button",
|
||||
// "edit-group-button",
|
||||
// "portal-check",
|
||||
// "copy-values-button",
|
||||
// "paste-state-button",
|
||||
// "paste-color-button",
|
||||
// "go-to-layer-button",
|
||||
// "next-layer-button",
|
||||
// "prev-layer-button",
|
||||
// "all-layers-button"
|
||||
// );
|
||||
|
||||
auto topRightMenuWidth = winSize.width / 2 - 140.f;
|
||||
auto topRightMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"settings-menu",
|
||||
RowLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
menu->getChildByID("pause-button"),
|
||||
menu->getChildByID("settings-button")
|
||||
);
|
||||
topRightMenu->setContentSize({ topRightMenuWidth, 60.f });
|
||||
topRightMenu->setPositionX(
|
||||
topRightMenu->getPositionX() - topRightMenuWidth / 2 +
|
||||
getSizeSafe(topRightMenu->getChildByID("pause-button")).width / 2
|
||||
);
|
||||
topRightMenu->updateLayout();
|
||||
// auto topRightMenuWidth = winSize.width / 2 - 140.f;
|
||||
// auto topRightMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "settings-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisReverse(true)
|
||||
// ->setAxisAlignment(AxisAlignment::End),
|
||||
// menu->getChildByID("pause-button"),
|
||||
// menu->getChildByID("settings-button")
|
||||
// );
|
||||
// topRightMenu->setContentSize({ topRightMenuWidth, 60.f });
|
||||
// topRightMenu->setPositionX(
|
||||
// topRightMenu->getPositionX() - topRightMenuWidth / 2 +
|
||||
// getSizeSafe(topRightMenu->getChildByID("pause-button")).width / 2
|
||||
// );
|
||||
// topRightMenu->updateLayout();
|
||||
|
||||
auto rightMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"editor-buttons-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setCrossAxisAlignment(AxisAlignment::End)
|
||||
->setGap(-3.5f)
|
||||
->setGrowCrossAxis(true)
|
||||
->setCrossAxisOverflow(false)
|
||||
->setAxisReverse(true),
|
||||
menu->getChildByID("copy-paste-button"),
|
||||
menu->getChildByID("edit-object-button"),
|
||||
menu->getChildByID("paste-color-button"),
|
||||
menu->getChildByID("deselect-button"),
|
||||
menu->getChildByID("paste-button"),
|
||||
menu->getChildByID("edit-group-button"),
|
||||
menu->getChildByID("paste-state-button"),
|
||||
menu->getChildByID("go-to-layer-button"),
|
||||
menu->getChildByID("copy-button"),
|
||||
menu->getChildByID("edit-special-button"),
|
||||
menu->getChildByID("copy-values-button"),
|
||||
menu->getChildByID("hsv-button")
|
||||
);
|
||||
for (auto btn : CCArrayExt<CCNode>(rightMenu->getChildren())) {
|
||||
btn->setContentSize({ 40.f, 40.f });
|
||||
}
|
||||
rightMenu->setContentSize({ 210.f, 160.f });
|
||||
rightMenu->setPosition(
|
||||
winSize.width - 210.f / 2 - 5.f,
|
||||
winSize.height / 2 + 42.5f
|
||||
);
|
||||
rightMenu->updateLayout();
|
||||
// auto rightMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "editor-buttons-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::End)
|
||||
// ->setCrossAxisAlignment(AxisAlignment::End)
|
||||
// ->setGap(-3.5f)
|
||||
// ->setGrowCrossAxis(true)
|
||||
// ->setCrossAxisOverflow(false)
|
||||
// ->setAxisReverse(true),
|
||||
// menu->getChildByID("copy-paste-button"),
|
||||
// menu->getChildByID("edit-object-button"),
|
||||
// menu->getChildByID("paste-color-button"),
|
||||
// menu->getChildByID("deselect-button"),
|
||||
// menu->getChildByID("paste-button"),
|
||||
// menu->getChildByID("edit-group-button"),
|
||||
// menu->getChildByID("paste-state-button"),
|
||||
// menu->getChildByID("go-to-layer-button"),
|
||||
// menu->getChildByID("copy-button"),
|
||||
// menu->getChildByID("edit-special-button"),
|
||||
// menu->getChildByID("copy-values-button"),
|
||||
// menu->getChildByID("hsv-button")
|
||||
// );
|
||||
// for (auto btn : CCArrayExt<CCNode>(rightMenu->getChildren())) {
|
||||
// btn->setContentSize({ 40.f, 40.f });
|
||||
// }
|
||||
// rightMenu->setContentSize({ 210.f, 160.f });
|
||||
// rightMenu->setPosition(
|
||||
// winSize.width - 210.f / 2 - 5.f,
|
||||
// winSize.height / 2 + 42.5f
|
||||
// );
|
||||
// rightMenu->updateLayout();
|
||||
|
||||
this->getChildByID("layer-index-label")->setLayoutOptions(
|
||||
AxisLayoutOptions::create()
|
||||
->setAutoScale(false)
|
||||
->setLength(25.f)
|
||||
);
|
||||
// this->getChildByID("layer-index-label")->setLayoutOptions(
|
||||
// AxisLayoutOptions::create()
|
||||
// ->setAutoScale(false)
|
||||
// ->setLength(25.f)
|
||||
// );
|
||||
|
||||
auto layerMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"layer-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
menu->getChildByID("all-layers-button"),
|
||||
menu->getChildByID("prev-layer-button"),
|
||||
this->getChildByID("layer-index-label"),
|
||||
menu->getChildByID("next-layer-button")
|
||||
);
|
||||
layerMenu->setPositionX(winSize.width - 110.f / 2);
|
||||
layerMenu->setContentSize({ 110.f, 30.f });
|
||||
layerMenu->updateLayout();
|
||||
}
|
||||
}
|
||||
// auto layerMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "layer-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start),
|
||||
// menu->getChildByID("all-layers-button"),
|
||||
// menu->getChildByID("prev-layer-button"),
|
||||
// this->getChildByID("layer-index-label"),
|
||||
// menu->getChildByID("next-layer-button")
|
||||
// );
|
||||
// layerMenu->setPositionX(winSize.width - 110.f / 2);
|
||||
// layerMenu->setContentSize({ 110.f, 30.f });
|
||||
// layerMenu->updateLayout();
|
||||
// }
|
||||
// }
|
||||
|
||||
struct EditorUIIDs : Modify<EditorUIIDs, EditorUI> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("EditorUI::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set EditorUI::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
// struct EditorUIIDs : Modify<EditorUIIDs, EditorUI> {
|
||||
// static void onModify(auto& self) {
|
||||
// if (!self.setHookPriority("EditorUI::init", GEODE_ID_PRIORITY)) {
|
||||
// log::warn("Failed to set EditorUI::init hook priority, node IDs may not work properly");
|
||||
// }
|
||||
// }
|
||||
|
||||
bool init(LevelEditorLayer* lel) {
|
||||
if (!EditorUI::init(lel)) return false;
|
||||
// bool init(LevelEditorLayer* lel) {
|
||||
// if (!EditorUI::init(lel)) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
// NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
|
|
|
@ -6,172 +6,172 @@
|
|||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(GJGarageLayer) {
|
||||
// the lock does not exist for not logged in users
|
||||
auto loggedInOffset = GJAccountManager::get()->m_accountID == GJAccountManager::get()->m_playerID ? -1 : 0;
|
||||
if (loggedInOffset == -1 && !GameManager::get()->m_clickedName) {
|
||||
// adjusts for the sprite asking for your name
|
||||
loggedInOffset++;
|
||||
}
|
||||
// $register_ids(GJGarageLayer) {
|
||||
// // the lock does not exist for not logged in users
|
||||
// auto loggedInOffset = GJAccountManager::get()->m_accountID == GJAccountManager::get()->m_playerID ? -1 : 0;
|
||||
// if (loggedInOffset == -1 && !GameManager::get()->m_clickedName) {
|
||||
// // adjusts for the sprite asking for your name
|
||||
// loggedInOffset++;
|
||||
// }
|
||||
|
||||
setIDSafe<CCTextInputNode>(this, 0, "username-label");
|
||||
setIDSafe<SimplePlayer>(this, 0, "player-icon");
|
||||
// setIDSafe<CCTextInputNode>(this, 0, "username-label");
|
||||
// setIDSafe<SimplePlayer>(this, 0, "player-icon");
|
||||
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
// auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("category-menu");
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
// menu->setID("category-menu");
|
||||
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"cube-button",
|
||||
"ship-button",
|
||||
"ball-button",
|
||||
"ufo-button",
|
||||
"wave-button",
|
||||
"robot-button",
|
||||
"spider-button",
|
||||
"trail-button",
|
||||
"death-effect-button"
|
||||
);
|
||||
// setIDs(
|
||||
// menu,
|
||||
// 0,
|
||||
// "cube-button",
|
||||
// "ship-button",
|
||||
// "ball-button",
|
||||
// "ufo-button",
|
||||
// "wave-button",
|
||||
// "robot-button",
|
||||
// "spider-button",
|
||||
// "trail-button",
|
||||
// "death-effect-button"
|
||||
// );
|
||||
|
||||
menu->setContentSize({ 320.f, 50.f });
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setGap(-4.f)
|
||||
);
|
||||
}
|
||||
// menu->setContentSize({ 320.f, 50.f });
|
||||
// menu->setLayout(
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// ->setGap(-4.f)
|
||||
// );
|
||||
// }
|
||||
|
||||
setIDs(
|
||||
this,
|
||||
10 + loggedInOffset,
|
||||
"cube-selection-menu",
|
||||
"ship-selection-menu",
|
||||
"ball-selection-menu",
|
||||
"ufo-selection-menu",
|
||||
"wave-selection-menu",
|
||||
"robot-selection-menu",
|
||||
"spider-selection-menu",
|
||||
"trail-selection-menu",
|
||||
"death-effect-selection-menu",
|
||||
// setIDs(
|
||||
// this,
|
||||
// 10 + loggedInOffset,
|
||||
// "cube-selection-menu",
|
||||
// "ship-selection-menu",
|
||||
// "ball-selection-menu",
|
||||
// "ufo-selection-menu",
|
||||
// "wave-selection-menu",
|
||||
// "robot-selection-menu",
|
||||
// "spider-selection-menu",
|
||||
// "trail-selection-menu",
|
||||
// "death-effect-selection-menu",
|
||||
|
||||
"color-1-cursor",
|
||||
"color-2-cursor",
|
||||
// "color-1-cursor",
|
||||
// "color-2-cursor",
|
||||
|
||||
"color-selection-menu"
|
||||
);
|
||||
// "color-selection-menu"
|
||||
// );
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("top-left-menu");
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
// menu->setID("top-left-menu");
|
||||
|
||||
setIDs(menu, 0, "back-button", "shop-button", "shards-button");
|
||||
// setIDs(menu, 0, "back-button", "shop-button", "shards-button");
|
||||
|
||||
auto backBtn = menu->getChildByID("back-button");
|
||||
auto backMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"back-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
backBtn
|
||||
);
|
||||
backMenu->setContentSize({ 100.f, 50.f });
|
||||
backMenu->setPositionX(
|
||||
backMenu->getPositionX() + 100.f / 2 -
|
||||
getSizeSafe(backBtn).width / 2
|
||||
);
|
||||
backMenu->updateLayout();
|
||||
// auto backBtn = menu->getChildByID("back-button");
|
||||
// auto backMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "back-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start),
|
||||
// backBtn
|
||||
// );
|
||||
// backMenu->setContentSize({ 100.f, 50.f });
|
||||
// backMenu->setPositionX(
|
||||
// backMenu->getPositionX() + 100.f / 2 -
|
||||
// getSizeSafe(backBtn).width / 2
|
||||
// );
|
||||
// backMenu->updateLayout();
|
||||
|
||||
auto shardsBtn = menu->getChildByID("shards-button");
|
||||
auto shardsMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"shards-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
shardsBtn
|
||||
);
|
||||
shardsMenu->setContentSize({ 50.f, 100.f });
|
||||
shardsMenu->setPositionY(
|
||||
shardsMenu->getPositionY() - 100.f / 2 +
|
||||
getSizeSafe(shardsBtn).height / 2
|
||||
);
|
||||
shardsMenu->updateLayout();
|
||||
}
|
||||
// auto shardsBtn = menu->getChildByID("shards-button");
|
||||
// auto shardsMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "shards-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisReverse(true)
|
||||
// ->setAxisAlignment(AxisAlignment::End),
|
||||
// shardsBtn
|
||||
// );
|
||||
// shardsMenu->setContentSize({ 50.f, 100.f });
|
||||
// shardsMenu->setPositionY(
|
||||
// shardsMenu->getPositionY() - 100.f / 2 +
|
||||
// getSizeSafe(shardsBtn).height / 2
|
||||
// );
|
||||
// shardsMenu->updateLayout();
|
||||
// }
|
||||
|
||||
auto bottomLeftMenu = CCMenu::create();
|
||||
bottomLeftMenu->setID("bottom-left-menu");
|
||||
bottomLeftMenu->setContentSize({ 50.f, 70.f });
|
||||
bottomLeftMenu->setPosition(30.f, 115.f);
|
||||
bottomLeftMenu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
this->addChild(bottomLeftMenu);
|
||||
// auto bottomLeftMenu = CCMenu::create();
|
||||
// bottomLeftMenu->setID("bottom-left-menu");
|
||||
// bottomLeftMenu->setContentSize({ 50.f, 70.f });
|
||||
// bottomLeftMenu->setPosition(30.f, 115.f);
|
||||
// bottomLeftMenu->setLayout(
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// );
|
||||
// this->addChild(bottomLeftMenu);
|
||||
|
||||
auto bottomRightMenu = CCMenu::create();
|
||||
bottomRightMenu->setID("bottom-right-menu");
|
||||
bottomRightMenu->setContentSize({ 50.f, 110.f });
|
||||
bottomRightMenu->setPosition(winSize.width - 30.f, 135.f);
|
||||
bottomRightMenu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
this->addChild(bottomRightMenu);
|
||||
// auto bottomRightMenu = CCMenu::create();
|
||||
// bottomRightMenu->setID("bottom-right-menu");
|
||||
// bottomRightMenu->setContentSize({ 50.f, 110.f });
|
||||
// bottomRightMenu->setPosition(winSize.width - 30.f, 135.f);
|
||||
// bottomRightMenu->setLayout(
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// );
|
||||
// this->addChild(bottomRightMenu);
|
||||
|
||||
// aspect ratio responsiveness
|
||||
if (winSize.width / winSize.height <= 5.1f / 3.f) {
|
||||
bottomLeftMenu->setPosition(15.f, 115.f);
|
||||
bottomRightMenu->setPosition(winSize.width - 15.f, 135.f);
|
||||
// // aspect ratio responsiveness
|
||||
// if (winSize.width / winSize.height <= 5.1f / 3.f) {
|
||||
// bottomLeftMenu->setPosition(15.f, 115.f);
|
||||
// bottomRightMenu->setPosition(winSize.width - 15.f, 135.f);
|
||||
|
||||
if (auto shardsMenu = this->getChildByID("shards-menu")) {
|
||||
shardsMenu->setContentSize({ 110.f, 50.f });
|
||||
shardsMenu->setPosition(
|
||||
shardsMenu->getPosition() + ccp(50.f, 30.f)
|
||||
);
|
||||
shardsMenu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
}
|
||||
}
|
||||
if (winSize.width / winSize.height <= 4.1f / 3.f) {
|
||||
bottomLeftMenu->setContentSize({ 90.f, 50.f });
|
||||
bottomLeftMenu->setPosition(
|
||||
15.f + 110.f / 2,
|
||||
85.f
|
||||
);
|
||||
bottomLeftMenu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
// if (auto shardsMenu = this->getChildByID("shards-menu")) {
|
||||
// shardsMenu->setContentSize({ 110.f, 50.f });
|
||||
// shardsMenu->setPosition(
|
||||
// shardsMenu->getPosition() + ccp(50.f, 30.f)
|
||||
// );
|
||||
// shardsMenu->setLayout(
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// if (winSize.width / winSize.height <= 4.1f / 3.f) {
|
||||
// bottomLeftMenu->setContentSize({ 90.f, 50.f });
|
||||
// bottomLeftMenu->setPosition(
|
||||
// 15.f + 110.f / 2,
|
||||
// 85.f
|
||||
// );
|
||||
// bottomLeftMenu->setLayout(
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// );
|
||||
|
||||
bottomRightMenu->setContentSize({ 90.f, 50.f });
|
||||
bottomRightMenu->setPosition(
|
||||
winSize.width - 15.f - 110.f / 2,
|
||||
85.f
|
||||
);
|
||||
bottomRightMenu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
);
|
||||
}
|
||||
}
|
||||
// bottomRightMenu->setContentSize({ 90.f, 50.f });
|
||||
// bottomRightMenu->setPosition(
|
||||
// winSize.width - 15.f - 110.f / 2,
|
||||
// 85.f
|
||||
// );
|
||||
// bottomRightMenu->setLayout(
|
||||
// RowLayout::create()
|
||||
// ->setAxisReverse(true)
|
||||
// ->setAxisAlignment(AxisAlignment::End)
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
struct GJGarageLayerIDs : Modify<GJGarageLayerIDs, GJGarageLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("GJGarageLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set GJGarageLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
// struct GJGarageLayerIDs : Modify<GJGarageLayerIDs, GJGarageLayer> {
|
||||
// static void onModify(auto& self) {
|
||||
// if (!self.setHookPriority("GJGarageLayer::init", GEODE_ID_PRIORITY)) {
|
||||
// log::warn("Failed to set GJGarageLayer::init hook priority, node IDs may not work properly");
|
||||
// }
|
||||
// }
|
||||
|
||||
bool init() {
|
||||
if (!GJGarageLayer::init()) return false;
|
||||
// bool init() {
|
||||
// if (!GJGarageLayer::init()) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
// NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
|
|
|
@ -6,168 +6,168 @@
|
|||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(LevelBrowserLayer) {
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
// $register_ids(LevelBrowserLayer) {
|
||||
// auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("back-menu");
|
||||
auto btn = setIDSafe(menu, 0, "back-button");
|
||||
menu->setContentSize({ 100.f, 50.f });
|
||||
menu->setPositionX(
|
||||
menu->getPositionX() + 100.f / 2 -
|
||||
getSizeSafe(btn).width / 2
|
||||
);
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
}
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
// menu->setID("back-menu");
|
||||
// auto btn = setIDSafe(menu, 0, "back-button");
|
||||
// menu->setContentSize({ 100.f, 50.f });
|
||||
// menu->setPositionX(
|
||||
// menu->getPositionX() + 100.f / 2 -
|
||||
// getSizeSafe(btn).width / 2
|
||||
// );
|
||||
// menu->setLayout(
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// );
|
||||
// }
|
||||
|
||||
if (m_searchObject->m_searchType == SearchType::MyLevels) {
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 2)) {
|
||||
menu->setID("new-level-menu");
|
||||
auto newLvlBtn = setIDSafe(menu, 0, "new-level-button");
|
||||
// if (m_searchObject->m_searchType == SearchType::MyLevels) {
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 2)) {
|
||||
// menu->setID("new-level-menu");
|
||||
// auto newLvlBtn = setIDSafe(menu, 0, "new-level-button");
|
||||
|
||||
if (auto myLevelsBtn = setIDSafe(menu, 1, "my-levels-button")) {
|
||||
auto menu = detachAndCreateMenu(
|
||||
this,
|
||||
"my-levels-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
myLevelsBtn
|
||||
);
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() + 125.f / 2 -
|
||||
myLevelsBtn->getScaledContentSize().height / 2
|
||||
);
|
||||
menu->setContentSize({ 50.f, 125.f });
|
||||
menu->updateLayout();
|
||||
}
|
||||
// if (auto myLevelsBtn = setIDSafe(menu, 1, "my-levels-button")) {
|
||||
// auto menu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "my-levels-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start),
|
||||
// myLevelsBtn
|
||||
// );
|
||||
// menu->setPositionY(
|
||||
// menu->getPositionY() + 125.f / 2 -
|
||||
// myLevelsBtn->getScaledContentSize().height / 2
|
||||
// );
|
||||
// menu->setContentSize({ 50.f, 125.f });
|
||||
// menu->updateLayout();
|
||||
// }
|
||||
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() + 130.f / 2 -
|
||||
getSizeSafe(newLvlBtn).height / 2
|
||||
);
|
||||
menu->setContentSize({ 50.f, 130.f });
|
||||
menu->updateLayout();
|
||||
}
|
||||
// menu->setLayout(
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// );
|
||||
// menu->setPositionY(
|
||||
// menu->getPositionY() + 130.f / 2 -
|
||||
// getSizeSafe(newLvlBtn).height / 2
|
||||
// );
|
||||
// menu->setContentSize({ 50.f, 130.f });
|
||||
// menu->updateLayout();
|
||||
// }
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
if (auto searchBtn = setIDSafe(menu, 5, "search-button")) {
|
||||
auto clearBtn = setIDSafe(menu, 6, "clear-search-button");
|
||||
// this is a hacky fix because for some reason adding children
|
||||
// before the clear button is made visible is inconsistent
|
||||
if (clearBtn) {
|
||||
searchBtn->setZOrder(-1);
|
||||
clearBtn->setZOrder(-1);
|
||||
}
|
||||
auto searchMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"search-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setCrossAxisReverse(true)
|
||||
->setGrowCrossAxis(true)
|
||||
->setCrossAxisOverflow(false)
|
||||
->setCrossAxisAlignment(AxisAlignment::Start)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
searchBtn,
|
||||
clearBtn
|
||||
);
|
||||
auto width = 45.f * winSize.aspect();
|
||||
searchMenu->setPosition(
|
||||
searchMenu->getPositionX() + width / 2 -
|
||||
searchBtn->getScaledContentSize().width / 2,
|
||||
searchMenu->getPositionY() - 80.f / 2 +
|
||||
searchBtn->getScaledContentSize().height / 2
|
||||
);
|
||||
searchMenu->setContentSize({ width, 80.f });
|
||||
searchMenu->updateLayout();
|
||||
}
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
// if (auto searchBtn = setIDSafe(menu, 5, "search-button")) {
|
||||
// auto clearBtn = setIDSafe(menu, 6, "clear-search-button");
|
||||
// // this is a hacky fix because for some reason adding children
|
||||
// // before the clear button is made visible is inconsistent
|
||||
// if (clearBtn) {
|
||||
// searchBtn->setZOrder(-1);
|
||||
// clearBtn->setZOrder(-1);
|
||||
// }
|
||||
// auto searchMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "search-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisReverse(true)
|
||||
// ->setCrossAxisReverse(true)
|
||||
// ->setGrowCrossAxis(true)
|
||||
// ->setCrossAxisOverflow(false)
|
||||
// ->setCrossAxisAlignment(AxisAlignment::Start)
|
||||
// ->setAxisAlignment(AxisAlignment::End),
|
||||
// searchBtn,
|
||||
// clearBtn
|
||||
// );
|
||||
// auto width = 45.f * winSize.aspect();
|
||||
// searchMenu->setPosition(
|
||||
// searchMenu->getPositionX() + width / 2 -
|
||||
// searchBtn->getScaledContentSize().width / 2,
|
||||
// searchMenu->getPositionY() - 80.f / 2 +
|
||||
// searchBtn->getScaledContentSize().height / 2
|
||||
// );
|
||||
// searchMenu->setContentSize({ width, 80.f });
|
||||
// searchMenu->updateLayout();
|
||||
// }
|
||||
|
||||
if (auto pageBtn = setIDSafe(menu, 2, "page-button")) {
|
||||
auto folderBtn = setIDSafe(menu, 3, "folder-button");
|
||||
auto lastPageBtn = setIDSafe(menu, 4, "last-page-button");
|
||||
auto pageMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"page-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setGrowCrossAxis(true)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
pageBtn,
|
||||
folderBtn,
|
||||
lastPageBtn
|
||||
);
|
||||
pageMenu->setContentSize({ 40.f, 110.f });
|
||||
pageMenu->setAnchorPoint({ 1.f, .5f });
|
||||
pageMenu->setPosition(
|
||||
pageMenu->getPositionX() + 20.f,
|
||||
pageMenu->getPositionY() - 110.f / 2 + 12.5f
|
||||
);
|
||||
pageMenu->updateLayout();
|
||||
}
|
||||
// if (auto pageBtn = setIDSafe(menu, 2, "page-button")) {
|
||||
// auto folderBtn = setIDSafe(menu, 3, "folder-button");
|
||||
// auto lastPageBtn = setIDSafe(menu, 4, "last-page-button");
|
||||
// auto pageMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "page-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisReverse(true)
|
||||
// ->setGrowCrossAxis(true)
|
||||
// ->setAxisAlignment(AxisAlignment::End),
|
||||
// pageBtn,
|
||||
// folderBtn,
|
||||
// lastPageBtn
|
||||
// );
|
||||
// pageMenu->setContentSize({ 40.f, 110.f });
|
||||
// pageMenu->setAnchorPoint({ 1.f, .5f });
|
||||
// pageMenu->setPosition(
|
||||
// pageMenu->getPositionX() + 20.f,
|
||||
// pageMenu->getPositionY() - 110.f / 2 + 12.5f
|
||||
// );
|
||||
// pageMenu->updateLayout();
|
||||
// }
|
||||
|
||||
auto navMenuWidth = 50.f * winSize.aspect();
|
||||
// auto navMenuWidth = 50.f * winSize.aspect();
|
||||
|
||||
if (auto prevPageBtn = setIDSafe(menu, 0, "prev-page-button")) {
|
||||
auto navMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"prev-page-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
prevPageBtn
|
||||
);
|
||||
prevPageBtn->setZOrder(-1);
|
||||
navMenu->setContentSize({ navMenuWidth, 40.f });
|
||||
navMenu->setPositionX(
|
||||
navMenu->getPositionX() + navMenuWidth / 2 -
|
||||
prevPageBtn->getScaledContentSize().width / 2
|
||||
);
|
||||
navMenu->updateLayout();
|
||||
}
|
||||
// if (auto prevPageBtn = setIDSafe(menu, 0, "prev-page-button")) {
|
||||
// auto navMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "prev-page-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start),
|
||||
// prevPageBtn
|
||||
// );
|
||||
// prevPageBtn->setZOrder(-1);
|
||||
// navMenu->setContentSize({ navMenuWidth, 40.f });
|
||||
// navMenu->setPositionX(
|
||||
// navMenu->getPositionX() + navMenuWidth / 2 -
|
||||
// prevPageBtn->getScaledContentSize().width / 2
|
||||
// );
|
||||
// navMenu->updateLayout();
|
||||
// }
|
||||
|
||||
auto nextPageBtn = setIDSafe(menu, 0, "next-page-button");
|
||||
// auto nextPageBtn = setIDSafe(menu, 0, "next-page-button");
|
||||
|
||||
menu->setID("next-page-menu");
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
);
|
||||
menu->setContentSize({ navMenuWidth, 40.f });
|
||||
menu->setPositionX(
|
||||
winSize.width - navMenuWidth / 2 - 5.f
|
||||
);
|
||||
menu->updateLayout();
|
||||
}
|
||||
}
|
||||
// menu->setID("next-page-menu");
|
||||
// menu->setLayout(
|
||||
// RowLayout::create()
|
||||
// ->setAxisReverse(true)
|
||||
// ->setAxisAlignment(AxisAlignment::End)
|
||||
// );
|
||||
// menu->setContentSize({ navMenuWidth, 40.f });
|
||||
// menu->setPositionX(
|
||||
// winSize.width - navMenuWidth / 2 - 5.f
|
||||
// );
|
||||
// menu->updateLayout();
|
||||
// }
|
||||
// }
|
||||
|
||||
auto bottomMenu = CCMenu::create();
|
||||
bottomMenu->setID("bottom-menu");
|
||||
bottomMenu->setContentSize({ 325.f + 20.f * winSize.aspect(), 50.f });
|
||||
bottomMenu->setPosition(winSize.width / 2, 28.f);
|
||||
bottomMenu->setZOrder(15);
|
||||
bottomMenu->setLayout(RowLayout::create());
|
||||
this->addChild(bottomMenu);
|
||||
}
|
||||
// auto bottomMenu = CCMenu::create();
|
||||
// bottomMenu->setID("bottom-menu");
|
||||
// bottomMenu->setContentSize({ 325.f + 20.f * winSize.aspect(), 50.f });
|
||||
// bottomMenu->setPosition(winSize.width / 2, 28.f);
|
||||
// bottomMenu->setZOrder(15);
|
||||
// bottomMenu->setLayout(RowLayout::create());
|
||||
// this->addChild(bottomMenu);
|
||||
// }
|
||||
|
||||
struct LevelBrowserLayerIDs : Modify<LevelBrowserLayerIDs, LevelBrowserLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("LevelBrowserLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set LevelBrowserLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
// struct LevelBrowserLayerIDs : Modify<LevelBrowserLayerIDs, LevelBrowserLayer> {
|
||||
// static void onModify(auto& self) {
|
||||
// if (!self.setHookPriority("LevelBrowserLayer::init", GEODE_ID_PRIORITY)) {
|
||||
// log::warn("Failed to set LevelBrowserLayer::init hook priority, node IDs may not work properly");
|
||||
// }
|
||||
// }
|
||||
|
||||
bool init(GJSearchObject* obj) {
|
||||
if (!LevelBrowserLayer::init(obj)) return false;
|
||||
// bool init(GJSearchObject* obj) {
|
||||
// if (!LevelBrowserLayer::init(obj)) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
// NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// return true;
|
||||
// }
|
||||
// };
|
|
@ -3,135 +3,135 @@
|
|||
#include <Geode/binding/LevelInfoLayer.hpp>
|
||||
#include <Geode/modify/LevelInfoLayer.hpp>
|
||||
|
||||
$register_ids(LevelInfoLayer) {
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
// $register_ids(LevelInfoLayer) {
|
||||
// auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
setIDSafe<CCSprite>(this, 0, "background");
|
||||
// setIDSafe<CCSprite>(this, 0, "background");
|
||||
|
||||
size_t iconOffset = 0;
|
||||
// size_t iconOffset = 0;
|
||||
|
||||
setIDSafe<CCSprite>(this, 1, "bottom-left-art");
|
||||
setIDSafe<CCSprite>(this, 2, "bottom-right-art");
|
||||
// setIDSafe<CCSprite>(this, 1, "bottom-left-art");
|
||||
// setIDSafe<CCSprite>(this, 2, "bottom-right-art");
|
||||
|
||||
if (m_level->m_highObjectsEnabled) {
|
||||
setIDSafe<CCSprite>(this, 4, "high-object-indicator");
|
||||
iconOffset++;
|
||||
}
|
||||
// if (m_level->m_highObjectsEnabled) {
|
||||
// setIDSafe<CCSprite>(this, 4, "high-object-indicator");
|
||||
// iconOffset++;
|
||||
// }
|
||||
|
||||
setIDSafe<CCSprite>(this, 4 + iconOffset, "length-icon");
|
||||
setIDSafe<CCSprite>(this, 5 + iconOffset, "downloads-icon");
|
||||
setIDSafe<CCSprite>(this, 6 + iconOffset, "orbs-icon");
|
||||
setIDSafe<CCSprite>(this, 7 + iconOffset, "likes-icon");
|
||||
setIDSafe<CCLabelBMFont>(this, 1, "downloads-label");
|
||||
setIDSafe<CCLabelBMFont>(this, 2, "length-label");
|
||||
setIDSafe<CCLabelBMFont>(this, 3, "likes-label");
|
||||
setIDSafe<CCLabelBMFont>(this, 4, "orbs-label");
|
||||
// setIDSafe<CCSprite>(this, 4 + iconOffset, "length-icon");
|
||||
// setIDSafe<CCSprite>(this, 5 + iconOffset, "downloads-icon");
|
||||
// setIDSafe<CCSprite>(this, 6 + iconOffset, "orbs-icon");
|
||||
// setIDSafe<CCSprite>(this, 7 + iconOffset, "likes-icon");
|
||||
// setIDSafe<CCLabelBMFont>(this, 1, "downloads-label");
|
||||
// setIDSafe<CCLabelBMFont>(this, 2, "length-label");
|
||||
// setIDSafe<CCLabelBMFont>(this, 3, "likes-label");
|
||||
// setIDSafe<CCLabelBMFont>(this, 4, "orbs-label");
|
||||
|
||||
if (m_level->m_stars) {
|
||||
setIDSafe<CCSprite>(this, 8 + iconOffset, "stars-icon");
|
||||
setIDSafe<CCLabelBMFont>(this, 5, "stars-label");
|
||||
}
|
||||
// if (m_level->m_stars) {
|
||||
// setIDSafe<CCSprite>(this, 8 + iconOffset, "stars-icon");
|
||||
// setIDSafe<CCLabelBMFont>(this, 5, "stars-label");
|
||||
// }
|
||||
|
||||
setIDSafe<CustomSongWidget>(this, 0, "custom-songs-widget");
|
||||
// setIDSafe<CustomSongWidget>(this, 0, "custom-songs-widget");
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("play-menu");
|
||||
setIDSafe(menu, 0, "play-button");
|
||||
}
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
// menu->setID("play-menu");
|
||||
// setIDSafe(menu, 0, "play-button");
|
||||
// }
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 2)) {
|
||||
menu->setID("back-menu");
|
||||
auto backBtn = setIDSafe(menu, 0, "back-button");
|
||||
menu->setPositionX(
|
||||
menu->getPositionX() + 100.f / 2 -
|
||||
getSizeSafe(backBtn).width / 2
|
||||
);
|
||||
menu->setContentSize({ 100.f, 50.f });
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
}
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 2)) {
|
||||
// menu->setID("back-menu");
|
||||
// auto backBtn = setIDSafe(menu, 0, "back-button");
|
||||
// menu->setPositionX(
|
||||
// menu->getPositionX() + 100.f / 2 -
|
||||
// getSizeSafe(backBtn).width / 2
|
||||
// );
|
||||
// menu->setContentSize({ 100.f, 50.f });
|
||||
// menu->setLayout(
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::Start)
|
||||
// );
|
||||
// }
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("right-side-menu");
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
// menu->setID("right-side-menu");
|
||||
|
||||
if (auto name = setIDSafe(menu, 0, "creator-name")) {
|
||||
auto menu = detachAndCreateMenu(
|
||||
this,
|
||||
"creator-info-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
name
|
||||
);
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() - 40.f / 2 +
|
||||
name->getScaledContentSize().height / 2
|
||||
);
|
||||
menu->setContentSize({ 60.f, 40.f });
|
||||
menu->updateLayout();
|
||||
}
|
||||
// if (auto name = setIDSafe(menu, 0, "creator-name")) {
|
||||
// auto menu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "creator-info-menu",
|
||||
// ColumnLayout::create()
|
||||
// ->setAxisReverse(true)
|
||||
// ->setAxisAlignment(AxisAlignment::End),
|
||||
// name
|
||||
// );
|
||||
// menu->setPositionY(
|
||||
// menu->getPositionY() - 40.f / 2 +
|
||||
// name->getScaledContentSize().height / 2
|
||||
// );
|
||||
// menu->setContentSize({ 60.f, 40.f });
|
||||
// menu->updateLayout();
|
||||
// }
|
||||
|
||||
auto leftSideMenu = CCMenu::create();
|
||||
leftSideMenu->setPosition(30.f, winSize.height / 2);
|
||||
leftSideMenu->setLayout(ColumnLayout::create());
|
||||
leftSideMenu->setID("left-side-menu");
|
||||
leftSideMenu->setContentSize({ 50.f, 225.f });
|
||||
this->addChild(leftSideMenu);
|
||||
// auto leftSideMenu = CCMenu::create();
|
||||
// leftSideMenu->setPosition(30.f, winSize.height / 2);
|
||||
// leftSideMenu->setLayout(ColumnLayout::create());
|
||||
// leftSideMenu->setID("left-side-menu");
|
||||
// leftSideMenu->setContentSize({ 50.f, 225.f });
|
||||
// this->addChild(leftSideMenu);
|
||||
|
||||
menu->setPosition(winSize.width - 30.f, winSize.height / 2);
|
||||
// menu->setPosition(winSize.width - 30.f, winSize.height / 2);
|
||||
|
||||
for (auto child : CCArrayExt<CCNode>(menu->getChildren())) {
|
||||
if (child->getPositionX() < 0.f) {
|
||||
child->retain();
|
||||
child->removeFromParent();
|
||||
leftSideMenu->addChild(child);
|
||||
child->release();
|
||||
}
|
||||
child->setPositionX(0.f);
|
||||
}
|
||||
// for (auto child : CCArrayExt<CCNode>(menu->getChildren())) {
|
||||
// if (child->getPositionX() < 0.f) {
|
||||
// child->retain();
|
||||
// child->removeFromParent();
|
||||
// leftSideMenu->addChild(child);
|
||||
// child->release();
|
||||
// }
|
||||
// child->setPositionX(0.f);
|
||||
// }
|
||||
|
||||
setIDSafe(menu, 0, "delete-button");
|
||||
setIDSafe(menu, 1, "refresh-button");
|
||||
setIDSafe(menu, 2, "info-button");
|
||||
setIDSafe(menu, 3, "leaderboards-button");
|
||||
setIDSafe(menu, 4, "like-button");
|
||||
setIDSafe(menu, 5, "rate-button");
|
||||
// setIDSafe(menu, 0, "delete-button");
|
||||
// setIDSafe(menu, 1, "refresh-button");
|
||||
// setIDSafe(menu, 2, "info-button");
|
||||
// setIDSafe(menu, 3, "leaderboards-button");
|
||||
// setIDSafe(menu, 4, "like-button");
|
||||
// setIDSafe(menu, 5, "rate-button");
|
||||
|
||||
menu->setPosition(
|
||||
menu->getPositionX() + static_cast<CCNode*>(
|
||||
menu->getChildren()->firstObject()
|
||||
)->getPositionX(),
|
||||
winSize.height / 2
|
||||
);
|
||||
menu->setContentSize({ 60.f, winSize.height - 15.f });
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setGap(3.f)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setAxisReverse(true)
|
||||
);
|
||||
// menu->setPosition(
|
||||
// menu->getPositionX() + static_cast<CCNode*>(
|
||||
// menu->getChildren()->firstObject()
|
||||
// )->getPositionX(),
|
||||
// winSize.height / 2
|
||||
// );
|
||||
// menu->setContentSize({ 60.f, winSize.height - 15.f });
|
||||
// menu->setLayout(
|
||||
// ColumnLayout::create()
|
||||
// ->setGap(3.f)
|
||||
// ->setAxisAlignment(AxisAlignment::End)
|
||||
// ->setAxisReverse(true)
|
||||
// );
|
||||
|
||||
setIDSafe(leftSideMenu, 0, "copy-button");
|
||||
// setIDSafe(leftSideMenu, 0, "copy-button");
|
||||
|
||||
menu->updateLayout();
|
||||
leftSideMenu->updateLayout();
|
||||
}
|
||||
}
|
||||
// menu->updateLayout();
|
||||
// leftSideMenu->updateLayout();
|
||||
// }
|
||||
// }
|
||||
|
||||
struct LevelInfoLayerIDs : Modify<LevelInfoLayerIDs, LevelInfoLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("LevelInfoLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set LevelInfoLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
// struct LevelInfoLayerIDs : Modify<LevelInfoLayerIDs, LevelInfoLayer> {
|
||||
// static void onModify(auto& self) {
|
||||
// if (!self.setHookPriority("LevelInfoLayer::init", GEODE_ID_PRIORITY)) {
|
||||
// log::warn("Failed to set LevelInfoLayer::init hook priority, node IDs may not work properly");
|
||||
// }
|
||||
// }
|
||||
|
||||
bool init(GJGameLevel* level) {
|
||||
if (!LevelInfoLayer::init(level)) return false;
|
||||
// bool init(GJGameLevel* level) {
|
||||
// if (!LevelInfoLayer::init(level)) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
// NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// return true;
|
||||
// }
|
||||
// };
|
|
@ -2,81 +2,81 @@
|
|||
|
||||
#include <Geode/modify/LevelSearchLayer.hpp>
|
||||
|
||||
$register_ids(LevelSearchLayer) {
|
||||
// set the funny ids
|
||||
setIDSafe(this, 0, "background");
|
||||
getChildOfType<CCTextInputNode>(this, 0)->setID("search-bar");
|
||||
getChildOfType<CCScale9Sprite>(this, 0)->setID("level-search-bg");
|
||||
getChildOfType<CCScale9Sprite>(this, 1)->setID("level-search-bar-bg");
|
||||
getChildOfType<CCScale9Sprite>(this, 2)->setID("quick-search-bg");
|
||||
getChildOfType<CCScale9Sprite>(this, 3)->setID("difficulty-filters-bg");
|
||||
getChildOfType<CCScale9Sprite>(this, 4)->setID("length-filters-bg");
|
||||
getChildOfType<CCLabelBMFont>(this, 0)->setID("quick-search-title");
|
||||
getChildOfType<CCLabelBMFont>(this, 1)->setID("filters-title");
|
||||
getChildOfType<CCSprite>(this, 1)->setID("left-corner");
|
||||
getChildOfType<CCSprite>(this, 2)->setID("right-corner");
|
||||
// $register_ids(LevelSearchLayer) {
|
||||
// // set the funny ids
|
||||
// setIDSafe(this, 0, "background");
|
||||
// getChildOfType<CCTextInputNode>(this, 0)->setID("search-bar");
|
||||
// getChildOfType<CCScale9Sprite>(this, 0)->setID("level-search-bg");
|
||||
// getChildOfType<CCScale9Sprite>(this, 1)->setID("level-search-bar-bg");
|
||||
// getChildOfType<CCScale9Sprite>(this, 2)->setID("quick-search-bg");
|
||||
// getChildOfType<CCScale9Sprite>(this, 3)->setID("difficulty-filters-bg");
|
||||
// getChildOfType<CCScale9Sprite>(this, 4)->setID("length-filters-bg");
|
||||
// getChildOfType<CCLabelBMFont>(this, 0)->setID("quick-search-title");
|
||||
// getChildOfType<CCLabelBMFont>(this, 1)->setID("filters-title");
|
||||
// getChildOfType<CCSprite>(this, 1)->setID("left-corner");
|
||||
// getChildOfType<CCSprite>(this, 2)->setID("right-corner");
|
||||
|
||||
if (auto filtermenu = getChildOfType<CCMenu>(this, 0)) {
|
||||
filtermenu->setID("other-filter-menu");
|
||||
setIDSafe(filtermenu, 0, "clear-filters-button");
|
||||
setIDSafe(filtermenu, 1, "advanced-filters-button");
|
||||
}
|
||||
if (auto searchmenu = getChildOfType<CCMenu>(this, 1)) {
|
||||
searchmenu->setID("search-button-menu");
|
||||
setIDSafe(searchmenu, 0, "search-level-button");
|
||||
setIDSafe(searchmenu, 1, "search-user-button");
|
||||
}
|
||||
if (auto quickmenu = getChildOfType<CCMenu>(this, 2)) {
|
||||
quickmenu->setID("quick-search-menu");
|
||||
setIDSafe(quickmenu, 0, "most-downloaded-button");
|
||||
setIDSafe(quickmenu, 1, "most-liked-button");
|
||||
setIDSafe(quickmenu, 2, "trending-button");
|
||||
setIDSafe(quickmenu, 3, "recent-button");
|
||||
setIDSafe(quickmenu, 4, "magic-button");
|
||||
setIDSafe(quickmenu, 5, "awarded-button");
|
||||
setIDSafe(quickmenu, 6, "followed-button");
|
||||
setIDSafe(quickmenu, 7, "friends-button");
|
||||
}
|
||||
if (auto filtersmenu = getChildOfType<CCMenu>(this, 3)) {
|
||||
filtersmenu->setID("difficulty-filter-menu");
|
||||
setIDSafe(filtersmenu, 0, "na-filter-button");
|
||||
setIDSafe(filtersmenu, 1, "easy-filter-button");
|
||||
setIDSafe(filtersmenu, 2, "normal-filter-button");
|
||||
setIDSafe(filtersmenu, 3, "hard-filter-button");
|
||||
setIDSafe(filtersmenu, 4, "harder-filter-button");
|
||||
setIDSafe(filtersmenu, 5, "insane-filter-button");
|
||||
setIDSafe(filtersmenu, 6, "demon-filter-button");
|
||||
setIDSafe(filtersmenu, 7, "auto-filter-button");
|
||||
setIDSafe(filtersmenu, 8, "demon-type-filter-button");
|
||||
}
|
||||
if (auto filtersmenu = getChildOfType<CCMenu>(this, 4)) {
|
||||
filtersmenu->setID("length-filter-menu");
|
||||
setIDSafe(filtersmenu, 0, "clock-icon");
|
||||
setIDSafe(filtersmenu, 1, "tiny-filter-button");
|
||||
setIDSafe(filtersmenu, 2, "short-filter-button");
|
||||
setIDSafe(filtersmenu, 3, "medium-filter-button");
|
||||
setIDSafe(filtersmenu, 4, "long-filter-button");
|
||||
setIDSafe(filtersmenu, 5, "xl-filter-button");
|
||||
setIDSafe(filtersmenu, 6, "star-filter-button");
|
||||
}
|
||||
if (auto backmenu = getChildOfType<CCMenu>(this, 5)) {
|
||||
backmenu->setID("exit-menu");
|
||||
setIDSafe(backmenu, 0, "exit-button");
|
||||
}
|
||||
}
|
||||
// if (auto filtermenu = getChildOfType<CCMenu>(this, 0)) {
|
||||
// filtermenu->setID("other-filter-menu");
|
||||
// setIDSafe(filtermenu, 0, "clear-filters-button");
|
||||
// setIDSafe(filtermenu, 1, "advanced-filters-button");
|
||||
// }
|
||||
// if (auto searchmenu = getChildOfType<CCMenu>(this, 1)) {
|
||||
// searchmenu->setID("search-button-menu");
|
||||
// setIDSafe(searchmenu, 0, "search-level-button");
|
||||
// setIDSafe(searchmenu, 1, "search-user-button");
|
||||
// }
|
||||
// if (auto quickmenu = getChildOfType<CCMenu>(this, 2)) {
|
||||
// quickmenu->setID("quick-search-menu");
|
||||
// setIDSafe(quickmenu, 0, "most-downloaded-button");
|
||||
// setIDSafe(quickmenu, 1, "most-liked-button");
|
||||
// setIDSafe(quickmenu, 2, "trending-button");
|
||||
// setIDSafe(quickmenu, 3, "recent-button");
|
||||
// setIDSafe(quickmenu, 4, "magic-button");
|
||||
// setIDSafe(quickmenu, 5, "awarded-button");
|
||||
// setIDSafe(quickmenu, 6, "followed-button");
|
||||
// setIDSafe(quickmenu, 7, "friends-button");
|
||||
// }
|
||||
// if (auto filtersmenu = getChildOfType<CCMenu>(this, 3)) {
|
||||
// filtersmenu->setID("difficulty-filter-menu");
|
||||
// setIDSafe(filtersmenu, 0, "na-filter-button");
|
||||
// setIDSafe(filtersmenu, 1, "easy-filter-button");
|
||||
// setIDSafe(filtersmenu, 2, "normal-filter-button");
|
||||
// setIDSafe(filtersmenu, 3, "hard-filter-button");
|
||||
// setIDSafe(filtersmenu, 4, "harder-filter-button");
|
||||
// setIDSafe(filtersmenu, 5, "insane-filter-button");
|
||||
// setIDSafe(filtersmenu, 6, "demon-filter-button");
|
||||
// setIDSafe(filtersmenu, 7, "auto-filter-button");
|
||||
// setIDSafe(filtersmenu, 8, "demon-type-filter-button");
|
||||
// }
|
||||
// if (auto filtersmenu = getChildOfType<CCMenu>(this, 4)) {
|
||||
// filtersmenu->setID("length-filter-menu");
|
||||
// setIDSafe(filtersmenu, 0, "clock-icon");
|
||||
// setIDSafe(filtersmenu, 1, "tiny-filter-button");
|
||||
// setIDSafe(filtersmenu, 2, "short-filter-button");
|
||||
// setIDSafe(filtersmenu, 3, "medium-filter-button");
|
||||
// setIDSafe(filtersmenu, 4, "long-filter-button");
|
||||
// setIDSafe(filtersmenu, 5, "xl-filter-button");
|
||||
// setIDSafe(filtersmenu, 6, "star-filter-button");
|
||||
// }
|
||||
// if (auto backmenu = getChildOfType<CCMenu>(this, 5)) {
|
||||
// backmenu->setID("exit-menu");
|
||||
// setIDSafe(backmenu, 0, "exit-button");
|
||||
// }
|
||||
// }
|
||||
|
||||
struct LevelSearchLayerIDs : Modify<LevelSearchLayerIDs, LevelSearchLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("LevelSearchLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set LevelSearchLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
// struct LevelSearchLayerIDs : Modify<LevelSearchLayerIDs, LevelSearchLayer> {
|
||||
// static void onModify(auto& self) {
|
||||
// if (!self.setHookPriority("LevelSearchLayer::init", GEODE_ID_PRIORITY)) {
|
||||
// log::warn("Failed to set LevelSearchLayer::init hook priority, node IDs may not work properly");
|
||||
// }
|
||||
// }
|
||||
|
||||
bool init() {
|
||||
if (!LevelSearchLayer::init()) return false;
|
||||
// bool init() {
|
||||
// if (!LevelSearchLayer::init()) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
// NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
|
|
|
@ -6,211 +6,211 @@
|
|||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(LevelSettingsLayer) {
|
||||
bool startPos = m_mainLayer->getChildrenCount() < 10;
|
||||
// $register_ids(LevelSettingsLayer) {
|
||||
// bool startPos = m_mainLayer->getChildrenCount() < 10;
|
||||
|
||||
if (startPos) {
|
||||
setIDSafe(m_mainLayer, 0, "back-button");
|
||||
}
|
||||
// if (startPos) {
|
||||
// setIDSafe(m_mainLayer, 0, "back-button");
|
||||
// }
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(m_mainLayer, 0)) {
|
||||
menu->setID("song-select-menu");
|
||||
// if (auto menu = getChildOfType<CCMenu>(m_mainLayer, 0)) {
|
||||
// menu->setID("song-select-menu");
|
||||
|
||||
if (startPos) {
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"cube-button",
|
||||
"ship-button",
|
||||
"ball-button",
|
||||
"ufo-button",
|
||||
"wave-button",
|
||||
"robot-button",
|
||||
"spider-button",
|
||||
"mini-toggle",
|
||||
"dual-toggle",
|
||||
"ok-button",
|
||||
"flip-gravity-toggle",
|
||||
"half-speed-button",
|
||||
"normal-speed-button",
|
||||
"2x-speed-button",
|
||||
"3x-speed-button",
|
||||
"4x-speed-button"
|
||||
);
|
||||
}
|
||||
else {
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"bg-color-button",
|
||||
"g-color-button",
|
||||
"g2-color-button",
|
||||
"line-color-button",
|
||||
"obj-color-button",
|
||||
"more-color-button",
|
||||
"3dl-color-button",
|
||||
"bg-quick-edit-button",
|
||||
"g-quick-edit-button",
|
||||
"g2-quick-edit-button",
|
||||
"line-quick-edit-button",
|
||||
"cube-button",
|
||||
"ship-button",
|
||||
"ball-button",
|
||||
"ufo-button",
|
||||
"wave-button",
|
||||
"robot-button",
|
||||
"spider-button",
|
||||
"background-select-button",
|
||||
"ground-select-button",
|
||||
"mini-toggle",
|
||||
"dual-toggle",
|
||||
"font-button",
|
||||
"ok-button",
|
||||
"2-player-toggle",
|
||||
"2-player-help-button",
|
||||
"prev-song-button",
|
||||
"next-song-button",
|
||||
"normal-song-button",
|
||||
"custom-song-button",
|
||||
"select-custom-song-button",
|
||||
"new-song-button",
|
||||
"half-speed-button",
|
||||
"normal-speed-button",
|
||||
"2x-speed-button",
|
||||
"3x-speed-button",
|
||||
"4x-speed-button"
|
||||
);
|
||||
}
|
||||
// if (startPos) {
|
||||
// setIDs(
|
||||
// menu,
|
||||
// 0,
|
||||
// "cube-button",
|
||||
// "ship-button",
|
||||
// "ball-button",
|
||||
// "ufo-button",
|
||||
// "wave-button",
|
||||
// "robot-button",
|
||||
// "spider-button",
|
||||
// "mini-toggle",
|
||||
// "dual-toggle",
|
||||
// "ok-button",
|
||||
// "flip-gravity-toggle",
|
||||
// "half-speed-button",
|
||||
// "normal-speed-button",
|
||||
// "2x-speed-button",
|
||||
// "3x-speed-button",
|
||||
// "4x-speed-button"
|
||||
// );
|
||||
// }
|
||||
// else {
|
||||
// setIDs(
|
||||
// menu,
|
||||
// 0,
|
||||
// "bg-color-button",
|
||||
// "g-color-button",
|
||||
// "g2-color-button",
|
||||
// "line-color-button",
|
||||
// "obj-color-button",
|
||||
// "more-color-button",
|
||||
// "3dl-color-button",
|
||||
// "bg-quick-edit-button",
|
||||
// "g-quick-edit-button",
|
||||
// "g2-quick-edit-button",
|
||||
// "line-quick-edit-button",
|
||||
// "cube-button",
|
||||
// "ship-button",
|
||||
// "ball-button",
|
||||
// "ufo-button",
|
||||
// "wave-button",
|
||||
// "robot-button",
|
||||
// "spider-button",
|
||||
// "background-select-button",
|
||||
// "ground-select-button",
|
||||
// "mini-toggle",
|
||||
// "dual-toggle",
|
||||
// "font-button",
|
||||
// "ok-button",
|
||||
// "2-player-toggle",
|
||||
// "2-player-help-button",
|
||||
// "prev-song-button",
|
||||
// "next-song-button",
|
||||
// "normal-song-button",
|
||||
// "custom-song-button",
|
||||
// "select-custom-song-button",
|
||||
// "new-song-button",
|
||||
// "half-speed-button",
|
||||
// "normal-speed-button",
|
||||
// "2x-speed-button",
|
||||
// "3x-speed-button",
|
||||
// "4x-speed-button"
|
||||
// );
|
||||
// }
|
||||
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"vehicle-selection-menu",
|
||||
RowLayout::create(),
|
||||
menu->getChildByID("cube-button"),
|
||||
menu->getChildByID("ship-button"),
|
||||
menu->getChildByID("ball-button"),
|
||||
menu->getChildByID("ufo-button"),
|
||||
menu->getChildByID("wave-button"),
|
||||
menu->getChildByID("robot-button"),
|
||||
menu->getChildByID("spider-button")
|
||||
);
|
||||
// detachAndCreateMenu(
|
||||
// this,
|
||||
// "vehicle-selection-menu",
|
||||
// RowLayout::create(),
|
||||
// menu->getChildByID("cube-button"),
|
||||
// menu->getChildByID("ship-button"),
|
||||
// menu->getChildByID("ball-button"),
|
||||
// menu->getChildByID("ufo-button"),
|
||||
// menu->getChildByID("wave-button"),
|
||||
// menu->getChildByID("robot-button"),
|
||||
// menu->getChildByID("spider-button")
|
||||
// );
|
||||
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"right-toggle-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("mini-toggle"),
|
||||
menu->getChildByID("dual-toggle")
|
||||
);
|
||||
// detachAndCreateMenu(
|
||||
// this,
|
||||
// "right-toggle-menu",
|
||||
// ColumnLayout::create(),
|
||||
// menu->getChildByID("mini-toggle"),
|
||||
// menu->getChildByID("dual-toggle")
|
||||
// );
|
||||
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"speed-selection-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("half-speed-button"),
|
||||
menu->getChildByID("normal-song-button"),
|
||||
menu->getChildByID("2x-speed-button"),
|
||||
menu->getChildByID("3x-speed-button"),
|
||||
menu->getChildByID("4x-speed-button")
|
||||
);
|
||||
// detachAndCreateMenu(
|
||||
// this,
|
||||
// "speed-selection-menu",
|
||||
// ColumnLayout::create(),
|
||||
// menu->getChildByID("half-speed-button"),
|
||||
// menu->getChildByID("normal-song-button"),
|
||||
// menu->getChildByID("2x-speed-button"),
|
||||
// menu->getChildByID("3x-speed-button"),
|
||||
// menu->getChildByID("4x-speed-button")
|
||||
// );
|
||||
|
||||
if (startPos) {
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"flip-gravity-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("flip-gravity-toggle")
|
||||
);
|
||||
}
|
||||
else {
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"color-button-menu",
|
||||
RowLayout::create(),
|
||||
menu->getChildByID("bg-color-button"),
|
||||
menu->getChildByID("g-color-button"),
|
||||
menu->getChildByID("g2-color-button"),
|
||||
menu->getChildByID("line-color-button"),
|
||||
menu->getChildByID("obj-color-button"),
|
||||
menu->getChildByID("3dl-color-button"),
|
||||
menu->getChildByID("more-color-button")
|
||||
);
|
||||
// if (startPos) {
|
||||
// detachAndCreateMenu(
|
||||
// this,
|
||||
// "flip-gravity-menu",
|
||||
// ColumnLayout::create(),
|
||||
// menu->getChildByID("flip-gravity-toggle")
|
||||
// );
|
||||
// }
|
||||
// else {
|
||||
// detachAndCreateMenu(
|
||||
// this,
|
||||
// "color-button-menu",
|
||||
// RowLayout::create(),
|
||||
// menu->getChildByID("bg-color-button"),
|
||||
// menu->getChildByID("g-color-button"),
|
||||
// menu->getChildByID("g2-color-button"),
|
||||
// menu->getChildByID("line-color-button"),
|
||||
// menu->getChildByID("obj-color-button"),
|
||||
// menu->getChildByID("3dl-color-button"),
|
||||
// menu->getChildByID("more-color-button")
|
||||
// );
|
||||
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"color-quick-edit-menu",
|
||||
RowLayout::create(),
|
||||
menu->getChildByID("bg-quick-edit-button"),
|
||||
menu->getChildByID("g-quick-edit-button"),
|
||||
menu->getChildByID("g2-quick-edit-button"),
|
||||
menu->getChildByID("line-quick-edit-button")
|
||||
);
|
||||
// detachAndCreateMenu(
|
||||
// this,
|
||||
// "color-quick-edit-menu",
|
||||
// RowLayout::create(),
|
||||
// menu->getChildByID("bg-quick-edit-button"),
|
||||
// menu->getChildByID("g-quick-edit-button"),
|
||||
// menu->getChildByID("g2-quick-edit-button"),
|
||||
// menu->getChildByID("line-quick-edit-button")
|
||||
// );
|
||||
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"scenery-selection-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("background-select-button"),
|
||||
menu->getChildByID("ground-select-button")
|
||||
);
|
||||
// detachAndCreateMenu(
|
||||
// this,
|
||||
// "scenery-selection-menu",
|
||||
// ColumnLayout::create(),
|
||||
// menu->getChildByID("background-select-button"),
|
||||
// menu->getChildByID("ground-select-button")
|
||||
// );
|
||||
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"2-player-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("2-player-help-button"),
|
||||
menu->getChildByID("2-player-toggle")
|
||||
);
|
||||
// detachAndCreateMenu(
|
||||
// this,
|
||||
// "2-player-menu",
|
||||
// ColumnLayout::create(),
|
||||
// menu->getChildByID("2-player-help-button"),
|
||||
// menu->getChildByID("2-player-toggle")
|
||||
// );
|
||||
|
||||
auto fontButtonMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"font-button-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
menu->getChildByID("font-button")
|
||||
);
|
||||
fontButtonMenu->setPositionY(fontButtonMenu->getPositionY() - 100.f / 2);
|
||||
fontButtonMenu->setContentSize({ 50.f, 100.f });
|
||||
}
|
||||
}
|
||||
// auto fontButtonMenu = detachAndCreateMenu(
|
||||
// this,
|
||||
// "font-button-menu",
|
||||
// RowLayout::create()
|
||||
// ->setAxisAlignment(AxisAlignment::End),
|
||||
// menu->getChildByID("font-button")
|
||||
// );
|
||||
// fontButtonMenu->setPositionY(fontButtonMenu->getPositionY() - 100.f / 2);
|
||||
// fontButtonMenu->setContentSize({ 50.f, 100.f });
|
||||
// }
|
||||
// }
|
||||
|
||||
setIDs(
|
||||
m_mainLayer,
|
||||
2,
|
||||
"select-color-label",
|
||||
"bg-color-label",
|
||||
"g-color-label",
|
||||
"g2-color-label",
|
||||
"3dl-color-label",
|
||||
"line-color-label",
|
||||
"obj-color-label",
|
||||
"more-color-label",
|
||||
"select-mode-label",
|
||||
"bg-selection-label",
|
||||
"g-selection-label",
|
||||
"mini-label",
|
||||
"dual-label",
|
||||
"2-player-label-1",
|
||||
"2-player-label-2",
|
||||
"select-song-label",
|
||||
"default-song-label",
|
||||
"custom-song-widget",
|
||||
"speed-label"
|
||||
);
|
||||
}
|
||||
// setIDs(
|
||||
// m_mainLayer,
|
||||
// 2,
|
||||
// "select-color-label",
|
||||
// "bg-color-label",
|
||||
// "g-color-label",
|
||||
// "g2-color-label",
|
||||
// "3dl-color-label",
|
||||
// "line-color-label",
|
||||
// "obj-color-label",
|
||||
// "more-color-label",
|
||||
// "select-mode-label",
|
||||
// "bg-selection-label",
|
||||
// "g-selection-label",
|
||||
// "mini-label",
|
||||
// "dual-label",
|
||||
// "2-player-label-1",
|
||||
// "2-player-label-2",
|
||||
// "select-song-label",
|
||||
// "default-song-label",
|
||||
// "custom-song-widget",
|
||||
// "speed-label"
|
||||
// );
|
||||
// }
|
||||
|
||||
struct LevelSettingsLayerIDs : Modify<LevelSettingsLayerIDs, LevelSettingsLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("LevelSettingsLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set LevelSettingsLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
// struct LevelSettingsLayerIDs : Modify<LevelSettingsLayerIDs, LevelSettingsLayer> {
|
||||
// static void onModify(auto& self) {
|
||||
// if (!self.setHookPriority("LevelSettingsLayer::init", GEODE_ID_PRIORITY)) {
|
||||
// log::warn("Failed to set LevelSettingsLayer::init hook priority, node IDs may not work properly");
|
||||
// }
|
||||
// }
|
||||
|
||||
bool init(LevelSettingsObject* levelSettings, LevelEditorLayer* editor) {
|
||||
if (!LevelSettingsLayer::init(levelSettings, editor)) return false;
|
||||
// bool init(LevelSettingsObject* levelSettings, LevelEditorLayer* editor) {
|
||||
// if (!LevelSettingsLayer::init(levelSettings, editor)) return false;
|
||||
|
||||
// NodeIDs::get()->provide(this);
|
||||
// // NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
|
|
|
@ -6,68 +6,68 @@
|
|||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(PauseLayer) {
|
||||
setIDs(
|
||||
this,
|
||||
0,
|
||||
"background",
|
||||
"level-name",
|
||||
// $register_ids(PauseLayer) {
|
||||
// setIDs(
|
||||
// this,
|
||||
// 0,
|
||||
// "background",
|
||||
// "level-name",
|
||||
|
||||
"normal-progress-bar",
|
||||
"practice-progress-bar",
|
||||
"normal-progress-label",
|
||||
"practice-progress-label",
|
||||
"normal-mode-label",
|
||||
"practice-mode-label",
|
||||
// "normal-progress-bar",
|
||||
// "practice-progress-bar",
|
||||
// "normal-progress-label",
|
||||
// "practice-progress-label",
|
||||
// "normal-mode-label",
|
||||
// "practice-mode-label",
|
||||
|
||||
"center-button-menu",
|
||||
// "center-button-menu",
|
||||
|
||||
"auto-retry-label",
|
||||
"auto-checkpoints-label",
|
||||
"show-progress-bar-label"
|
||||
);
|
||||
// "auto-retry-label",
|
||||
// "auto-checkpoints-label",
|
||||
// "show-progress-bar-label"
|
||||
// );
|
||||
|
||||
if (auto menu = this->getChildByID("center-button-menu")) {
|
||||
int start_idx = 0;
|
||||
// if (auto menu = this->getChildByID("center-button-menu")) {
|
||||
// int start_idx = 0;
|
||||
|
||||
if (menu->getChildrenCount() == 5) {
|
||||
setIDSafe(menu, 0, "edit-button");
|
||||
start_idx = 1;
|
||||
}
|
||||
// if (menu->getChildrenCount() == 5) {
|
||||
// setIDSafe(menu, 0, "edit-button");
|
||||
// start_idx = 1;
|
||||
// }
|
||||
|
||||
setIDs(menu, start_idx, "practice-button", "play-button", "exit-button");
|
||||
// setIDs(menu, start_idx, "practice-button", "play-button", "exit-button");
|
||||
|
||||
if (menu->getChildrenCount() == 4) setIDSafe(menu, start_idx + 3, "retry-button");
|
||||
}
|
||||
// if (menu->getChildrenCount() == 4) setIDSafe(menu, start_idx + 3, "retry-button");
|
||||
// }
|
||||
|
||||
// Record toggle on mobile
|
||||
if (auto label = typeinfo_cast<CCLabelBMFont*>(getChild(this, 12))) {
|
||||
setIDSafe(this, 12, "record-label");
|
||||
}
|
||||
// // Record toggle on mobile
|
||||
// if (auto label = typeinfo_cast<CCLabelBMFont*>(getChild(this, 12))) {
|
||||
// setIDSafe(this, 12, "record-label");
|
||||
// }
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("toggle-menu");
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
// menu->setID("toggle-menu");
|
||||
|
||||
setIDs(menu, 0, "auto-retry-toggle", "auto-checkpoints-toggle", "show-progress-bar-toggle");
|
||||
// setIDs(menu, 0, "auto-retry-toggle", "auto-checkpoints-toggle", "show-progress-bar-toggle");
|
||||
|
||||
if (menu->getChildrenCount() == 4) setIDSafe(menu, 3, "record-toggle");
|
||||
}
|
||||
// if (menu->getChildrenCount() == 4) setIDSafe(menu, 3, "record-toggle");
|
||||
// }
|
||||
|
||||
setIDs(
|
||||
this, this->getChildrenCount() - 4, "music-slider", "sfx-slider", "music-label", "sfx-label"
|
||||
);
|
||||
}
|
||||
// setIDs(
|
||||
// this, this->getChildrenCount() - 4, "music-slider", "sfx-slider", "music-label", "sfx-label"
|
||||
// );
|
||||
// }
|
||||
|
||||
struct PauseLayerIDs : Modify<PauseLayerIDs, PauseLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("PauseLayer::customSetup", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set PauseLayer::customSetup hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
// struct PauseLayerIDs : Modify<PauseLayerIDs, PauseLayer> {
|
||||
// static void onModify(auto& self) {
|
||||
// if (!self.setHookPriority("PauseLayer::customSetup", GEODE_ID_PRIORITY)) {
|
||||
// log::warn("Failed to set PauseLayer::customSetup hook priority, node IDs may not work properly");
|
||||
// }
|
||||
// }
|
||||
|
||||
void customSetup() {
|
||||
PauseLayer::customSetup();
|
||||
// void customSetup() {
|
||||
// PauseLayer::customSetup();
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
}
|
||||
};
|
||||
// NodeIDs::get()->provide(this);
|
||||
// }
|
||||
// };
|
||||
|
|
|
@ -6,32 +6,32 @@
|
|||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(UILayer) {
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("pause-button-menu");
|
||||
// $register_ids(UILayer) {
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
// menu->setID("pause-button-menu");
|
||||
|
||||
setIDs(menu, 0, "pause-button");
|
||||
}
|
||||
// setIDs(menu, 0, "pause-button");
|
||||
// }
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("checkpoint-menu");
|
||||
// if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
// menu->setID("checkpoint-menu");
|
||||
|
||||
setIDs(menu, 0, "add-checkpoint-button", "remove-checkpoint-button");
|
||||
}
|
||||
}
|
||||
// setIDs(menu, 0, "add-checkpoint-button", "remove-checkpoint-button");
|
||||
// }
|
||||
// }
|
||||
|
||||
struct UILayerIDs : Modify<UILayerIDs, UILayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("UILayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set UILayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
// struct UILayerIDs : Modify<UILayerIDs, UILayer> {
|
||||
// static void onModify(auto& self) {
|
||||
// if (!self.setHookPriority("UILayer::init", GEODE_ID_PRIORITY)) {
|
||||
// log::warn("Failed to set UILayer::init hook priority, node IDs may not work properly");
|
||||
// }
|
||||
// }
|
||||
|
||||
bool init() {
|
||||
if (!UILayer::init()) return false;
|
||||
// bool init() {
|
||||
// if (!UILayer::init()) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
// NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
|
|
|
@ -2,9 +2,12 @@
|
|||
|
||||
#ifdef GEODE_IS_ANDROID
|
||||
|
||||
// 2.2 addition
|
||||
// zmx please fix this
|
||||
|
||||
namespace geode::base {
|
||||
uintptr_t get() {
|
||||
static uintptr_t base = (reinterpret_cast<uintptr_t>(&UILayer::create) - 0x20f168) & (~0x1);
|
||||
static uintptr_t base = (reinterpret_cast<uintptr_t>(&MenuLayer::onQuit) - 0x2f9500) & (~0x1);
|
||||
// static uintptr_t base = reinterpret_cast<uintptr_t>(dlopen("libcocos2dcpp.so", RTLD_NOW));
|
||||
return base;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue