|
1 | 1 | #include "NewGJCommentList.h" |
| 2 | +#include "Geode/loader/Log.hpp" |
2 | 3 | #include "NewProfilePage.h" |
3 | 4 | #include "../MoreLeaderboards/MoreLeaderboards.h" |
4 | 5 | #include "ccTypes.h" |
@@ -30,6 +31,8 @@ class $modify(CommentCell) { |
30 | 31 |
|
31 | 32 | CCMenu* username_menu = typeinfo_cast<CCMenu*>(cell->getChildByIDRecursive("username-menu")); |
32 | 33 |
|
| 34 | + bool colorSet = false; |
| 35 | + |
33 | 36 | while (data_user.size() > 0) { |
34 | 37 | std::vector<std::string> data = MoreLeaderboards::getWords(data_user[0], "?"); |
35 | 38 |
|
@@ -90,16 +93,22 @@ class $modify(CommentCell) { |
90 | 93 | ); |
91 | 94 |
|
92 | 95 | if (auto commentText = cell->getChildByIDRecursive("comment-text-label")) { |
93 | | - as<CCLabelBMFont*>(commentText)->setColor(color); |
94 | | - cell->m_comment->m_color = color; |
| 96 | + if (color.r != 255 && color.g != 255 && color.b != 255 && !colorSet) { |
| 97 | + as<CCLabelBMFont*>(commentText)->setColor(color); |
| 98 | + cell->m_comment->m_color = color; |
| 99 | + colorSet = true; |
| 100 | + } |
95 | 101 | } |
96 | 102 | if (auto commentText = cell->getChildByIDRecursive("comment-text-area")) { |
97 | 103 | TextArea* textArea = as<TextArea*>(commentText); |
98 | 104 | MultilineBitmapFont* bmFont = as<MultilineBitmapFont*>(textArea->getChildren()->objectAtIndex(0)); |
99 | 105 | CCArray* children = bmFont->getChildren(); |
100 | 106 | for (int i = 0; i < children->count(); i++) { |
101 | 107 | auto child = as<CCLabelBMFont*>(children->objectAtIndex(i)); |
102 | | - child->setColor(color); |
| 108 | + if (color.r != 255 && color.g != 255 && color.b != 255 && !colorSet) { |
| 109 | + child->setColor(color); |
| 110 | + colorSet = true; |
| 111 | + } |
103 | 112 | } |
104 | 113 | } |
105 | 114 |
|
@@ -176,19 +185,20 @@ class $modify(CommentCell) { |
176 | 185 |
|
177 | 186 | if (username_menu != nullptr) username_menu->updateLayout(); |
178 | 187 |
|
179 | | - if (result_global.empty()) { |
180 | | - m_fields->m_listener.bind([] (web::WebTask::Event* e) { |
181 | | - if (web::WebResponse* res = e->getValue()) { |
182 | | - if (res->ok()) { |
183 | | - result_global = res->string().unwrapOrDefault(); |
184 | | - } |
185 | | - } |
186 | | - }); |
| 188 | + const std::function<void(std::string const&)> then = [this, cell](std::string const& result) { |
| 189 | + badgeHandle(result, cell, cell->m_comment->m_commentID); |
| 190 | + }; |
187 | 191 |
|
188 | | - auto req = web::WebRequest(); |
189 | | - m_fields->m_listener.setFilter(req.get("https://clarifygdps.com/gdutils/gdutils_roles.php")); |
190 | | - } |
| 192 | + m_fields->m_listener.bind([then = std::move(then)] (web::WebTask::Event* e) { |
| 193 | + if (web::WebResponse* res = e->getValue()) { |
| 194 | + if (res->ok()) { |
| 195 | + result_global = res->string().unwrapOrDefault(); |
| 196 | + then(result_global); |
| 197 | + } |
| 198 | + } |
| 199 | + }); |
191 | 200 |
|
192 | | - badgeHandle(result_global, cell, cell->m_comment->m_commentID); |
| 201 | + auto req = web::WebRequest(); |
| 202 | + m_fields->m_listener.setFilter(req.get("https://clarifygdps.com/gdutils/gdutils_roles.php")); |
193 | 203 | } |
194 | 204 | }; |
0 commit comments