Add: AppInfoManager

This commit is contained in:
2018-05-09 10:08:09 +09:00
parent 024e114077
commit f44cabcb01
13 changed files with 124 additions and 16 deletions
File diff suppressed because one or more lines are too long
+27 -3
View File
File diff suppressed because one or more lines are too long
@@ -21,14 +21,17 @@ const GAME_SCREEN_SIZE = { x: 1024, y: 768 }
let sessingPlayerName;
let sessionPlayerUserID;
let sessionPlayingAppName;
{
sessionPlayerName = sessionStorage.getItem("playerName");
console.log("playerName : " + sessionPlayerName);
sessionPlayerUserID = sessionStorage.getItem("playerUserID");
console.log("playerUserID : " + sessionPlayerUserID);
sessionPlayingAppName = sessionStorage.getItem("playingAppName");
console.log("sessionPlayingAppName : " + sessionPlayingAppName);
}
let textStyleBasic = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
let appInfoManager = new AppInfoManager();
let backButtonPosition = { x: 100, y: 70 };
let textStyleBasic = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
+37
View File
@@ -0,0 +1,37 @@
class AppInfo {
constructor(name, nameKorean) {
this.name = name;
this.nameKorean = nameKorean;
this.isActivated = false;
}
}
class AppInfoManager {
constructor() {
this.appInfoMap = new Map();
this.registerAppInfoList();
}
registerAppInfoList() {
this.registerAppInfo(new AppInfo("login", "로그인"));
this.registerAppInfo(new AppInfo("menu", "메뉴"));
this.registerAppInfo(new AppInfo("test", "테스트"));
this.registerAppInfo(new AppInfo("space_invaders", "외계인 침공"));
this.registerAppInfo(new AppInfo("card_matching", "카드 짝 맞추기"));
}
registerAppInfo(appInfo) {
this.appInfoMap[appInfo.name] = appInfo;
}
getAppNameKorean(name) {
return this.appInfoMap[name].nameKorean;
}
}
+6
View File
@@ -12,6 +12,10 @@ let Login = {
create: function() {
self = this;
sessionStorage.removeItem("playerName");
sessionStorage.removeItem("playerUserID");
sessionStorage.removeItem("playingAppName");
this.game.stage.backgroundColor = '#4d4d4d';
// let phaser = game.add.image(game.world.centerX, game.world.centerY, 'phaser');
@@ -133,8 +137,10 @@ let Login = {
sessionStorage.setItem("playerName", sessionPlayerName);
sessionStorage.setItem("playerUserID", sessionPlayerUserID);
sessionStorage.setItem("playingAppName", "menu");
console.log("playerName : " + sessionStorage.getItem("playerName"));
console.log("playerUserID : " + sessionStorage.getItem("playerUserID"));
console.log("playingAppName : " + sessionStorage.getItem("playingAppName"));
location.href = '../../web/client/menu_app.html';
},
+5 -1
View File
@@ -14,6 +14,7 @@ let MenuApp = {
let backButton = new BackButton( () => {
sessionStorage.removeItem("playerName");
sessionStorage.removeItem("playerUserID");
sessionStorage.removeItem("playingAppName");
location.href = '../../web/client/login.html';
});
@@ -24,6 +25,9 @@ let MenuApp = {
// app icons
let space_invaders = new AppButton(AppButton.TYPE_MOUSE, "icon_fullscreen",
() => {
sessionPlayingAppName = "space_invaders";
sessionStorage.setItem("playingAppName", sessionPlayingAppName);
location.href = '../../web/client/start.html';
}
);
@@ -41,7 +45,7 @@ let MenuApp = {
let screenBottom = new ScreenBottom(game);
screenBottom.makeBottomLine();
// screenBottom.printBottomLeftText("게임 진행 정보");
screenBottom.printBottomCenterText("메뉴");
screenBottom.printBottomCenterText(appInfoManager.getAppNameKorean(sessionPlayingAppName));
screenBottom.printBottomRightText(sessionPlayerName);
// this.loadTypingStageData();
+1 -1
View File
@@ -26,7 +26,7 @@ let Start = {
let screenBottom = new ScreenBottom(game);
screenBottom.makeBottomLine();
// screenBottom.printBottomLeftText("게임 진행 정보");
screenBottom.printBottomCenterText("Game name");
screenBottom.printBottomCenterText(appInfoManager.getAppNameKorean(sessionPlayingAppName));
screenBottom.printBottomRightText(sessionPlayerName);
// this.loadTypingStageData();
+4 -2
View File
@@ -6,10 +6,12 @@
<!-- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script> -->
<script src="../../../resources/js/phaser.min.js"></script>
<!-- global source files -->
<script src="../../game/global/define_variables_global.js"></script>
<script src="../../game/lib/app_info_manager.js"></script>
<script src="../../game/global/global_variables.js"></script>
<!-- library source files -->
<script src="../../game/lib/input_type_text.js"></script>
+4 -2
View File
@@ -6,10 +6,12 @@
<!-- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script> -->
<script src="../../../resources/js/phaser.min.js"></script>
<!-- global source files -->
<script src="../../game/global/define_variables_global.js"></script>
<script src="../../game/lib/app_info_manager.js"></script>
<script src="../../game/global/global_variables.js"></script>
<!-- library source files -->
<script src="../../game/lib/input_type_text.js"></script>
+4 -3
View File
@@ -6,11 +6,12 @@
<!-- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script> -->
<script src="../../../resources/js/phaser.min.js"></script>
<!-- global source files -->
<script src="../../game/global/define_variables_global.js"></script>
<script src="../../game/global/loading/loading.js"></script>
<script src="../../game/lib/app_info_manager.js"></script>
<script src="../../game/global/global_variables.js"></script>
<!-- Space Invaders : source files -->
<script src="../../game/mouse/space_invaders/define_variables.js"></script>
+4 -2
View File
@@ -6,10 +6,12 @@
<!-- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script> -->
<script src="../../../resources/js/phaser.min.js"></script>
<!-- global source files -->
<script src="../../game/global/define_variables_global.js"></script>
<script src="../../game/lib/app_info_manager.js"></script>
<script src="../../game/global/global_variables.js"></script>
<!-- library source files -->
<script src="../../game/lib/input_type_text.js"></script>
+16
View File
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>QUnit Example</title>
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.6.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="https://code.jquery.com/qunit/qunit-2.6.0.js"></script>
<script src="../src/game/lib/app_info_manager.js"></script>
<script src="test_app_info_manager.js"></script>
</body>
</html>
+7
View File
@@ -0,0 +1,7 @@
let appInfoManager = new AppInfoManager();
QUnit.test( "GetAppID", function( assert ) {
assert.equal(appInfoManager.getAppNameKorean("test"), "테스트", "test");
assert.equal(appInfoManager.getAppNameKorean("space_invaders"), "외계인 침공", "space invaders");
assert.equal(appInfoManager.getAppNameKorean("card_matching"), "카드 짝 맞추기", "card matching");
});