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