///////////////////////////// // Result class Result { preload() { game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png'); } create() { this.dbConnectManager = new DBConnectManager(); this.game.stage.backgroundColor = '#4d4d4d'; this.chartGraphics = game.add.graphics(100, game.world.height - 120); // top let backButton = new BackButton( () => { if(isTypingPracticeStage()) location.href = '../../web/client/menu_typing_practice.html'; else if(isTypingTestStage()) location.href = '../../web/client/menu_typing_test.html'; else location.href = '../../web/client/menu_app.html'; sessionStorageManager.resetPlayingAppData(); }); let fullscreenButton = new FullscreenButton(this.game); // contents this.printRecord(); this.uploadRecord(); this.makeRestartButton(); let recordBoard = new RecordBoard(); // bottom let screenBottom = new ScreenBottom(); screenBottom.makeBottomLine(); screenBottom.printBottomLeftTextWithBestRecord(Math.floor(sessionStorageManager.bestRecord)); screenBottom.printBottomCenterText(sessionStorageManager.playingAppKoreanName); screenBottom.printBottomRightText(sessionStorageManager.playerName); } printRecord() { const style = { font: "64px Arial", fill: "#fff", align: "left", boundsAlignH: "center", boundsAlignV: "middle" }; game.add.text(0, 0, "결과", style) .setTextBounds(0, 0, game.world.width, 100) .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); let posY = 120; if(sessionStorageManager.record === null) sessionStorageManager.record = 0; let record = NumberUtil.numberWithCommas(Math.floor(sessionStorageManager.record)); style.font = "bold 80px Arial"; game.add.text(0, 0, record, style) .setTextBounds(0, posY, game.world.width, 60) .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); if(sessionStorageManager.isNewBestRecrd === true) { style.font = "32px Arial"; let bestRecordText = game.add.text(0, 0, "!!! 새로운 최고 기록 !!!", style) .setTextBounds(0, posY + 80, game.world.width, 40); // .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); bestRecordText.stroke = "#333"; bestRecordText.strokeThickness = 5; } /* if(sessionStorageManager.bestRecord === null) sessionStorageManager.bestRecord = 0; let bestRecord = NumberUtil.numberWithCommas(sessionStorageManager.bestRecord); style.font = "32px Arial"; let bestRecordText = game.add.text(0, 0, "오늘 최고 기록 : " + bestRecord, style) .setTextBounds(0, posY + 80, game.world.width, 40); // .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); bestRecordText.stroke = "#333"; bestRecordText.strokeThickness = 5; */ } uploadRecord() { this.dbConnectManager.updateTodayBestRecord( sessionStorageManager.maestroID, sessionStorageManager.playerID, sessionStorageManager.playingAppID, sessionStorageManager.record ); } makeRestartButton() { let setting = new RoundRectButtonSetting(game.world.centerX, game.world.height / 2 - 70, 200, 100); setting.fontStyle.fontWeight = "bold"; let startButton = new RoundRectButton(setting, RoundRectButton.NONE_ICON, "다시 시작", this.restartStage); } restartStage() { if(sessionStorageManager.playingAppName.indexOf("practice_") == 0) { location.href = "../../web/client/typing_practice.html"; } else if(sessionStorageManager.playingAppName.indexOf("test_") == 0) { location.href = "../../web/client/typing_test.html"; } else { location.href = "../../web/client/" + sessionStorageManager.playingAppName + ".html"; } } }