Add: setFirstPageIndex, setBgColor

This commit is contained in:
2019-06-06 10:36:01 +09:00
parent cf7e547eb4
commit 3ab72a05c4
2 changed files with 42 additions and 4 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

+42 -4
View File
@@ -2,6 +2,7 @@ var Ranking = {
preload: function() { preload: function() {
game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png'); game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png');
game.load.image('bg_white', '../../../resources/image/ui/white_rect.png');
}, },
create: function() { create: function() {
@@ -21,11 +22,19 @@ var Ranking = {
// bg // bg
this.game.stage.backgroundColor = '#4d4d4d'; this.game.stage.backgroundColor = '#4d4d4d';
// this.bgWhite = game.add.sprite(0, 0, "bg_white");
// this.bgWhite.width = GAME_SCREEN_SIZE.x;
// this.bgWhite.height = GAME_SCREEN_SIZE.y;
// this.setBgColor();
var posY = 100; var posY = 100;
var bg = game.add.graphics(); // var bg = game.add.graphics();
bg.beginFill(0x545454, 1); // bg.beginFill(0x545454, 0.8);
bg.drawRect(0, 60, GAME_SCREEN_SIZE.x, 80); // bg.drawRect(0, 60, GAME_SCREEN_SIZE.x, 80);
this.bgWhite = game.add.sprite(0, 60, "bg_white");
this.bgWhite.width = GAME_SCREEN_SIZE.x;
this.bgWhite.height = 80;
this.setBgColor();
// keyboard shortcut // keyboard shortcut
@@ -283,20 +292,29 @@ var Ranking = {
this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 수업시간 순위"; this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 수업시간 순위";
this.textTitle.addColor("#ff6666", 0); this.textTitle.addColor("#ff6666", 0);
this.getRecordToRankingServer(); this.getRecordToRankingServer();
this.setFirstPageIndex();
this.setBgColor();
}, },
showRankingDay: function() { showRankingDay: function() {
this.timeType = Ranking.MODE_DAY; this.timeType = Ranking.MODE_DAY;
this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 오늘의 순위"; this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 오늘의 순위";
this.textTitle.addColor("#9999ff", 0); this.textTitle.addColor("#9999ff", 0);
this.getRecordToRankingServer(); this.getRecordToRankingServer();
this.setFirstPageIndex();
this.setBgColor();
}, },
showRankingMonth: function() { showRankingMonth: function() {
this.timeType = Ranking.MODE_MONTH; this.timeType = Ranking.MODE_MONTH;
this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 이달의 순위"; this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 이달의 순위";
this.textTitle.addColor("#99ff99", 0); this.textTitle.addColor("#99ff99", 0);
this.getRecordToRankingServer(); this.getRecordToRankingServer();
this.setFirstPageIndex();
this.setBgColor();
}, },
showRanking: function(rankingRecordManager) { showRanking: function(rankingRecordManager) {
@@ -344,7 +362,7 @@ var Ranking = {
// timezone changed (ex: 2pm -> 3pm) // timezone changed (ex: 2pm -> 3pm)
if(this.showingPageIndex * 20 > this.recordArray.length) if(this.showingPageIndex * 20 > this.recordArray.length)
this.showingPageIndex = 0; this.setFirstPageIndex();
// prepare ranking list - top10 / top20 // prepare ranking list - top10 / top20
for(var i = 0; i < 10; i++) { for(var i = 0; i < 10; i++) {
@@ -501,6 +519,26 @@ var Ranking = {
this.showingPageIndex++; this.showingPageIndex++;
this.printRanking(); this.printRanking();
}, },
setFirstPageIndex: function() {
this.showingPageIndex = 0;
},
setBgColor: function() {
switch(this.timeType) {
case Ranking.MODE_HOUR:
this.bgWhite.tint = 0x5f4d4d;
break;
case Ranking.MODE_DAY:
this.bgWhite.tint = 0x4d4d5f;
break;
case Ranking.MODE_MONTH:
this.bgWhite.tint = 0x4d5f4d;
break;
}
},
} }
Ranking.MODE_HOUR = "mode_hour"; Ranking.MODE_HOUR = "mode_hour";