From ff38a7bac38692935dfb6354a505250ee9eecb5e Mon Sep 17 00:00:00 2001 From: "jisangs (iMac)" Date: Sun, 24 Apr 2022 08:11:48 +0900 Subject: [PATCH] Fix: debug mode, release mode --- src/game/lib/global/global_variables_debug.js | 175 +++++++++++++----- .../lib/global/global_variables_release.js | 175 +++++++++++++----- 2 files changed, 266 insertions(+), 84 deletions(-) diff --git a/src/game/lib/global/global_variables_debug.js b/src/game/lib/global/global_variables_debug.js index 861e78d..bf9e03c 100644 --- a/src/game/lib/global/global_variables_debug.js +++ b/src/game/lib/global/global_variables_debug.js @@ -1,10 +1,21 @@ var LANGUAGE_KOREAN = "korean"; -var LANGUAGE_ENGLISH = "english"; +var LANGUAGE_ENGLISH = "english"; -var MODE_RELEASE = "release"; +var MODE_RELEASE = "release"; var MODE_DEBUG = "debug"; var runMode = MODE_DEBUG; +function isTddMode() { + // console.log("debug mode ? " + runMode); + if(typeof(tddMode) === "undefined") + return false; + + if(tddMode == true) + return true; + + return false; +} + function isDebugMode() { // console.log("debug mode ? " + runMode); return runMode == MODE_DEBUG ? true : false; @@ -21,88 +32,168 @@ var GAME_SCREEN_SIZE = { x: 1024, y: 768 } var sessionStorageManager = new SessionStorageManager(); + { - // if(isDebugMode()) { - // sessionStorageManager.playerName = "부현율"; - // sessionStorageManager.playerID = 8; - // sessionStorageManager.playingAppID = 101; - // sessionStorageManager.playingAppName = "space_invaders"; - // sessionStorageManager.score = 1000; - // sessionStorageManager.highScore = 2000; - // } + if(isTddMode()) { + console.log("Running in TDD mode"); + } else { + if(isDebugMode()) { + printSessionStorage(); + } - console.log("maestroID : " + sessionStorageManager.maestroID); - console.log("maestroAccountType : " + sessionStorageManager.maestroAccountType); - console.log("playerName : " + sessionStorageManager.playerName); - console.log("playerID : " + sessionStorageManager.playerID); - console.log("playerAccountType : " + sessionStorageManager.playerAccountType); - console.log("playingAppID : " + sessionStorageManager.playingAppID); - console.log("playingAppName : " + sessionStorageManager.playingAppName); - console.log("playingAppKoreanName : " + sessionStorageManager.playingAppKoreanName); - console.log("record : " + sessionStorageManager.record); - console.log("bestRecord : " + sessionStorageManager.bestRecord); - - if(sessionStorageManager.maestroID === null && !isLogin()) { - goLogin(); + if(sessionStorageManager.getMaestroID() === null && !isLogin()) { + goLogin(); + } } } +function printSessionStorage() { + console.log("maestroName : " + sessionStorageManager.getMaestroName()); + console.log("maestroID : " + sessionStorageManager.getMaestroID()); + console.log("maestroAccountType : " + sessionStorageManager.getMaestroAccountType()); + console.log("playerName : " + sessionStorageManager.getPlayerName()); + console.log("playerID : " + sessionStorageManager.getPlayerID()); + console.log("playerAccountType : " + sessionStorageManager.getPlayerAccountType()); + console.log("playingAppID : " + sessionStorageManager.getPlayingAppID()); + console.log("playingAppName : " + sessionStorageManager.getPlayingAppName()); + console.log("playingAppKoreanName : " + sessionStorageManager.getPlayingAppKoreanName()); + console.log("record : " + sessionStorageManager.getRecord()); + console.log("appHighestRecord : " + sessionStorageManager.getAppHighestRecord()); + console.log("writingID : " + sessionStorageManager.getWritingID()); + console.log("appGroup : " + sessionStorageManager.getAppGroup()); + console.log("language : " + sessionStorageManager.getLanguage()); +} + function isLogin() { var filename = location.pathname.substring(location.pathname.lastIndexOf("/") + 1); - // console.log(filename); - return filename === "login.html" ? true : false; + if(filename === "login.html") + return true; + else if(filename === "license_timer.html") + return true; + + return false; } function goLogin() { location.href = "login.html"; } -function isTypingGame() { - if(sessionStorageManager.playingAppName === null) +function isTypingGameApp() { + if(sessionStorageManager.getPlayingAppName() == null) return false; - if(sessionStorageManager.playingAppName.indexOf("typing") < 0) + if(sessionStorageManager.getPlayingAppID === 200) + return true; + + if(sessionStorageManager.getPlayingAppID < 50 || sessionStorageManager.getPlayingAppID > 100) return false; return true; } -function isTypingPracticeStage() { - var appName = sessionStorageManager.playingAppName; - if(appName.indexOf("practice_") > -1) +function isMouseGameApp() { + if(sessionStorageManager.getPlayingAppName() == null) + return false; + + if(sessionStorageManager.getPlayingAppID > 100) return true; return false; } -function isTypingTestStage() { - var appName = sessionStorageManager.playingAppName; - if(appName.indexOf("test_") > -1) +function isTypingPracticeApp() { + if(sessionStorageManager.getPlayingAppName().indexOf("practice_") > -1) return true; return false; } -function isTypingWordStage() { - var appName = sessionStorageManager.playingAppName; - - if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_word") > -1) +function isTypingTestApp() { + if(sessionStorageManager.getPlayingAppName().indexOf("test_") > -1) return true; return false; } -function isTypingSentenceStage() { - var appName = sessionStorageManager.playingAppName; - - if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_sentence") > -1) +function isTypingExamApp() { + if(sessionStorageManager.getPlayingAppName() == "typing_exam") return true; return false; } +function isEnglishTypingApp() { + if(sessionStorageManager.getPlayingAppName().indexOf("english") > -1) + return true; + + return false; +} + +function isKoreanTypingApp() { + if(sessionStorageManager.getPlayingAppName().indexOf("korean") > -1) + return true; + + return false; +} + +function isTypingWordApp() { + var appName = sessionStorageManager.getPlayingAppName(); + + if(appName.indexOf("_word") > -1) + return true; + + // if((isTypingPracticeApp() || isTypingTestApp()) && appName.indexOf("_word") > -1) + // return true; + + return false; +} + +function isTypingSentenceApp() { + var appName = sessionStorageManager.getPlayingAppName(); + + if(appName.indexOf("_sentence") > -1) + return true; + + // if((isTypingPracticeApp() || isTypingTestApp()) && appName.indexOf("_sentence") > -1) + // return true; + + return false; +} + +function isExperiencePlayerAccount() { + if(sessionStorageManager.getMaestroAccountType() == 100) + return true; + + return false; +} + +function isExperienceMaestroAccount() { + if(sessionStorageManager.getMaestroAccountType() == 101) + return true; + + return false; +} + + +function getGameAppName() { + var appName = sessionStorageManager.getPlayingAppName(); + + if(isTypingPracticeApp()) + return "typing_practice"; + else if(isTypingTestApp()) + return "typing_test"; + else if(isTypingGameApp()) { + if(isKoreanTypingApp()) + return appName.substring("typing_korean_".length); + else if(isEnglishTypingApp()) + return appName.substring("typing_english_".length); + } + + return appName; +} + var textStyleBasic = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" }; diff --git a/src/game/lib/global/global_variables_release.js b/src/game/lib/global/global_variables_release.js index 7f329ee..c6b8367 100644 --- a/src/game/lib/global/global_variables_release.js +++ b/src/game/lib/global/global_variables_release.js @@ -1,10 +1,21 @@ var LANGUAGE_KOREAN = "korean"; -var LANGUAGE_ENGLISH = "english"; +var LANGUAGE_ENGLISH = "english"; -var MODE_RELEASE = "release"; +var MODE_RELEASE = "release"; var MODE_DEBUG = "debug"; var runMode = MODE_RELEASE; +function isTddMode() { + // console.log("debug mode ? " + runMode); + if(typeof(tddMode) === "undefined") + return false; + + if(tddMode == true) + return true; + + return false; +} + function isDebugMode() { // console.log("debug mode ? " + runMode); return runMode == MODE_DEBUG ? true : false; @@ -21,88 +32,168 @@ var GAME_SCREEN_SIZE = { x: 1024, y: 768 } var sessionStorageManager = new SessionStorageManager(); + { - // if(isDebugMode()) { - // sessionStorageManager.playerName = "부현율"; - // sessionStorageManager.playerID = 8; - // sessionStorageManager.playingAppID = 101; - // sessionStorageManager.playingAppName = "space_invaders"; - // sessionStorageManager.score = 1000; - // sessionStorageManager.highScore = 2000; - // } + if(isTddMode()) { + console.log("Running in TDD mode"); + } else { + if(isDebugMode()) { + printSessionStorage(); + } - console.log("maestroID : " + sessionStorageManager.maestroID); - console.log("maestroAccountType : " + sessionStorageManager.maestroAccountType); - console.log("playerName : " + sessionStorageManager.playerName); - console.log("playerID : " + sessionStorageManager.playerID); - console.log("playerAccountType : " + sessionStorageManager.playerAccountType); - console.log("playingAppID : " + sessionStorageManager.playingAppID); - console.log("playingAppName : " + sessionStorageManager.playingAppName); - console.log("playingAppKoreanName : " + sessionStorageManager.playingAppKoreanName); - console.log("record : " + sessionStorageManager.record); - console.log("bestRecord : " + sessionStorageManager.bestRecord); - - if(sessionStorageManager.maestroID === null && !isLogin()) { - goLogin(); + if(sessionStorageManager.getMaestroID() === null && !isLogin()) { + goLogin(); + } } } +function printSessionStorage() { + console.log("maestroName : " + sessionStorageManager.getMaestroName()); + console.log("maestroID : " + sessionStorageManager.getMaestroID()); + console.log("maestroAccountType : " + sessionStorageManager.getMaestroAccountType()); + console.log("playerName : " + sessionStorageManager.getPlayerName()); + console.log("playerID : " + sessionStorageManager.getPlayerID()); + console.log("playerAccountType : " + sessionStorageManager.getPlayerAccountType()); + console.log("playingAppID : " + sessionStorageManager.getPlayingAppID()); + console.log("playingAppName : " + sessionStorageManager.getPlayingAppName()); + console.log("playingAppKoreanName : " + sessionStorageManager.getPlayingAppKoreanName()); + console.log("record : " + sessionStorageManager.getRecord()); + console.log("appHighestRecord : " + sessionStorageManager.getAppHighestRecord()); + console.log("writingID : " + sessionStorageManager.getWritingID()); + console.log("appGroup : " + sessionStorageManager.getAppGroup()); + console.log("language : " + sessionStorageManager.getLanguage()); +} + function isLogin() { var filename = location.pathname.substring(location.pathname.lastIndexOf("/") + 1); - // console.log(filename); - return filename === "login.html" ? true : false; + if(filename === "login.html") + return true; + else if(filename === "license_timer.html") + return true; + + return false; } function goLogin() { location.href = "login.html"; } -function isTypingGame() { - if(sessionStorageManager.playingAppName === null) +function isTypingGameApp() { + if(sessionStorageManager.getPlayingAppName() == null) return false; - if(sessionStorageManager.playingAppName.indexOf("typing") < 0) + if(sessionStorageManager.getPlayingAppID === 200) + return true; + + if(sessionStorageManager.getPlayingAppID < 50 || sessionStorageManager.getPlayingAppID > 100) return false; return true; } -function isTypingPracticeStage() { - var appName = sessionStorageManager.playingAppName; - if(appName.indexOf("practice_") > -1) +function isMouseGameApp() { + if(sessionStorageManager.getPlayingAppName() == null) + return false; + + if(sessionStorageManager.getPlayingAppID > 100) return true; return false; } -function isTypingTestStage() { - var appName = sessionStorageManager.playingAppName; - if(appName.indexOf("test_") > -1) +function isTypingPracticeApp() { + if(sessionStorageManager.getPlayingAppName().indexOf("practice_") > -1) return true; return false; } -function isTypingWordStage() { - var appName = sessionStorageManager.playingAppName; - - if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_word") > -1) +function isTypingTestApp() { + if(sessionStorageManager.getPlayingAppName().indexOf("test_") > -1) return true; return false; } -function isTypingSentenceStage() { - var appName = sessionStorageManager.playingAppName; - - if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_sentence") > -1) +function isTypingExamApp() { + if(sessionStorageManager.getPlayingAppName() == "typing_exam") return true; return false; } +function isEnglishTypingApp() { + if(sessionStorageManager.getPlayingAppName().indexOf("english") > -1) + return true; + + return false; +} + +function isKoreanTypingApp() { + if(sessionStorageManager.getPlayingAppName().indexOf("korean") > -1) + return true; + + return false; +} + +function isTypingWordApp() { + var appName = sessionStorageManager.getPlayingAppName(); + + if(appName.indexOf("_word") > -1) + return true; + + // if((isTypingPracticeApp() || isTypingTestApp()) && appName.indexOf("_word") > -1) + // return true; + + return false; +} + +function isTypingSentenceApp() { + var appName = sessionStorageManager.getPlayingAppName(); + + if(appName.indexOf("_sentence") > -1) + return true; + + // if((isTypingPracticeApp() || isTypingTestApp()) && appName.indexOf("_sentence") > -1) + // return true; + + return false; +} + +function isExperiencePlayerAccount() { + if(sessionStorageManager.getMaestroAccountType() == 100) + return true; + + return false; +} + +function isExperienceMaestroAccount() { + if(sessionStorageManager.getMaestroAccountType() == 101) + return true; + + return false; +} + + +function getGameAppName() { + var appName = sessionStorageManager.getPlayingAppName(); + + if(isTypingPracticeApp()) + return "typing_practice"; + else if(isTypingTestApp()) + return "typing_test"; + else if(isTypingGameApp()) { + if(isKoreanTypingApp()) + return appName.substring("typing_korean_".length); + else if(isEnglishTypingApp()) + return appName.substring("typing_english_".length); + } + + return appName; +} + var textStyleBasic = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };