Add: HistoryText
Fix: ranking.js, result.js
This commit is contained in:
@@ -4,17 +4,18 @@ function HistoryBoard(dataType) {
|
||||
return;
|
||||
}
|
||||
|
||||
var rankingTextOffsetY = game.world.height / 2 + 105;
|
||||
this.historyTexts = new Array();
|
||||
for(var i = 0; i < RankingBoard.RANK_COUNT; i++) {
|
||||
var posY = rankingTextOffsetY + (i % 10) * 30;
|
||||
this.historyTexts[i] = new HistoryText(80, posY);
|
||||
}
|
||||
|
||||
|
||||
this.todayBestRecord = 0;
|
||||
|
||||
this.dbConnectManager = new DBConnectManager();
|
||||
|
||||
var arrayTabStyle = { font: "20px Arial", fill: "#fff", align: "left", tabs: [ 40, 80, 120 ] };
|
||||
|
||||
var posX = 40;
|
||||
var posY = game.world.height / 2 - 10;
|
||||
this.textMyRanking = game.add.text(posX, posY + 100, '', arrayTabStyle)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
|
||||
setTimeout(
|
||||
(function() {
|
||||
var today = new Date();
|
||||
@@ -51,22 +52,7 @@ HistoryBoard.prototype.calcDate = function(daysBefore) {
|
||||
|
||||
|
||||
HistoryBoard.prototype.printRecord = function(index, date, bestRecord) {
|
||||
var posX = 130;
|
||||
var posY = game.world.height / 2 + 90 + 30 * index;
|
||||
|
||||
var style = { font: "20px Arial", fill: "#ffc", align: "right", boundsAlignH: "right", boundsAlignV: "top" };
|
||||
|
||||
var dateText = game.add.text(posX, posY, StringUtil.printMonthDay(date), style);
|
||||
dateText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
dateText.anchor.set(1, 0);
|
||||
|
||||
var recordText = game.add.text(
|
||||
posX + 120, posY,
|
||||
RecordUtil.getRecordValueWithUnit(bestRecord, sessionStorageManager.getPlayingAppID()),
|
||||
style
|
||||
);
|
||||
recordText.anchor.set(1, 0);
|
||||
recordText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
this.historyTexts[index].setContents(date, bestRecord);
|
||||
}
|
||||
|
||||
HistoryBoard.prototype.printSample = function() {
|
||||
|
||||
@@ -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;
|
||||
@@ -2,7 +2,10 @@ function RecordBoard(dataType) {
|
||||
this.chartGraphics = game.add.graphics(0, 0);
|
||||
|
||||
this.printRecordBoardHeader();
|
||||
this.printSeperator();
|
||||
|
||||
this.printSeperator(265, 480);
|
||||
this.printSeperator(505, 480);
|
||||
this.printSeperator(745, 480);
|
||||
|
||||
var historyBoard = new HistoryBoard(dataType);
|
||||
var rankingBoard = new RankingBoard(dataType);
|
||||
@@ -10,7 +13,7 @@ function RecordBoard(dataType) {
|
||||
|
||||
|
||||
RecordBoard.prototype.printRecordBoardHeader = function() {
|
||||
var posX = 60;
|
||||
var posX = 40;
|
||||
var posY = game.world.height / 2 + 20;
|
||||
|
||||
var bar = game.add.graphics();
|
||||
@@ -20,14 +23,14 @@ RecordBoard.prototype.printRecordBoardHeader = function() {
|
||||
var style = { font: "32px Arial", fill: "#ffc", align: "left", boundsAlignH: "center", boundsAlignV: "middle" };
|
||||
this.printHeader(posX, posY, "최근의 내 기록", style);
|
||||
|
||||
posX = 320;
|
||||
posX = 285;
|
||||
style.fill = "#fff";
|
||||
this.printHeader(posX, posY, "수업시간 순위", style);
|
||||
|
||||
posX = 550;
|
||||
posX = 520;
|
||||
this.printHeader(posX, posY, "오늘의 순위", style);
|
||||
|
||||
posX = 770;
|
||||
posX = 765;
|
||||
this.printHeader(posX, posY, "이달의 순위", style);
|
||||
}
|
||||
|
||||
@@ -37,13 +40,10 @@ RecordBoard.prototype.printHeader = function(x, y, title, style) {
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
}
|
||||
|
||||
RecordBoard.prototype.printSeperator = function() {
|
||||
var posX = 290;
|
||||
var posY = 480;
|
||||
|
||||
RecordBoard.prototype.printSeperator = function(x, y) {
|
||||
this.chartGraphics.lineStyle(3, 0x444444, 1);
|
||||
this.chartGraphics.moveTo(posX, posY);
|
||||
this.chartGraphics.lineTo(posX, posY + 200);
|
||||
this.chartGraphics.moveTo(x, y);
|
||||
this.chartGraphics.lineTo(x, y + 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user