diff --git a/src/game/lib/heart_gauge.js b/src/game/lib/heart_gauge.js index 5a26bd0..4084fcd 100644 --- a/src/game/lib/heart_gauge.js +++ b/src/game/lib/heart_gauge.js @@ -45,5 +45,10 @@ HeartGauge.prototype.updateHearts = function() { } } +HeartGauge.loadResources = function() { + game.load.image('heart_full', '../../../resources/image/ui/heart_full.png'); + game.load.image('heart_empty', '../../../resources/image/ui/heart_empty.png'); +} + HeartGauge.GAP = 35; HeartGauge.HEART_SCALE = 0.6; \ No newline at end of file diff --git a/src/game/typing/word_flyingsaucer/game.js b/src/game/typing/word_flyingsaucer/game.js new file mode 100644 index 0000000..f5dc5f8 --- /dev/null +++ b/src/game/typing/word_flyingsaucer/game.js @@ -0,0 +1,96 @@ +var WordFlyingSaucer = { + + create: function() { + this.dbConnectManager = new DBConnectManager(); + sessionStorageManager.setRecord(0); + + sessionStorageManager.setIsNewAppHighestRecord(false); + + var experienceAppTimer = new ExperienceAppTimer(); + experienceAppTimer.setTimeOverListener( + (function() { this.timeOver(); }).bind(this) + ); + + game.stage.backgroundColor = '#4d4d4d'; + + // top ui + var screenTopUI = new ScreenTopUI(); + screenTopUI.makeBackButton( (function() { this.back(); }).bind(this) ); + screenTopUI.makeFullScreenButton(); + + + this.scoreManager = new ScoreManager(); + this.scoreBoard = new ScoreBoard(); + this.scoreManager.addOnChangeScoreListener( + (function(score) { + sessionStorageManager.setRecord(score); + this.scoreBoard.printScore(NumberUtil.numberWithCommas(score)); + }).bind(this) + ); + this.scoreManager.addOnChangeHighScoreListener( + (function(highScore) { + console.log(highScore); + // sessionStorageManager.setAppHighestRecord(highScore); + sessionStorageManager.setIsNewBestRecrd(true); + // this.screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord()); + }).bind(this) + ); + + var heartManager = new HeartManager(); + var heartGauge = new HeartGauge(heartManager); + heartManager.addOnChangeGameOverListener( + (function() { this.gameOver(); }).bind(this) + ); + heartGauge.start(); + + + + + + // bottom ui + this.screenBottomUI = new ScreenBottomUI(); + // screenBottomUI.printBottomUILeftText(""); + this.screenBottomUI.printCenterText(sessionStorageManager.getPlayingAppKoreanName()); + this.screenBottomUI.printRightText(sessionStorageManager.getPlayerName()); + + + // this.startGame(); + }, + + + back: function() { + sessionStorageManager.resetPlayingAppData(); + location.href = '../../web/client/menu_app.html'; + }, + + startGame: function() { + }, + + timeOver: function() { + var timeOverText = new TimeOverText(); + + sessionStorageManager.setRecord(this.scoreManager.getScore()); + if(!isExperienceMaestroAccount()) + this.updateResultRecord(); + + game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this); + }, + + updateResultRecord: function() { + if(sessionStorageManager.getMaestroAccountType() < 100) { // experience account + this.dbConnectManager.updateResultRecord( + sessionStorageManager.getMaestroID(), + sessionStorageManager.getPlayerID(), + sessionStorageManager.getPlayingAppID(), + sessionStorageManager.getRecord() + ); + } + }, + + goResult: function() { + location.href = '../../web/client/result.html'; + }, + +} + + diff --git a/src/game/typing/word_flyingsaucer/loading.js b/src/game/typing/word_flyingsaucer/loading.js new file mode 100644 index 0000000..51c74cc --- /dev/null +++ b/src/game/typing/word_flyingsaucer/loading.js @@ -0,0 +1,94 @@ +var Loading = { + + preload: function() { + // game.load.image('loadingbar', './image/phaser.png'); + }, + + create: function() { + // var userID = sessionStorage.getItem("UserID"); + // console.log("userID : " + userID); + + // game.stage.backgroundColor = '#4d4d4d'; + + // // Progress report + // this.textProgress = game.add.text(game.world.centerX, 100, '로딩중 . . .', textStyleBasic); + // this.textProgress.anchor.setTo(0.5, 0.4); + // this.textProgress.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); + + // // Preload bar + // this.preloadBar = this.add.sprite(game.world.centerX, game.world.centerY, 'loadingbar'); + // this.preloadBar.anchor.setTo(0.5); + // this.preloadBar.alpha = 0; + + game.load.onFileComplete.add(this.fileComplete, this); + game.load.onLoadComplete.add(this.loadComplete, this); + + this.startLoading(); + }, + + startLoading: function() { + game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png'); + + game.load.image('star', '../../../resources/image/ui/star_particle.png'); + + HeartGauge.loadResources(); + + // game.load.image('hand_left', '../../../resources/image/ui/hand_left.png'); + // game.load.image('hand_right', '../../../resources/image/ui/hand_right.png'); + // game.load.image('a', '../../../resources/image/icon/fullscreen_white.png'); + // game.load.image('b', '../../../resources/image/icon/fullscreen_white.png'); + // game.load.image('c', '../../../resources/image/icon/fullscreen_white.png'); + // game.load.image('d', '../../../resources/image/icon/fullscreen_white.png'); + // game.load.image('a', './image/phaser.png'); + // game.load.image('b', './image/phaser.png'); + // game.load.image('c', './image/phaser.png'); + // game.load.image('d', './image/phaser.png'); + // game.load.image('e', './image/phaser.png'); + // game.load.image('g', './image/phaser.png'); + // game.load.image('e', './image/phaser.png'); + // game.load.image('f', './image/phaser.png'); + // game.load.image('g', './image/phaser.png'); + // game.load.image('h', './image/phaser.png'); + + // game.load.image('phaser', './image/phaser.png'); + // game.load.spritesheet('button', './image/button_basic.png', 200, 100); + // game.load.image('star', './image/star_particle.png'); + // game.load.image('medal_gold', './image/medal_gold.png'); + // game.load.image('medal_silver', './image/medal_silver.png'); + // game.load.image('medal_bronze', './image/medal_bronze.png'); + + game.load.start(); + }, + + fileComplete: function(progress, cacheKey, success, totalLoaded, totalFiles) { + // this.preloadBar.alpha = progress / 100; + + // console.log('progress : ' + progress); + + // text.setText("File Complete: " + progress + "% - " + totalLoaded + " out of " + totalFiles); + + // var newImage = game.add.image(x, y, cacheKey); + // newImage.scale.set(0.3); + + // x += newImage.width + 20; + // if (x > 700) + // { + // x = 32; + // y += 332; + // } + }, + + loadComplete: function(progress, cacheKey, success, totalLoaded, totalFiles) { + // this.preloadBar.alpha = 1; + + if(isDebugMode()) { + this.state.start('WordFlyingSaucer'); + return; + } + + this.state.start('WordFlyingSaucer'); + // this.startMenu(); + // this.startTypingTestStage(); + // this.startTypingTestResult(); + } +} diff --git a/src/game/typing/word_flyingsaucer/main.js b/src/game/typing/word_flyingsaucer/main.js new file mode 100644 index 0000000..ed9f754e --- /dev/null +++ b/src/game/typing/word_flyingsaucer/main.js @@ -0,0 +1,16 @@ +///////////////////////////// +// Main game + +var CONTENT_ID = "WordFlyingSaucer"; + +var game = new Phaser.Game( + GAME_SCREEN_SIZE.x, GAME_SCREEN_SIZE.y, + Phaser.CANVAS, CONTENT_ID, + this, false, false +); + +game.state.add('Loading', Loading); +game.state.start('Loading'); + +game.state.add('WordFlyingSaucer', WordFlyingSaucer); +// game.state.add('Menu', Menu); diff --git a/src/game/typing/word_flyingsaucer/typing_score.js b/src/game/typing/word_flyingsaucer/typing_score.js new file mode 100644 index 0000000..70c8172 --- /dev/null +++ b/src/game/typing/word_flyingsaucer/typing_score.js @@ -0,0 +1,54 @@ +function TypingScore() { + this.typingCount = 0; + + var fontStyle = TypingScore.DEFAULT_TEXT_FONT; + + fontStyle.align = "right"; + fontStyle.boundsAlignH = "right"; + this.scoreTitleText = game.add.text(game.world.width / 2 - 40, TypingScore.SCORE_POS_Y, "연속 성공 타수 : ", fontStyle) + this.scoreTitleText.anchor.set(0.5); + + fontStyle.align = "left"; + fontStyle.boundsAlignH = "left"; + this.scoreText = game.add.text(game.world.width / 2 + 100, TypingScore.SCORE_POS_Y, "0", fontStyle) + this.scoreText.anchor.set(0.5); + + // var grd = this.scoreText.context.createLinearGradient(0, 0, 0, TypingScore.SCORE_POS_Y); + // grd.addColorStop(0, '#8ED6FF'); + // grd.addColorStop(1, '#004CB3'); + // this.scoreText.fill = grd; + // this.scoreText.fill = grd; + + // this.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); + // this.scoreText.stroke = '#000'; + // this.scoreText.strokeThickness = 3; +}; + +TypingScore.prototype.score = function() { + return this.typingCount; +} + +TypingScore.prototype.increase = function() { + this.typingCount++; + this.print(this.typingCount); +} + +TypingScore.prototype.reset = function() { + this.typingCount = 0; + this.print(this.typingCount); +} + +TypingScore.prototype.print = function(typingCount) { + this.scoreText.text = typingCount; +} + + +TypingScore.SCORE_POS_Y = 35; + +TypingScore.DEFAULT_TEXT_FONT = { +font: "38px Arial", +align: "center", +boundsAlignH: "center", // left, center. right +boundsAlignV: "middle", // top, middle, bottom +fill: "#fff" +}; \ No newline at end of file diff --git a/src/web/client/word_flyingsaucer.html b/src/web/client/word_flyingsaucer.html new file mode 100644 index 0000000..1eccbe0 --- /dev/null +++ b/src/web/client/word_flyingsaucer.html @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + 격추! 비행접시 | 초코마에 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ 앱이 실행되지 않으면, 브라우저의 새로 고침 버튼( , 단축키 : Ctrl + R)을 눌러주세요.
+ (그래도 실행되지 않을때에는, Ctrl + Shift + R 을 눌러서 브라우저 캐시 삭제를 실행해 주세요) +
+ + \ No newline at end of file diff --git a/src/web/sql/insert_app.sql b/src/web/sql/insert_app.sql index 8805fb7..ea40f70 100644 --- a/src/web/sql/insert_app.sql +++ b/src/web/sql/insert_app.sql @@ -40,6 +40,8 @@ INSERT INTO `app` (`AppID`, `AppName`, `KoreanName`, `AppType`, `Status`, `HowTo (40, 'test_english_sentence', 'Sentence test', 12, 1, '문장을 빠르게 입력하세요.'), (50, 'typing_korean_whac_a_mole', '두더지 타자', 50, 0, '두더지가 나온 키의 글자를\\n정확하고 빠르게 눌러서 잡으세요.\\n(한글)'), (51, 'typing_english_whac_a_mole', 'Whac A Mole', 50, 0, '두더지가 나온 키의 글자를\\n정확하고 빠르게 눌러서 잡으세요.\\n(영문)'), +(52, 'typing_korean_word_flyingsaurce', '단어 비행접시', 50, 0, '비행접시에 있는 글자를 빨리 입력해서,\\n외계인의 침공을 막으세요.\\n(한글)'), +(53, 'typing_english_word_flyingsaurce', 'Word flyingsaucer', 50, 0, '비행접시에 있는 글자를 빨리 입력해서,\\n외계인의 침공을 막으세요.\\n(영문)'), (101, 'space_invaders', '외계인 침공', 100, 1, '외계인이 나타났다!\\n마우스 왼쪽 버튼을 클릭해서\\n외계인이 사라지기 전에 물리쳐 주세요.'), (102, 'card_matching', '카드 짝 맞추기', 100, 0, '같은 그림의 카드를 맞춰주세요.'); (103, 'grilled_meat', '고기 굽기', 100, 0, '고기를 드래그해서 불판에 울리고,\\n잘 익으면 클릭해서 뒤집어주세요.\\n맛있게 구워지면 할아버지한테 먹여주세요.');