Add: selected subject name to license time db
This commit is contained in:
@@ -420,7 +420,7 @@ DBConnectManager.prototype.requestLicenseTimeData = function(maestroID, playerID
|
||||
);
|
||||
}
|
||||
|
||||
DBConnectManager.prototype.updateLicenseStartTime = function(maestroID, playerID, startTime, onSucceededListener, onFailedListener) {
|
||||
DBConnectManager.prototype.updateLicenseStartTime = function(maestroID, playerID, startTime, subjectName, onSucceededListener, onFailedListener) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", this.phpPath + "server/license_timer/update_license_start_time.php", true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
@@ -438,10 +438,11 @@ DBConnectManager.prototype.updateLicenseStartTime = function(maestroID, playerID
|
||||
"MaestroID=" + maestroID
|
||||
+ "&PlayerID=" + playerID
|
||||
+ "&StartTime=" + startTime
|
||||
+ "&SubjectName=" + subjectName
|
||||
);
|
||||
}
|
||||
|
||||
DBConnectManager.prototype.updateLicenseLeftTime = function(maestroID, playerID, leftTime, onSucceededListener, onFailedListener) {
|
||||
DBConnectManager.prototype.updateLicenseLeftTime = function(maestroID, playerID, leftTime, subjectName, onSucceededListener, onFailedListener) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", this.phpPath + "server/license_timer/update_license_left_time.php", true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
@@ -459,6 +460,7 @@ DBConnectManager.prototype.updateLicenseLeftTime = function(maestroID, playerID,
|
||||
"MaestroID=" + maestroID
|
||||
+ "&PlayerID=" + playerID
|
||||
+ "&LeftTime=" + leftTime
|
||||
+ "&SubjectName=" + subjectName
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ var LicenseTimer = {
|
||||
create: function() {
|
||||
game.stage.backgroundColor = "#4d4d4d";
|
||||
|
||||
this.dbConnectManager = new DBConnectManager();
|
||||
|
||||
// keyboard shortcut
|
||||
this.keyboardShortcut = new KeyboardShortcut();
|
||||
this.keyboardShortcut.addCallback(
|
||||
@@ -28,6 +30,8 @@ var LicenseTimer = {
|
||||
this.chart = new Chart(this.licenseDataManager);
|
||||
|
||||
this.inputScore = new InputScore(this.licenseDataManager, this.timer, this.chart);
|
||||
|
||||
this.loadDataFromServer();
|
||||
},
|
||||
|
||||
back: function() {
|
||||
@@ -36,4 +40,22 @@ var LicenseTimer = {
|
||||
game.state.start('Login');
|
||||
},
|
||||
|
||||
loadDataFromServer: function() {
|
||||
this.dbConnectManager.requestLicenseTimeData(
|
||||
sessionStorageManager.getMaestroID(),
|
||||
sessionStorageManager.getPlayerID(),
|
||||
Timer.TIME_DEFAULT_SEC,
|
||||
(function(replyJson) {
|
||||
console.log(replyJson);
|
||||
this.timer.loadDataFromServer(replyJson.leftTime, replyJson.startTime, replyJson.subjectName);
|
||||
this.inputScore.loadDataFromServer(replyJson.subjectName);
|
||||
}).bind(this),
|
||||
|
||||
(function(replyJson) {
|
||||
console.log(replyJson);
|
||||
this.timer.loadDataFromServer(Timer.TIME_DEFAULT_SEC, Timer.TIME_DEFAULT_SEC);
|
||||
})
|
||||
);
|
||||
},
|
||||
|
||||
}
|
||||
@@ -76,7 +76,7 @@ function InputScore(licenseDataManager, timer, chart) {
|
||||
InputScore.prototype.initVariables = function() {
|
||||
this.inputScorePosY = GAME_SCREEN_SIZE.y - InputScore.INPUT_SCORE_GROUP_OFFSET_Y;
|
||||
|
||||
this.subjectFullname = "ITQ 파워포인트";
|
||||
this.subjectFullname = "";
|
||||
this.recentSubject = this.subjectFullname;
|
||||
|
||||
this.companyButtonList = [];
|
||||
@@ -85,6 +85,11 @@ InputScore.prototype.initVariables = function() {
|
||||
this.maestroPassword;
|
||||
}
|
||||
|
||||
InputScore.prototype.loadDataFromServer = function(subjectName) {
|
||||
this.setSubjectFullname(subjectName);
|
||||
this.recentSubject = this.subjectFullname;
|
||||
}
|
||||
|
||||
InputScore.prototype.makeInputTextSetting = function(width, placeHolder) {
|
||||
return {
|
||||
font: "32px Arial",
|
||||
@@ -271,6 +276,7 @@ InputScore.prototype.onClickCompanySubjectButton = function(subjectFullname) {
|
||||
this.selectedSubjectData = this.licenseDataManager.getSubjectDataByName(subjectFullname);
|
||||
// console.log(this.selectedSubjectData);
|
||||
|
||||
this.timer.setSubjectName(this.subjectFullname);
|
||||
this.timer.setStartTime(this.selectedSubjectData.timeLimit * Timer.TIME_SECONDS_FOR_MINUTE);
|
||||
|
||||
this.setVisibleCompanyPanel(false);
|
||||
@@ -325,6 +331,7 @@ InputScore.prototype.addScoreToServer = function(subjectName, score) {
|
||||
(function(replyJson) {
|
||||
console.log(replyJson);
|
||||
|
||||
this.scoreText.setText("");
|
||||
this.chart.loadScoreFromServer();
|
||||
}).bind(this),
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@ function Timer() {
|
||||
this.pauseButton = this.makePauseButton();
|
||||
this.showButton(this.pauseButton, false);
|
||||
this.playButton = this.makePlayButton();
|
||||
|
||||
this.loadDataFromServer();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +24,8 @@ Timer.prototype.initVariables = function() {
|
||||
this.isTimerGoingOn = false;
|
||||
this.isTimeOver = false;
|
||||
|
||||
this.subjectName = "";
|
||||
|
||||
this.startTime = 0
|
||||
this.leftTime = 0;
|
||||
this.timerEvent = null;
|
||||
@@ -45,39 +45,27 @@ Timer.prototype.initVariables = function() {
|
||||
this.timeMinusButtonPosY = this.timerCenterY + 75;
|
||||
}
|
||||
|
||||
Timer.prototype.loadDataFromServer = function() {
|
||||
this.dbConnectManager.requestLicenseTimeData(
|
||||
sessionStorageManager.getMaestroID(),
|
||||
sessionStorageManager.getPlayerID(),
|
||||
Timer.TIME_DEFAULT_SEC,
|
||||
(function(replyJson) {
|
||||
// console.log(replyJson);
|
||||
Timer.prototype.loadDataFromServer = function(leftTime, startTime, subjectName) {
|
||||
this.setSubjectName(subjectName);
|
||||
|
||||
if(replyJson.leftTime == null || replyJson.leftTime == 0) {
|
||||
this.startTime = replyJson.startTime;
|
||||
this.leftTime = replyJson.timeStart;
|
||||
this.resetTimer();
|
||||
return;
|
||||
}
|
||||
if(leftTime == null || leftTime == 0) {
|
||||
this.startTime = startTime;
|
||||
this.leftTime = startTime;
|
||||
this.resetTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
// this.setTimerTextColor(Timer.TEXT_COLOR_CYAN);
|
||||
// this.updateTimeText();
|
||||
this.startTime = replyJson.startTime;
|
||||
this.leftTime = replyJson.leftTime;
|
||||
this.pauseTimer();
|
||||
}).bind(this),
|
||||
|
||||
(function(replyJson) {
|
||||
console.log(replyJson);
|
||||
|
||||
this.startTime = Timer.TIME_DEFAULT_SEC;
|
||||
this.leftTime = this.startTime;
|
||||
this.updateTimeText();
|
||||
|
||||
})
|
||||
);
|
||||
this.startTime = startTime;
|
||||
this.leftTime = leftTime;
|
||||
this.pauseTimer();
|
||||
}
|
||||
|
||||
Timer.prototype.setSubjectName = function(subjectName) {
|
||||
this.subjectName = subjectName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Timer.prototype.makeTimer = function() {
|
||||
this.timeHourText = this.makeTimerTextContent(this.timerCenterX - 240, this.timerCenterY, 160, "00");
|
||||
this.timeHourMinuteSeperator = this.makeTimerTextContent(this.timerCenterX - 185, this.timerCenterY, 160, ":");
|
||||
@@ -325,8 +313,6 @@ Timer.prototype.resetTimer = function() {
|
||||
|
||||
this.isTimerGoingOn = false;
|
||||
this.setTimerTextColor(Timer.TEXT_COLOR_CYAN);
|
||||
|
||||
// this.loadDataFromServer();
|
||||
}
|
||||
|
||||
Timer.prototype.tickLeftTime = function() {
|
||||
@@ -587,6 +573,7 @@ Timer.prototype.updateStartTimeToServer = function() {
|
||||
sessionStorageManager.getMaestroID(),
|
||||
sessionStorageManager.getPlayerID(),
|
||||
this.startTime,
|
||||
this.subjectName,
|
||||
(function(replyJson) { /*console.log(replyJson);*/ }).bind(this),
|
||||
(function(replyJson) { /*console.log(replyJson);*/ })
|
||||
);
|
||||
@@ -599,6 +586,7 @@ Timer.prototype.resetLeftTimeToServer = function() {
|
||||
sessionStorageManager.getMaestroID(),
|
||||
sessionStorageManager.getPlayerID(),
|
||||
0,
|
||||
this.subjectName,
|
||||
(function(replyJson) { /*console.log(replyJson);*/ }).bind(this),
|
||||
(function(replyJson) { /*console.log(replyJson);*/ })
|
||||
);
|
||||
@@ -611,6 +599,7 @@ Timer.prototype.updateLeftTimeToServer = function() {
|
||||
sessionStorageManager.getMaestroID(),
|
||||
sessionStorageManager.getPlayerID(),
|
||||
this.leftTime,
|
||||
this.subjectName,
|
||||
(function(replyJson) { /*console.log(replyJson);*/ }).bind(this),
|
||||
(function(replyJson) { /*console.log(replyJson);*/ })
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user