diff --git a/CMakeLists.txt b/CMakeLists.txt index 617c13d..3a833b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,4 +29,4 @@ endif() add_subdirectory($ENV{GEODE_SDK} $ENV{GEODE_SDK}/build) # Set up dependencies, resources, link Geode -setup_geode_mod(${PROJECT_NAME} EXTERNALS geode.node-ids:1.13.1 cvolton.misc_bugfixes:1.1.3) +setup_geode_mod(${PROJECT_NAME} EXTERNALS geode.node-ids:1.14.0 cvolton.misc_bugfixes:1.1.3) diff --git a/mod.json b/mod.json index 166b14e..c908eec 100644 --- a/mod.json +++ b/mod.json @@ -1,5 +1,5 @@ { - "geode": "3.4.0", + "geode": "3.7.1", "version": "v4.2.8", "gd": { "win": "2.206", @@ -21,7 +21,7 @@ "dependencies": [ { "id": "geode.node-ids", - "version": "v1.13.1", + "version": "v1.14.0", "importance": "required" }, { diff --git a/src/hooks/CommentCell.cpp b/src/hooks/CommentCell.cpp index 3fe853c..26d68fc 100644 --- a/src/hooks/CommentCell.cpp +++ b/src/hooks/CommentCell.cpp @@ -93,31 +93,29 @@ class BI_DLL $modify(BICommentCell, CommentCell) { /** * Add username button */ - if(b->m_accountID == 0) if(auto usernameLabel = static_cast(m_mainLayer->getChildByID("username-label"))) { - auto content = std::string_view(usernameLabel->getString()); - if(content == "" || content == "-") { - usernameLabel->setString(fmt::format("- (ID: {})", b->m_userID).c_str()); + if(auto usernameMenu = menu->getChildByIDRecursive("username-menu")) { + if(b->m_accountID == 0) if(auto usernameLabel = typeinfo_cast(usernameMenu->getChildByID("username-button"))) { + auto content = std::string_view(usernameLabel->getString()); + if(content == "" || content == "-") { + usernameLabel->setString(fmt::format("- (ID: {})", b->m_userID).c_str()); + } + + usernameLabel->removeFromParent(); + + auto buttonButton = CCMenuItemSpriteExtra::create( + usernameLabel, + this, + menu_selector(BICommentCell::onProfilePage) + ); + buttonButton->setSizeMult(1.2f); + //buttonButton->setPosition(position + CCPoint(usernameLabel->getScaledContentSize().width / 2, 0)); + buttonButton->setEnabled(true); + buttonButton->setID("username-button"); //using vanilla style node ID because this is a replacement for a vanilla feature + + usernameMenu->addChild(buttonButton); + usernameMenu->updateLayout(); } - - CCPoint position = menu->convertToNodeSpace(m_mainLayer->convertToWorldSpace(usernameLabel->getPosition())); - usernameLabel->removeFromParent(); - - - auto buttonButton = CCMenuItemSpriteExtra::create( - usernameLabel, - this, - menu_selector(BICommentCell::onProfilePage) - ); - buttonButton->setSizeMult(1.2f); - buttonButton->setPosition(position + CCPoint(usernameLabel->getScaledContentSize().width / 2, 0)); - buttonButton->setEnabled(true); - buttonButton->setID("username-button"); //using vanilla style node ID because this is a replacement for a vanilla feature - - menu->addChild(buttonButton); } - - } - } }; \ No newline at end of file