add bindings and ids for CustomSongWidget

This commit is contained in:
Fleeym 2023-04-04 09:42:57 +03:00 committed by alk
parent ed8d230733
commit 530551ec95
2 changed files with 41 additions and 0 deletions

View file

@ -939,6 +939,7 @@ class CustomSongLayer : FLAlertLayer, FLAlertLayerProtocol, TextInputDelegate, G
}
class CustomSongWidget : cocos2d::CCNode, MusicDownloadDelegate, FLAlertLayerProtocol {
bool init(SongInfoObject*, LevelSettingsObject*, bool, bool, bool, bool, bool hideBackground) = mac 0x37be20, win 0x685b0;
void FLAlert_Clicked(FLAlertLayer*, bool) {}
void loadSongInfoFinished(SongInfoObject*) {}

View file

@ -0,0 +1,40 @@
#include "AddIDs.hpp"
#include <Geode/Bindings.hpp>
#include <Geode/modify/CustomSongWidget.hpp>
#include <Geode/utils/cocos.hpp>
using namespace geode::prelude;
$register_ids(CustomSongWidget) {
setIDSafe<CCScale9Sprite>(this, 0, "bg");
setIDSafe<CCSprite>(this, 0, "loading-bar");
setIDSafe<CCLabelBMFont>(this, 0, "song-name-label");
setIDSafe<CCLabelBMFont>(this, 1, "author-name-label");
setIDSafe<CCLabelBMFont>(this, 2, "id-and-size-label");
setIDSafe<CCLabelBMFont>(this, 3, "error-label");
setIDSafe<CCMenu>(this, 0, "buttons-menu");
auto customSongWidgetMenu = this->getChildByID("buttons-menu");
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 0, "download-button");
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 1, "cancel-button");
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 2, "use-button");
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 3, "refresh-button");
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 4, "play-song-button");
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 5, "more-button");
};
struct CustomSongWidgetIDs : Modify<CustomSongWidgetIDs, CustomSongWidget> {
static void onModify(auto& self) {
if (!self.setHookPriority("CustomSongWidget::init", GEODE_ID_PRIORITY)) {
log::warn("Failed to set CustomSongWidget::init hook priority, node IDs may not work properly");
}
}
bool init(SongInfoObject* s, LevelSettingsObject* l, bool b1, bool b2, bool b3, bool b4, bool hideBackground) {
if (!CustomSongWidget::init(s, l, b1, b2, b3, b4, hideBackground)) return false;
NodeIDs::get()->provide(this);
return true;
}
};