From a94b2b70d34514eb5d0d6573a8233a10f53e978e Mon Sep 17 00:00:00 2001 From: FireMario211 <17692105+FireMario211@users.noreply.github.com> Date: Sun, 5 Nov 2023 16:29:07 -0500 Subject: [PATCH] Fix ESC button not working on more leaderboards --- src/MoreLeaderboards.cpp | 16 +++++++++++----- src/MoreLeaderboards.h | 3 ++- src/main.cpp | 24 ------------------------ 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/src/MoreLeaderboards.cpp b/src/MoreLeaderboards.cpp index 062d7d5..cca1f9b 100644 --- a/src/MoreLeaderboards.cpp +++ b/src/MoreLeaderboards.cpp @@ -109,19 +109,19 @@ bool MoreLeaderboards::init(std::string type) { m_diamondsTabBtn = TabButton::create("Diamonds", this, menu_selector(MoreLeaderboards::onTab)); m_diamondsTabBtn->setPosition(-95.f, 132.5f); m_diamondsTabBtn->setTag(static_cast(StatsListType::Diamonds)); - m_diamondsTabBtn->setZOrder(2); + m_diamondsTabBtn->setZOrder(30); m_menu->addChild(m_diamondsTabBtn); m_usercoinsTabBtn = TabButton::create("User Coins", this, menu_selector(MoreLeaderboards::onTab)); m_usercoinsTabBtn->setPosition(0.f, 132.5f); m_usercoinsTabBtn->setTag(static_cast(StatsListType::UserCoins)); - m_usercoinsTabBtn->setZOrder(2); + m_usercoinsTabBtn->setZOrder(30); m_menu->addChild(m_usercoinsTabBtn); m_demonsTabBtn = TabButton::create("Demons", this, menu_selector(MoreLeaderboards::onTab)); m_demonsTabBtn->setPosition(95.f, 132.5f); m_demonsTabBtn->setTag(static_cast(StatsListType::Demons)); - m_demonsTabBtn->setZOrder(2); + m_demonsTabBtn->setZOrder(30); m_menu->addChild(m_demonsTabBtn); // tabs gradient @@ -155,7 +155,8 @@ bool MoreLeaderboards::init(std::string type) { startLoadingMods(); loadPageMods(); } - + setTouchEnabled(true); + setKeypadEnabled(true); return true; } @@ -163,6 +164,10 @@ void MoreLeaderboards::backButton(cocos2d::CCObject*) { cocos2d::CCDirector::sharedDirector()->popSceneWithTransition(0.5F, cocos2d::PopTransition::kPopTransitionFade); }; +void MoreLeaderboards::keyBackClicked() { + backButton(CCNode::create()); +} + void MoreLeaderboards::fadeLoadingCircle() { loading_circle->fadeAndRemove(); }; @@ -286,6 +291,7 @@ void MoreLeaderboards::loadPageMore() { leaderboardViewScore = CustomListView::create(displayedData, 220.f, 356.f, 0, BoomListType::Score); listLayer = GJListLayer::create(leaderboardViewScore, nullptr, {191, 114, 62, 255}, 356.f, 220.f); + listLayer->setZOrder(31); listLayer->setPosition(winSize / 2 - listLayer->getScaledContentSize() / 2 - CCPoint(0,5)); addChild(listLayer); @@ -332,4 +338,4 @@ void MoreLeaderboards::onTab(CCObject* pSender) { startLoadingMore(); loadPageMore(); } -} \ No newline at end of file +} diff --git a/src/MoreLeaderboards.h b/src/MoreLeaderboards.h index 6fd4e3e..caf4def 100644 --- a/src/MoreLeaderboards.h +++ b/src/MoreLeaderboards.h @@ -34,6 +34,7 @@ class MoreLeaderboards : public CCLayer { protected: virtual bool init(std::string type); + virtual void keyBackClicked(); void startLoadingMods(); void loadPageMods(); void startLoadingMore(); @@ -53,4 +54,4 @@ class MoreLeaderboards : public CCLayer { static CCDictionary* responseToDict(const std::string& response); void backButton(CCObject*); -}; \ No newline at end of file +}; diff --git a/src/main.cpp b/src/main.cpp index b81aa1b..6eed7af 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -112,30 +112,6 @@ void start_socket_func() { } } - /* - sio::message::ptr data = sio::object_message::create(); - log::info("Starting socket..."); - sio::client sock; - sock.set_reconnect_delay(reconnectionDelay); - sock.set_reconnect_delay_max(reconnectionDelayMax); - sock.set_reconnect_attempts(reconnectionAttempts); - sock.set_open_listener(&ConnectionHandler::onSuccess); - sock.set_close_listener(&ConnectionHandler::onClose); - sock.set_fail_listener(&ConnectionHandler::onFail); - sock.connect("http://gdutils.clarifygdps.com"); - if (!connect_finish) { - cond.wait(unique_lock); - } - sock.socket()->on_error(ConnectionHandler::onError); - setSocket(sock.socket()); - while (true) { - std::this_thread::sleep_for(std::chrono::seconds(1)); - if (!still_connected) { - log::info("not connected, restarting..."); - start_socket_func(); - break; - } - }*/ } std::string currentLayer = "";