Skip to content

Commit

Permalink
Fix ESC button not working on more leaderboards
Browse files Browse the repository at this point in the history
  • Loading branch information
FireMario211 committed Nov 5, 2023
1 parent d381dea commit a94b2b7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 30 deletions.
16 changes: 11 additions & 5 deletions src/MoreLeaderboards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(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<int>(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<int>(StatsListType::Demons));
m_demonsTabBtn->setZOrder(2);
m_demonsTabBtn->setZOrder(30);
m_menu->addChild(m_demonsTabBtn);

// tabs gradient
Expand Down Expand Up @@ -155,14 +155,19 @@ bool MoreLeaderboards::init(std::string type) {
startLoadingMods();
loadPageMods();
}

setTouchEnabled(true);
setKeypadEnabled(true);
return true;
}

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();
};
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -332,4 +338,4 @@ void MoreLeaderboards::onTab(CCObject* pSender) {
startLoadingMore();
loadPageMore();
}
}
}
3 changes: 2 additions & 1 deletion src/MoreLeaderboards.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class MoreLeaderboards : public CCLayer {

protected:
virtual bool init(std::string type);
virtual void keyBackClicked();
void startLoadingMods();
void loadPageMods();
void startLoadingMore();
Expand All @@ -53,4 +54,4 @@ class MoreLeaderboards : public CCLayer {
static CCDictionary* responseToDict(const std::string& response);

void backButton(CCObject*);
};
};
24 changes: 0 additions & 24 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down

0 comments on commit a94b2b7

Please sign in to comment.