Files
chocomae/src/game/license_timer/game.js
T

61 lines
1.8 KiB
JavaScript

var LicenseTimer = {
create: function() {
game.stage.backgroundColor = "#4d4d4d";
this.dbConnectManager = new DBConnectManager();
// keyboard shortcut
this.keyboardShortcut = new KeyboardShortcut();
this.keyboardShortcut.addCallback(
Phaser.KeyCode.ESC, // keyCode
null, // keyDownHandler
(function() { this.back(); }).bind(this), // keyUpHandler
"keyboard_test" // callerClassName
);
// top ui
var screenTopUI = new ScreenTopUI();
screenTopUI.makeBackButton( (function() { this.back(); }).bind(this) );
screenTopUI.makeFullScreenButton();
var titleTextStyle = { font: "36px Arial", fill: "#fff", align: "center"};
this.titleText = game.add.text(game.world.centerX, 35, "자격증 타이머", titleTextStyle);
this.titleText.anchor.set(0.5);
// this.fullscreenButton = new FullscreenButton();
this.licenseDataManager = new LicenseDataManager();
this.timer = new Timer();
this.chart = new Chart(this.licenseDataManager);
this.inputScore = new InputScore(this.licenseDataManager, this.timer, this.chart);
this.loadDataFromServer();
},
back: function() {
sessionStorageManager.resetPlayingAppData();
// location.href = '../../web/client/menu_typing_test.html';
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);
})
);
},
}