diff --git a/src/game/lib/score_manager.js b/src/game/lib/score_manager.js index de1da62..db5bc12 100644 --- a/src/game/lib/score_manager.js +++ b/src/game/lib/score_manager.js @@ -8,12 +8,14 @@ class ScoreManager { } resetScore() { - sessionStorageManager.record = 0; - this.score = Number(sessionStorageManager.record); + // this.score = Number(sessionStorageManager.record); + this.score = 0; + sessionStorageManager.record = this.score; if(sessionStorageManager.bestRecord === null) - sessionStorageManager.bestRecord = 0; - this.highScore = Number(sessionStorageManager.bestRecord); + this.highScore = 0; + else + this.highScore = Number(sessionStorageManager.bestRecord); } callListener(functionArray) { diff --git a/src/game/lib/screen_bottom.js b/src/game/lib/screen_bottom.js index fcdc6d7..219cbc3 100644 --- a/src/game/lib/screen_bottom.js +++ b/src/game/lib/screen_bottom.js @@ -64,7 +64,8 @@ class ScreenBottom { } printBottomLeftTextWithBestRecord(bestRecord) { - this.printBottomLeftText("오늘의 최고 기록 : " + bestRecord); + let highScoreWithCommas = NumberUtil.numberWithCommas(bestRecord); + this.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas); } } \ No newline at end of file diff --git a/src/game/lib/session_storage_manager.js b/src/game/lib/session_storage_manager.js index 630e32e..e09256d 100644 --- a/src/game/lib/session_storage_manager.js +++ b/src/game/lib/session_storage_manager.js @@ -83,4 +83,13 @@ class SessionStorageManager { return sessionStorage.getItem("isNewBestRecord"); } + resetPlayingAppData() { + sessionStorage.playingAppID = null; + sessionStorage.playingAppName = null; + sessionStorage.playingAppKoreanName = null; + sessionStorage.record = null; + sessionStorage.bestRecord = null; + + } + } \ No newline at end of file diff --git a/src/game/mouse/space_invaders/game.js b/src/game/mouse/space_invaders/game.js index 7fc64e4..19e27c9 100644 --- a/src/game/mouse/space_invaders/game.js +++ b/src/game/mouse/space_invaders/game.js @@ -10,6 +10,7 @@ class Game { // top let backButton = new BackButton( () => { + sessionStorageManager.resetPlayingAppData(); location.href = '../../web/client/menu_app.html'; }); @@ -28,6 +29,7 @@ class Game { scoreBoard.printScore(NumberUtil.numberWithCommas(score)); }); scoreManager.addOnChangeHighScoreListener( highScore => { + console.log(highScore); sessionStorageManager.bestRecord = highScore; sessionStorageManager.isNewBestRecrd = true; screenBottom.printBottomLeftTextWithBestRecord(sessionStorageManager.bestRecord); diff --git a/src/game/result/result.js b/src/game/result/result.js index 169172f..14b32a1 100644 --- a/src/game/result/result.js +++ b/src/game/result/result.js @@ -16,6 +16,7 @@ class Result { // top let backButton = new BackButton( () => { + sessionStorageManager.resetPlayingAppData(); location.href = '../../web/client/menu_app.html'; }); diff --git a/src/game/start/start.js b/src/game/start/start.js index 916ac19..8d4f82a 100644 --- a/src/game/start/start.js +++ b/src/game/start/start.js @@ -74,14 +74,16 @@ class Start { sessionStorageManager.playerUserID, sessionStorageManager.playingAppID, replyJSON => { - sessionStorageManager.BestRecord = Number(replyJSON["BestRecord"]); - let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.BestRecord); - screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas); + sessionStorageManager.bestRecord = Number(replyJSON["BestRecord"]); + // let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.bestRecord); + // screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas); + screenBottom.printBottomLeftTextWithBestRecord(sessionStorageManager.bestRecord); }, replyJSON => { // no data - sessionStorageManager.BestRecord = 0; - let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.BestRecord); - screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas); + sessionStorageManager.bestRecord = 0; + // let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.bestRecord); + // screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas); + screenBottom.printBottomLeftTextWithBestRecord(sessionStorageManager.bestRecord); } ); } diff --git a/src/web/server/record/history_record.php b/src/web/server/record/history_record.php index e8139d5..61ca2df 100644 --- a/src/web/server/record/history_record.php +++ b/src/web/server/record/history_record.php @@ -29,7 +29,7 @@ function get_history_record($maestro_id, $app_id, $user_id, $date) { SELECT DATE(BR.RecordDateTime) AS Date, MAX(BR.BestRecord) AS HighScore, AA.AppName AS AppName FROM moty_best_record BR INNER JOIN moty_app AS AA - ON BR.MaestroID = ? AND BR.UserID = ? AND DATE(BR.RecordDateTime) < ? AND BR.AppID = ? AND BR.AppID = AA.AppID + ON BR.MaestroID = ? AND BR.UserID = ? AND DATE(BR.RecordDateTime) <= ? AND BR.AppID = ? AND BR.AppID = AA.AppID GROUP BY DATE(BR.RecordDateTime) ORDER BY BR.RecordDateTime DESC LIMIT 7