var Game = { create: function() { this.dbConnectManager = new DBConnectManager(); sessionStorageManager.setRecord(0); this.game.stage.backgroundColor = "#000000"; // '#4d4d4d'; sessionStorageManager.setIsNewAppHighestRecord(false); var experienceAppTimer = new ExperienceAppTimer(); experienceAppTimer.setTimeOverListener( (function() { this.timeOver(); }).bind(this) ); // keyboard shortcut this.keyboardShortcut = new KeyboardShortcut(); this.keyboardShortcut.addCallback( Phaser.KeyCode.ESC, // keyCode null, // keyDownHandler (function() { this.back(); }).bind(this), // keyUpHandler "1 to 50" // callerClassName ); // top ui var screenTopUI = new ScreenTopUI(); screenTopUI.makeBackButton( (function() { this.back(); }).bind(this) ); screenTopUI.makeFullScreenButton(); this.scoreManager = new ScoreManager(); this.scoreBoard = new ScoreBoard(); this.scoreManager.addOnChangeScoreListener( (function(score) { sessionStorageManager.setRecord(score); this.scoreBoard.printScore(NumberUtil.numberWithCommas(score)); }).bind(this) ); this.scoreManager.addOnChangeHighScoreListener( (function(highScore) { // console.log(highScore); // sessionStorageManager.setAppHighestRecord(highScore); sessionStorageManager.setIsNewBestRecrd(true); // this.screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord()); }).bind(this) ); this.initVariables(); // game stage game.stage.backgroundColor = '#4d4d4d'; graphics = game.add.graphics(0, 0); // bottom ui var screenBottomUI = new ScreenBottomUI(); screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord()); screenBottomUI.printCenterText(sessionStorageManager.getPlayingAppKoreanName()); screenBottomUI.printRightText(sessionStorageManager.getPlayerName()); this.startGame(); // // this.countDown(); }, initVariables: function() { }, back: function() { sessionStorageManager.resetPlayingAppData(); location.href = '../../web/client/menu_app.html'; }, startGame: function() { this.startStage(); }, startStage: function() { }, timeOver: function() { var timeOverText = new TimeOverText(); if(!isExperienceMaestroAccount()) this.updateResultRecord(); game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this); }, updateResultRecord: function() { if(sessionStorageManager.getMaestroAccountType() < 100) { // experience account this.dbConnectManager.updateResultRecord( sessionStorageManager.getMaestroID(), sessionStorageManager.getPlayerID(), sessionStorageManager.getPlayingAppID(), sessionStorageManager.getRecord() ); } }, goResult: function() { location.href = '../../web/client/result.html'; }, } // Game.GAME_TIME_SEC = 60; // Game.NEXT_STAGE_DELAY_MS = 500;