Add: typing exam start

This commit is contained in:
2019-07-18 16:23:07 +09:00
parent 1f6d91f301
commit f79040fed4
4 changed files with 71 additions and 37 deletions
+5 -1
View File
@@ -36,8 +36,12 @@ function TypingExamButton(x, y, iconName, buttonText, writingID) {
TypingExamButton.prototype.onClick = function() {
sessionStorageManager.setPlayingAppID(200);
sessionStorageManager.setPlayingAppName("typing_exam");
sessionStorageManager.setPlayingAppKoreanName("타자검정");
sessionStorageManager.setWritingID(this.writingID);
location.href = '../../web/client/typing_exam.html';
// location.href = '../../web/client/typing_exam.html';
location.href = '../../web/client/start.html';
// printSessionStorage();
}
+10 -10
View File
@@ -200,15 +200,15 @@ DBConnectManager.prototype.requestTypingTestAppList = function(maestroID, player
xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID);
}
DBConnectManager.prototype.requestPlayerHistory = function(date, listener) {
DBConnectManager.prototype.requestPlayerHistory = function(date, onSucceededListener, onFailedListener) {
var historyRecordManager = new HistoryRecordManager();
/*
if(isDebugMode()) {
this.loadTempPlayerHistory(historyRecordManager);
if(listener !== null)
listener(historyRecordManager);
if(onSucceededListener !== null)
onSucceededListener(historyRecordManager);
return;
}
@@ -224,9 +224,9 @@ DBConnectManager.prototype.requestPlayerHistory = function(date, listener) {
var replyJSON = JSON.parse(xhr.responseText);
if(replyJSON != null)
listener(self.parseJSONtoHistoryRecord(replyJSON));
// else
// onFailedListener(replyJSON);
onSucceededListener(self.parseJSONtoHistoryRecord(replyJSON));
else
onFailedListener(replyJSON);
}
};
var params = "MaestroID=" + sessionStorageManager.getMaestroID()
@@ -258,15 +258,15 @@ DBConnectManager.prototype.parseJSONtoHistoryRecord = function(json) {
return historyRecordManager;
}
DBConnectManager.prototype.requestRanking = function(type, maestroID, date, time, listener) {
DBConnectManager.prototype.requestRanking = function(type, maestroID, date, time, onSucceededListener, onFailedListener) {
var rankingRecordManager = new RankingRecordManager();
/*
if(isDebugMode()) {
this.loadTempRanking(rankingRecordManager);
if(listener !== null)
listener(rankingRecordManager);
if(onSucceededListener !== null)
onSucceededListener(rankingRecordManager);
return;
}
@@ -282,7 +282,7 @@ DBConnectManager.prototype.requestRanking = function(type, maestroID, date, time
var replyJSON = JSON.parse(xhr.responseText);
if(replyJSON != null) {
listener(type, self.parseJSONtoRankingRecord(type, replyJSON));
onSucceededListener(type, self.parseJSONtoRankingRecord(type, replyJSON));
}
else
onFailedListener(replyJSON);
+55 -26
View File
@@ -7,6 +7,10 @@ var Start = {
create: function() {
this.dbConnectManager = new DBConnectManager();
this.dbService = new DBService();
this.dbService.setMaestroID(sessionStorageManager.getMaestroID());
this.dbService.setPlayerID(sessionStorageManager.getPlayerID());
this.game.stage.backgroundColor = '#4d4d4d';
this.howToPlay = new HowToPlay();
this.chart = new Chart();
@@ -98,37 +102,62 @@ var Start = {
loadChart: function() {
var today = new Date();
var date = DateUtil.getYYYYMMDD(today);
this.dbConnectManager.requestPlayerHistory(
date,
(function(historyRecordManager) {
if(historyRecordManager.count == 0) {
console.log("start - history record : no data");
return;
}
var underValue = historyRecordManager.underValueForGraph();
var upperValue = historyRecordManager.upperValueForGraph();
if(isTypingExamApp()) {
this.dbService.requestTypingExamPlayerHistory(
sessionStorageManager.getWritingID(),
date,
var minValue = underValue - (upperValue - underValue) / 10;
var maxValue = upperValue;// + (upperValue - underValue) / 10;
(function(historyRecordManager) {
this.onReceiveHistoryRecordManager(historyRecordManager);
}).bind(this),
var countRecord = historyRecordManager.count;
for(var i = 0; i < Chart.CHART_COUNT; i++) {
// if(i > 6)
// break;
(function(jsonData) {
console.log(jsonData);
}).bind(this)
);
} else {
this.dbConnectManager.requestPlayerHistory(
date,
var historyRecord = historyRecordManager.getAt(i);
this.chart.drawRecordGraph(
i,
historyRecord === undefined ? "-" : historyRecord.date,
historyRecord === undefined ? "" : historyRecord.bestRecord,
minValue, maxValue
);
}
(function(historyRecordManager) {
this.onReceiveHistoryRecordManager(historyRecordManager);
}).bind(this),
this.chart.printChartBaseLine();
}).bind(this)
);
(function(jsonData) {
console.log(jsonData);
}).bind(this)
);
}
},
onReceiveHistoryRecordManager: function(historyRecordManager) {
if(historyRecordManager.count == 0) {
console.log("start - history record : no data");
return;
}
var underValue = historyRecordManager.underValueForGraph();
var upperValue = historyRecordManager.upperValueForGraph();
var minValue = underValue - (upperValue - underValue) / 10;
var maxValue = upperValue;// + (upperValue - underValue) / 10;
var countRecord = historyRecordManager.count;
for(var i = 0; i < Chart.CHART_COUNT; i++) {
// if(i > 6)
// break;
var historyRecord = historyRecordManager.getAt(i);
this.chart.drawRecordGraph(
i,
historyRecord === undefined ? "-" : historyRecord.date,
historyRecord === undefined ? "" : historyRecord.bestRecord,
minValue, maxValue
);
}
this.chart.printChartBaseLine();
},
calcDate: function(daysBefore) {
+1
View File
@@ -33,6 +33,7 @@
<script src="../../game/lib/keyboard_shortcut.js"></script>
<script src="../../game/lib/history_record_manager.js"></script>
<script src="../../game/lib/db_connect_manager.js"></script>
<script src="../../game/lib/db_service.js"></script>
<script src="../../game/lib/button/round_rect_button.js"></script>
<script src="../../game/lib/button/back_button.js"></script>
<script src="../../game/lib/button/fullscreen_button.js"></script>