diff --git a/resources/image/object/grilled_meat/meat_bonus.png b/resources/image/object/grilled_meat/meat_bonus.png new file mode 100644 index 0000000..768705b Binary files /dev/null and b/resources/image/object/grilled_meat/meat_bonus.png differ diff --git a/resources/image/object/grilled_meat/meat_bonus_burn.png b/resources/image/object/grilled_meat/meat_bonus_burn.png new file mode 100644 index 0000000..2b47d05 Binary files /dev/null and b/resources/image/object/grilled_meat/meat_bonus_burn.png differ diff --git a/resources/image/object/grilled_meat/meat_bonus_welldone.png b/resources/image/object/grilled_meat/meat_bonus_welldone.png new file mode 100644 index 0000000..8c135d9 Binary files /dev/null and b/resources/image/object/grilled_meat/meat_bonus_welldone.png differ diff --git a/src/game/mouse/grilled_meat/loading.js b/src/game/mouse/grilled_meat/loading.js index e5bc34f..d054224 100644 --- a/src/game/mouse/grilled_meat/loading.js +++ b/src/game/mouse/grilled_meat/loading.js @@ -36,12 +36,15 @@ var Loading = { game.load.image('meat1', '../../../resources/image/object/grilled_meat/meat1.png'); game.load.image('meat2', '../../../resources/image/object/grilled_meat/meat2.png'); game.load.image('meat3', '../../../resources/image/object/grilled_meat/meat3.png'); + game.load.image('meatBonus', '../../../resources/image/object/grilled_meat/meat_bonus.png'); game.load.image('meatWellDone1', '../../../resources/image/object/grilled_meat/meat1_welldone.png'); game.load.image('meatWellDone2', '../../../resources/image/object/grilled_meat/meat2_welldone.png'); game.load.image('meatWellDone3', '../../../resources/image/object/grilled_meat/meat3_welldone.png'); + game.load.image('meatBonusWellDone', '../../../resources/image/object/grilled_meat/meat_bonus_welldone.png'); game.load.image('meatBurn1', '../../../resources/image/object/grilled_meat/meat1_burn.png'); game.load.image('meatBurn2', '../../../resources/image/object/grilled_meat/meat2_burn.png'); game.load.image('meatBurn3', '../../../resources/image/object/grilled_meat/meat3_burn.png'); + game.load.image('meatBonusBurn', '../../../resources/image/object/grilled_meat/meat_bonus_burn.png'); game.load.image('smoke', '../../../resources/image/ui/smoke.png'); diff --git a/src/game/mouse/just_on_time/just_on_time.js b/src/game/mouse/just_on_time/just_on_time.js new file mode 100644 index 0000000..8c3a613 --- /dev/null +++ b/src/game/mouse/just_on_time/just_on_time.js @@ -0,0 +1,175 @@ +JustOnTime.prototype = Object.create(Phaser.State.prototype); +JustOnTime.constructor = JustOnTime; + +function JustOnTime() { +} + +JustOnTime.prototype.preload = function() { + game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png'); + + game.load.script('webfont', '//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js'); +} + +JustOnTime.prototype.create = function() { + this.dbConnectManager = new DBConnectManager(); + sessionStorageManager.setRecord(0); + + this.game.stage.backgroundColor = "#000000"; // '#4d4d4d'; + + sessionStorageManager.setIsNewAppHighestRecord(false); + + var experienceAppTimer = new ExperienceAppTimer(); + experienceAppTimer.setTimeOverListener( + (function() { this.timeOver(); }).bind(this) + ); + + // keyboard shortcut + this.keyboardShortcut = new KeyboardShortcut(); + this.keyboardShortcut.addCallback( + Phaser.KeyCode.ESC, // keyCode + null, // keyDownHandler + (function() { this.back(); }).bind(this), // keyUpHandler + "card matching" // callerClassName + ); + + // 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) + ); + + this.stageTimer = new StageTimer( + JustOnTime.GAME_TIME_SEC, + (function() { + this.setClickEnable(false); + + this.timeOver(); + }).bind(this) + ); + + this.initVariables(); + + + // game stage + game.stage.backgroundColor = '#4d4d4d'; + graphics = game.add.graphics(0, 0); + + + // bottom ui + var screenBottomUI = new ScreenBottomUI(); + screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord()); + screenBottomUI.printCenterText(sessionStorageManager.getPlayingAppKoreanName()); + screenBottomUI.printRightText(sessionStorageManager.getPlayerName()); + + + // // this.countDown(); +} + +JustOnTime.prototype.initVariables = function() { +} + +JustOnTime.prototype.fontLoaded = function() { + + this.leftTimerStage = new TimerStage( + JustOnTime.TIMER_STAGE_POS_X, JustOnTime.TIMER_STAGE_POS_Y + ); + this.rightTimerStage = new TimerStage( + GAME_SCREEN_SIZE.x - JustOnTime.TIMER_STAGE_POS_X, JustOnTime.TIMER_STAGE_POS_Y + ); + + // this.startGame(); +} + +JustOnTime.prototype.back = function() { + sessionStorageManager.resetPlayingAppData(); + location.href = '../../web/client/main_menu.html'; +} + +/* +JustOnTime.prototype.countDown = function() { + var style = { font: "bold 200px Arial", fill: "#fff", boundsAlignH: "center", boundsAlignV: "middle" }; + this.countDownText = game.add.text(0, 0, "", style); + this.countDownText.setTextBounds(0, 0, game.world.width, game.world.height); + this.countDownText.stroke = "#333"; + this.countDownText.strokeThickness = 50; + + this.countDownNumber = 3; + if(isDebugMode()) + this.countDownNumber = 1; + this.tweenCountDown(); +} + +JustOnTime.prototype.tweenCountDown = function() { + if(this.countDownNumber === 0) { + this.startGame(); + return; + } + + this.countDownText.text = this.countDownNumber.toString(); + this.countDownText.alpha = 1; + + var countDownTween = game.add.tween(this.countDownText); + countDownTween.to( { alpha: 0 }, 1000, Phaser.Easing.Linear.None, true); + countDownTween.onComplete.add(this.tweenCountDown, this); + + this.countDownNumber--; +} +*/ + +JustOnTime.prototype.startGame = function() { + this.stageTimer.start(); +} + + + +JustOnTime.prototype.timeOver = function() { + var timeOverText = new TimeOverText(); + if(!isExperienceMaestroAccount()) + this.updateResultRecord(); + + // game.time.events.remove(this.timeEvent); + + for(var i = 0; i < this.gameTimeEvents.length; i++) { + game.time.events.remove(this.gameTimeEvents[i]); + } + this.gameTimeEvents = []; + + game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this); +} + +JustOnTime.prototype.updateResultRecord = function() { + if(sessionStorageManager.getMaestroAccountType() < 100) { // experience account + this.dbConnectManager.updateResultRecord( + sessionStorageManager.getMaestroID(), + sessionStorageManager.getPlayerID(), + sessionStorageManager.getPlayingAppID(), + sessionStorageManager.getRecord() + ); + } +} + +JustOnTime.prototype.goResult = function() { + location.href = '../../web/client/result.html'; +} + + + +JustOnTime.GAME_TIME_SEC = 60; +JustOnTime.TIMER_STAGE_POS_X = 300; +JustOnTime.TIMER_STAGE_POS_Y = 200; diff --git a/src/game/mouse/just_on_time/loading.js b/src/game/mouse/just_on_time/loading.js new file mode 100644 index 0000000..e66674f --- /dev/null +++ b/src/game/mouse/just_on_time/loading.js @@ -0,0 +1,66 @@ +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.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('Game'); + return; + } + + this.state.start('Game'); + // this.startMenu(); + // this.startTypingTestStage(); + // this.startTypingTestResult(); + } +} diff --git a/src/game/mouse/just_on_time/main.js b/src/game/mouse/just_on_time/main.js new file mode 100644 index 0000000..c4b878e --- /dev/null +++ b/src/game/mouse/just_on_time/main.js @@ -0,0 +1,39 @@ +///////////////////////////// +// Main game + +var CONTENT_ID = "Just on time"; + +var game = new Phaser.Game( + GAME_SCREEN_SIZE.x, GAME_SCREEN_SIZE.y, + Phaser.CANVAS, CONTENT_ID, + this, false, false +); + +WebFontConfig = { + // 'active' means all requested fonts have finished loading + // We set a 1 second delay before calling 'createText'. + // For some reason if we don't the browser cannot render the text the first time it's created. + active: function() { game.time.events.add(Phaser.Timer.SECOND * 0.1, fontLoaded, this); }, + + // The Google Fonts we want to load (specify as many as you like in the array) + google: { + families: [ + 'Orbitron:800', + 'Nanum Gothic:400, 700, 800', + 'Nanum Gothic Coding:400, 700', + // 'Nanum Brush Script', + // 'Nanum Pen Script' + ] + // families: ['Nanum Brush Script'] + } +}; + + +var justOnTime = new JustOnTime(); + +game.state.add('JustOnTime', justOnTime); +game.state.start('JustOnTime'); + +function fontLoaded() { + justOnTime.fontLoaded(); +} \ No newline at end of file diff --git a/src/game/mouse/just_on_time/time_score_record.js b/src/game/mouse/just_on_time/time_score_record.js new file mode 100644 index 0000000..c274f04 --- /dev/null +++ b/src/game/mouse/just_on_time/time_score_record.js @@ -0,0 +1,37 @@ +TimeScoreRecord.prototype = Object.create(Phaser.State.prototype); +TimeScoreRecord.constructor = TimeScoreRecord; + +function TimeScoreRecord(x, y) { + this.timeText = new TimerText(x + TimeScoreRecord.TIMER_OFFSET_X, y, 30); + this.scoreText = this.makeScoreText(x + TimeScoreRecord.SCORE_OFFSET_X, y); + + return this; +} + + +TimeScoreRecord.prototype.makeScoreText = function(x, y) { + var scoreText = game.add.text(x, y, ""); + scoreText.anchor.set(0, 0.5); + // scoreText.font = "Orbitron"; + scoreText.fontSize = 30; + scoreText.fontWeight = "bold"; // "normal"; + scoreText.style.fill = "white"; + scoreText.stroke = "#000000"; + scoreText.strokeThickness = 6; + scoreText.text = "3"; + + return scoreText; +} + +TimeScoreRecord.prototype.setContent = function(time, score) { + this.timeText.setText(time); + this.scoreText.text = score; +} + +TimeScoreRecord.prototype.setTextColorString = function(colorString) { + this.timeText.setTextColorString(colorString); + this.scoreText.style.fill = colorString; +} + +TimeScoreRecord.TIMER_OFFSET_X = -50; +TimeScoreRecord.SCORE_OFFSET_X = 90; \ No newline at end of file diff --git a/src/game/mouse/just_on_time/timer_stage.js b/src/game/mouse/just_on_time/timer_stage.js new file mode 100644 index 0000000..5f67f66 --- /dev/null +++ b/src/game/mouse/just_on_time/timer_stage.js @@ -0,0 +1,48 @@ +TimerStage.prototype = Object.create(Phaser.State.prototype); +TimerStage.constructor = TimerStage; + +function TimerStage(x, y) { + this.posX = x; + this.posY = y; + + this.mainTimerText = new TimerText(x, y, 60); + this.timerButton = this.makeTimeStopButton(x, y + TimerStage.BUTTON_OFFSET_Y); + this.timeScoreRecordArray = new Array(); + + this.makeTimeScoreRecordArray(); + + return this; +} + + +TimerStage.prototype.makeTimeStopButton = function(x, y) { + var setting = new RoundRectButtonSetting(x, y, 200, 100); + setting.fontStyle.fontWeight = "bold"; + + var timerButton = new RoundRectButton( + setting, + RoundRectButton.NONE_ICON, "시작", + (function() { this.buttonClicked(); }).bind(this) + ); + return timerButton; +} + +TimerStage.prototype.buttonClicked = function() { + this.mainTimerText.setText("02.00"); +} + +TimerStage.prototype.makeTimeScoreRecordArray = function() { + for(var i = 0; i < TimerStage.RECORD_COUNT; i++) { + var timeScoreRecord = new TimeScoreRecord( + this.posX, + this.posY + TimerStage.RECORD_OFFSET_Y + TimerStage.RECORD_GAP_Y * i + ); + this.timeScoreRecordArray.push(timeScoreRecord); + } +} + +TimerStage.BUTTON_OFFSET_Y = 100; + +TimerStage.RECORD_OFFSET_Y = 200; +TimerStage.RECORD_GAP_Y = 50; +TimerStage.RECORD_COUNT = 5; \ No newline at end of file diff --git a/src/game/mouse/just_on_time/timer_text.js b/src/game/mouse/just_on_time/timer_text.js new file mode 100644 index 0000000..7f16f03 --- /dev/null +++ b/src/game/mouse/just_on_time/timer_text.js @@ -0,0 +1,32 @@ +TimerText.prototype = Object.create(Phaser.State.prototype); +TimerText.constructor = TimerText; + +function TimerText(x, y, fontSize) { + this.digitText = this.makeTimerText(x, y, fontSize); + console.log(this.digitText); + + return this; +} + + +TimerText.prototype.makeTimerText = function(x, y, fontSize) { + var digitText = game.add.text(x, y, ""); + digitText.anchor.set(0.5, 0.5); + digitText.font = "Orbitron"; + digitText.fontSize = fontSize; + digitText.fontWeight = "bold"; // "normal"; + digitText.style.fill = "white"; + digitText.stroke = "#000000"; + digitText.strokeThickness = 6; + digitText.text = "03.00"; + + return digitText; +} + +TimerText.prototype.setText = function(contents) { + this.digitText.text = contents; +} + +TimerText.prototype.setTextColorString = function(colorString) { + this.digitText.style.fill = colorString; +} diff --git a/src/web/client/just_on_time.html b/src/web/client/just_on_time.html new file mode 100644 index 0000000..c7f3365 --- /dev/null +++ b/src/web/client/just_on_time.html @@ -0,0 +1,98 @@ + + +
+ + + + + + + + + + + +