Add: medals and new high score particle
This commit is contained in:
@@ -9,15 +9,16 @@ class RankingBoard {
|
||||
return;
|
||||
}
|
||||
|
||||
this.dbConnectManager = new DBConnectManager();
|
||||
this.makeMedalSprites();
|
||||
|
||||
this.dbConnectManager = new DBConnectManager();
|
||||
this.requestRanking(DBConnectManager.TYPE_MY_RANKING_HOUR);
|
||||
this.requestRanking(DBConnectManager.TYPE_MY_RANKING_DAY);
|
||||
this.requestRanking(DBConnectManager.TYPE_MY_RANKING_MONTH);
|
||||
}
|
||||
|
||||
|
||||
requestRanking(type, rankingRecordManager) {
|
||||
requestRanking(type) {
|
||||
let today = new Date();
|
||||
let date = DateUtil.getYYYYMMDD(today);
|
||||
let time = DateUtil.getHHMMSS(today);
|
||||
@@ -37,6 +38,21 @@ class RankingBoard {
|
||||
let data = rankingRecordManager.getAt(index);
|
||||
this.printRecord(type, i, data);
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
case DBConnectManager.TYPE_MY_RANKING_HOUR:
|
||||
this.showMedal(this.medalHour, this.getMyRank(rankingRecordManager));
|
||||
break;
|
||||
|
||||
case DBConnectManager.TYPE_MY_RANKING_DAY:
|
||||
this.showMedal(this.medalDay, this.getMyRank(rankingRecordManager));
|
||||
break;
|
||||
|
||||
case DBConnectManager.TYPE_MY_RANKING_MONTH:
|
||||
this.showMedal(this.medalMonth, this.getMyRank(rankingRecordManager));
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -208,4 +224,45 @@ class RankingBoard {
|
||||
new RankingRecord(4, 0, "6-3이철수", 480)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
static loadResources() {
|
||||
game.load.image('medal_gold', '../../../resources/image/ui/medal_gold.png');
|
||||
game.load.image('medal_silver', '../../../resources/image/ui/medal_silver.png');
|
||||
game.load.image('medal_bronze', '../../../resources/image/ui/medal_bronze.png');
|
||||
}
|
||||
|
||||
makeMedalSprites() {
|
||||
let rankAreaPositionY = 630;
|
||||
this.medalHour = game.add.image(425, rankAreaPositionY, 'medal_gold');
|
||||
this.medalHour.anchor.set(0.5);
|
||||
this.medalHour.alpha = 0;
|
||||
|
||||
this.medalDay = game.add.image(655, rankAreaPositionY, 'medal_gold');
|
||||
this.medalDay.anchor.set(0.5);
|
||||
this.medalDay.alpha = 0;
|
||||
|
||||
this.medalMonth = game.add.image(885, rankAreaPositionY, 'medal_gold');
|
||||
this.medalMonth.anchor.set(0.5);
|
||||
this.medalMonth.alpha = 0;
|
||||
}
|
||||
|
||||
showMedal(medal, myRank) {
|
||||
if(myRank > 3) {
|
||||
medal.alpha = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if(myRank == 1)
|
||||
medal.loadTexture("medal_gold");
|
||||
else if(myRank == 2)
|
||||
medal.loadTexture("medal_silver");
|
||||
else if(myRank == 3)
|
||||
medal.loadTexture("medal_bronze");
|
||||
|
||||
medal.alpha = 1;
|
||||
medal.scale.setTo(0.5);
|
||||
game.add.tween(medal.scale).to( {x: 0.7, y: 0.7}, 1000, Phaser.Easing.Bounce.Out, true);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user