From ba1a36a734adafbfea05cfb94bfbb254cf1bb4ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Fri, 6 Sep 2019 22:39:58 +0900 Subject: [PATCH] Fix: delete ResultFail, show failed message in Result --- src/game/result/main_fail.js | 12 -- src/game/result/result.js | 29 ++-- src/game/result/result_fail.js | 205 ---------------------------- src/game/typing/examination/game.js | 17 ++- src/web/client/result.html | 2 + src/web/client/result_fail.html | 76 ----------- 6 files changed, 31 insertions(+), 310 deletions(-) delete mode 100644 src/game/result/main_fail.js delete mode 100644 src/game/result/result_fail.js delete mode 100644 src/web/client/result_fail.html diff --git a/src/game/result/main_fail.js b/src/game/result/main_fail.js deleted file mode 100644 index 69889ec..0000000 --- a/src/game/result/main_fail.js +++ /dev/null @@ -1,12 +0,0 @@ -///////////////////////////// -// Main game - -var CONTENT_ID = "ResultFail"; - -var game = new Phaser.Game( - GAME_SCREEN_SIZE.x, GAME_SCREEN_SIZE.y, - Phaser.CANVAS, CONTENT_ID -); - -game.state.add('ResultFail', Result); -game.state.start('ResultFail'); diff --git a/src/game/result/result.js b/src/game/result/result.js index 092a92c..f87cfd9 100644 --- a/src/game/result/result.js +++ b/src/game/result/result.js @@ -90,6 +90,25 @@ var Result = { if(sessionStorageManager.getRecord() === null) sessionStorageManager.setRecord(0); + var record = sessionStorageManager.getRecord(); + style.font = "80px Arial"; + var scoreText = game.add.text( + x, y, + "", + style + ); + scoreText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); + scoreText.anchor.set(0.5); + + if(record < 0) { + scoreText.text = "제한 시간 초과!"; + scoreText.style.fill = MainColor.INDIAN_RED_STRING; + + return; + } + + scoreText.text = RecordUtil.getRecordValueWithUnit(record, sessionStorageManager.getPlayingAppID()); + if(isTypingPracticeApp() || isTypingTestApp() || isTypingExamApp()) { var animalLevelID = 0; if(isTypingPracticeApp()) @@ -103,16 +122,6 @@ var Result = { var rightAnimal = new Animal(Animal.TYPE_ANIMATION, animalLevelID, game.world.centerX + 200, 150); rightAnimal.startAnimation(Animal.SPECIES_DATA[animalLevelID]); } - - var record = sessionStorageManager.getRecord(); - style.font = "80px Arial"; - var scoreText = game.add.text( - x, y, - RecordUtil.getRecordValueWithUnit(record, sessionStorageManager.getPlayingAppID()), - style - ); - scoreText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); - scoreText.anchor.set(0.5); }, printTodayBestRecord: function() { diff --git a/src/game/result/result_fail.js b/src/game/result/result_fail.js deleted file mode 100644 index 05608d0..0000000 --- a/src/game/result/result_fail.js +++ /dev/null @@ -1,205 +0,0 @@ -var ResultFail = { - - preload: function() { - game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png'); - - if(isTypingPracticeApp() || isTypingTestApp() || isTypingExamApp()) - Animal.loadResources(); - - RankingBoard.loadResources(); - game.load.image('star', '../../../resources/image/ui/star_particle.png'); - }, - - create: function() { - this.dbConnectManager = new DBConnectManager(); - - this.game.stage.backgroundColor = '#4d4d4d'; - this.chartGraphics = game.add.graphics(100, game.world.height - 120); - - // keyboard shortcut - this.keyboardShortcut = new KeyboardShortcut(); - this.keyboardShortcut.addCallback( - Phaser.KeyCode.ESC, // keyCode - null, // keyDownHandler - (function() { this.back(); }).bind(this), // keyUpHandler - "result" // callerClassName - ); - this.keyboardShortcut.addCallback( - Phaser.KeyCode.ENTER, // keyCode - null, // keyDownHandler - (function() { this.restartStage(); }).bind(this), // keyUpHandler - "result" // callerClassName - ); - - // top ui - var screenTopUI = new ScreenTopUI(); - screenTopUI.makeBackButton( (function() { this.back(); }).bind(this) ); - screenTopUI.makeFullScreenButton(); - - - // contents - // this.printRecord(); - this.printFailedMessage(); - - this.makeRestartButton(); - - - if(sessionStorageManager.getMaestroAccountType() >= 100) { // experience account - var recordBoard = new RecordBoard(RecordBoard.TYPE_SAMPLE); - this.announceBox = new AnnounceBox(50, 648); - this.announceBox.drawBox("체험 계정에서는 기록이 저장되지 않습니다."); - } else { - // this.printTodayBestRecord(); - var recordBoard = new RecordBoard(RecordBoard.TYPE_DB); - } - - - // bottom ui - var screenBottomUI = new ScreenBottomUI(); - screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord()); - screenBottomUI.printCenterText(sessionStorageManager.getPlayingAppKoreanName()); - screenBottomUI.printRightText(sessionStorageManager.getPlayerName()); - }, - - - back: function() { - location.href = '../../web/client/main_menu.html'; - - /* - if(isTypingExamApp()) - location.href = '../../web/client/menu_typing_exam.html'; - else if(isTypingPracticeApp()) - location.href = '../../web/client/menu_typing_practice.html'; - else if(isTypingTestApp()) - location.href = '../../web/client/menu_typing_test.html'; - else - location.href = '../../web/client/menu_app.html'; - - sessionStorageManager.resetPlayingAppData(); - */ - }, - - printFailedMessage: function() { - var style = { font: "bold 38px Arial", fill: "#fff", align: "left", boundsAlignH: "center", boundsAlignV: "middle" }; - var titleText = game.add.text(game.world.width / 2, 35, "결과", style); - titleText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); - titleText.anchor.set(0.5); - - - var x = game.world.width / 2; - var y = 150; - if(sessionStorageManager.getRecord() === null) - sessionStorageManager.setRecord(0); - - var record = sessionStorageManager.getRecord(); - style.font = "80px Arial"; - var scoreText = game.add.text( - x, y, - "도전 실패", - style - ); - scoreText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); - scoreText.anchor.set(0.5); - }, - - /* - printRecord: function() { - var style = { font: "bold 38px Arial", fill: "#fff", align: "left", boundsAlignH: "center", boundsAlignV: "middle" }; - var titleText = game.add.text(game.world.width / 2, 35, "결과", style); - titleText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); - titleText.anchor.set(0.5); - - - var x = game.world.width / 2; - var y = 150; - if(sessionStorageManager.getRecord() === null) - sessionStorageManager.setRecord(0); - - if(isTypingPracticeApp() || isTypingTestApp() || isTypingExamApp()) { - var animalLevelID = 0; - if(isTypingPracticeApp()) - animalLevelID = Animal.animalLevelIDByRecord(sessionStorageManager.getRecord(), Animal.TYPE_PRACTICE); - else // Typing Test App - animalLevelID = Animal.animalLevelIDByRecord(sessionStorageManager.getRecord(), Animal.TYPE_TEST); - - var leftAnimal = new Animal(Animal.TYPE_ANIMATION, animalLevelID, game.world.centerX - 200, 150); - leftAnimal.startAnimation(Animal.SPECIES_DATA[animalLevelID]); - - var rightAnimal = new Animal(Animal.TYPE_ANIMATION, animalLevelID, game.world.centerX + 200, 150); - rightAnimal.startAnimation(Animal.SPECIES_DATA[animalLevelID]); - } - - var record = sessionStorageManager.getRecord(); - style.font = "80px Arial"; - var scoreText = game.add.text( - x, y, - RecordUtil.getRecordValueWithUnit(record, sessionStorageManager.getPlayingAppID()), - style - ); - scoreText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); - scoreText.anchor.set(0.5); - }, - */ - - printTodayBestRecord: function() { - // console.log(sessionStorageManager.getAppHighestRecord()); - // console.log(sessionStorageManager.getRecord()); - - /* - var appHighestRecord = sessionStorageManager.getAppHighestRecord(); - var prevRecord = sessionStorageManager.getRecord(); - if(appHighestRecord == 'undefined' || appHighestRecord == null) { - this.showHighestRecordEffect(prevRecord); - return; - } - - if(this.isHighestRecordPreferApp()) { - if(prevRecord > appHighestRecord) - this.showHighestRecordEffect(prevRecord); - } else { - if(appHighestRecord == 0) - this.showHighestRecordEffect(prevRecord); - else if(prevRecord < appHighestRecord) - this.showHighestRecordEffect(prevRecord); - } - */ - }, - - showHighestRecordEffect: function(record) { - sessionStorageManager.setAppHighestRecord(record); - - var newRecordEmitter = game.add.emitter(game.world.centerX, 140, 300); - newRecordEmitter.makeParticles('star'); - newRecordEmitter.gravity = 300; - - var style = { font: "32px Arial", fill: "#ff0", align: "left", boundsAlignH: "center", boundsAlignV: "middle" }; - var bestRecordText = game.add.text(game.world.centerX, 220, "", style); - bestRecordText.anchor.set(0.5); - bestRecordText.stroke = "#333"; - bestRecordText.strokeThickness = 5; - - bestRecordText.text = "! : . 최고 기록 경신 . : !"; - newRecordEmitter.start(true, 2000, null, 20); - }, - - isHighestRecordPreferApp: function() { - if(sessionStorageManager.getPlayingAppID() == 105) - return false; - - return true; - }, - - makeRestartButton: function() { - var setting = new RoundRectButtonSetting(game.world.centerX, game.world.height / 2 - 70, 200, 100); - setting.fontStyle.fontWeight = "bold"; - - var startButton = new RoundRectButton(setting, RoundRectButton.NONE_ICON, "다시 시작", this.restartStage); - startButton.addShortcutText("Enter"); - }, - - - restartStage: function() { - location.href = "../../web/client/" + getGameAppName() + ".html"; - } - -} \ No newline at end of file diff --git a/src/game/typing/examination/game.js b/src/game/typing/examination/game.js index 16e00c3..cfa7ce9 100644 --- a/src/game/typing/examination/game.js +++ b/src/game/typing/examination/game.js @@ -318,23 +318,26 @@ TypingExamination.prototype.startGame = function() { TypingExamination.prototype.timeOver = function() { var timeOverText = new TimeOverText(); + sessionStorageManager.setRecord(-1); + this.stopAndGoResult(); } TypingExamination.prototype.gameOver = function() { - var missionClearText = new MissionClearText(); - this.stopAndGoResult(); - this.realtimeStageTimer.pause(); -} - -TypingExamination.prototype.stopAndGoResult = function() { - this.animalRecordList.stopAnimation(); + var missionClearText = new MissionClearText(); sessionStorageManager.setRecord(this.typingRecordTotal); if(!isExperienceMaestroAccount()) this.updateResultRecord(); + this.stopAndGoResult(); + +} + +TypingExamination.prototype.stopAndGoResult = function() { + this.animalRecordList.stopAnimation(); + game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this); } diff --git a/src/web/client/result.html b/src/web/client/result.html index c1e38c0..534d104 100644 --- a/src/web/client/result.html +++ b/src/web/client/result.html @@ -19,6 +19,8 @@ + + diff --git a/src/web/client/result_fail.html b/src/web/client/result_fail.html deleted file mode 100644 index 72ce81e..0000000 --- a/src/web/client/result_fail.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - 결과 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - \ No newline at end of file