Skip to content

Commit

Permalink
add loading circle to view leaderboard as
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Sep 9, 2023
1 parent 8deee3e commit 3260dbf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/layers/LeaderboardViewLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ bool LeaderboardViewLayer::init(int accountID) {
cornerBR->setRotation(270);
addChild(cornerBR, -1);

m_circle = LoadingCircle::create();
m_circle->retain();
m_circle->setParentLayer(this);
m_circle->show();

loadPage();
BetterInfoOnline::sharedState()->loadScores(m_accountID, false, this);

Expand All @@ -94,8 +99,12 @@ void LeaderboardViewLayer::keyBackClicked() {

setTouchEnabled(false);
setKeypadEnabled(false);

if(m_scores) m_scores->release();
if(m_circle) m_circle->release();
m_scores = nullptr;
m_circle = nullptr;

CCDirector::sharedDirector()->popSceneWithTransition(0.5f, PopTransition::kPopTransitionFade);
}

Expand All @@ -115,4 +124,5 @@ void LeaderboardViewLayer::onLeaderboardFinished(cocos2d::CCArray* scores) {
m_scores = scores;
m_scores->retain();
loadPage();
if(m_circle) m_circle->fadeAndRemove();
}
1 change: 1 addition & 0 deletions src/layers/LeaderboardViewLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class LeaderboardViewLayer : public cocos2d::CCLayer, public BILeaderboardDelega
LeaderboardListView* m_leaderboardView = nullptr;
GJListLayer* m_listLayer = nullptr;
cocos2d::CCArray* m_scores = nullptr;
LoadingCircle* m_circle = nullptr;
int m_accountID = 0;
protected:
virtual bool init(int accountID);
Expand Down

0 comments on commit 3260dbf

Please sign in to comment.