Add: HistoryText
Fix: ranking.js, result.js
This commit is contained in:
@@ -1,4 +1,17 @@
|
||||
function RankingBoard(type) {
|
||||
// ranking text
|
||||
var playingAppID = sessionStorageManager.getPlayingAppID();
|
||||
var rankingTextOffsetY = game.world.height / 2 + 105;
|
||||
this.rankingHourTexts = new Array();
|
||||
this.rankingDayTexts = new Array();
|
||||
this.rankingMonthTexts = new Array();
|
||||
for(var i = 0; i < RankingBoard.RANK_COUNT; i++) {
|
||||
var posY = rankingTextOffsetY + (i % 10) * 30;
|
||||
this.rankingHourTexts[i] = new RankingText(RankingText.PLACE_FOR_RESULT, 290, posY, playingAppID);
|
||||
this.rankingDayTexts[i] = new RankingText(RankingText.PLACE_FOR_RESULT, 530, posY, playingAppID);
|
||||
this.rankingMonthTexts[i] = new RankingText(RankingText.PLACE_FOR_RESULT, 770, posY, playingAppID);
|
||||
}
|
||||
|
||||
if(type === RecordBoard.TYPE_SAMPLE) {
|
||||
this.printSample();
|
||||
return;
|
||||
@@ -23,8 +36,12 @@ RankingBoard.prototype.requestRanking = function(type) {
|
||||
var today = new Date();
|
||||
var date = DateUtil.getYYYYMMDD(today);
|
||||
var time = DateUtil.getHHMMSS(today);
|
||||
|
||||
this.dbConnectManager.requestRanking(
|
||||
type, sessionStorageManager.getMaestroID(), date, time,
|
||||
type,
|
||||
sessionStorageManager.getMaestroID(),
|
||||
date,
|
||||
time,
|
||||
(function(type, rankingRecordManager) {
|
||||
if(rankingRecordManager.getCount() == 0) {
|
||||
console.log("ranking board - no data");
|
||||
@@ -123,27 +140,22 @@ RankingBoard.prototype.getEndIndex = function(rankingRecordManager) {
|
||||
|
||||
|
||||
RankingBoard.prototype.printRecord = function(type, index, data) {
|
||||
var style = { font: "20px Arial", fill: "#fff", align: "right", boundsAlignH: "right", boundsAlignV: "top" };
|
||||
var targetText = null;
|
||||
switch(type) {
|
||||
case DBConnectManager.TYPE_MY_RANKING_HOUR:
|
||||
targetText = this.rankingHourTexts;
|
||||
break;
|
||||
|
||||
// rank
|
||||
// style.boundsAlignH = "right";
|
||||
var rankText = game.add.text(this.getPosX(type), this.getPosY(index), data.rank, style);
|
||||
rankText.anchor.set(1, 0);
|
||||
rankText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
case DBConnectManager.TYPE_MY_RANKING_DAY:
|
||||
targetText = this.rankingDayTexts;
|
||||
break;
|
||||
|
||||
// player name
|
||||
var playerNameText = game.add.text(this.getPosX(type) + 20, this.getPosY(index), data.playerName, style);
|
||||
playerNameText.anchor.set(0, 0);
|
||||
playerNameText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
case DBConnectManager.TYPE_MY_RANKING_MONTH:
|
||||
targetText = this.rankingMonthTexts;
|
||||
break;
|
||||
}
|
||||
|
||||
// bestRecord
|
||||
var recordText = game.add.text(
|
||||
this.getPosX(type) + 180, this.getPosY(index),
|
||||
RecordUtil.getRecordValueWithUnit(data.bestRecord, sessionStorageManager.getPlayingAppID()),
|
||||
style
|
||||
);
|
||||
recordText.anchor.set(1, 0);
|
||||
recordText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
targetText[index].setContents(data.playerID, data.rank, data.playerName, data.bestRecord);
|
||||
}
|
||||
|
||||
RankingBoard.prototype.getPosX = function(type) {
|
||||
@@ -263,4 +275,6 @@ RankingBoard.prototype.showMedal = function(medal, myRank) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
RankingBoard.RANK_COUNT = 7;
|
||||
Reference in New Issue
Block a user