From 37ba3a2eebe5d607b17b3cb250eb5d55e3c9cffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Wed, 11 Dec 2019 11:32:17 +0900 Subject: [PATCH] Fix: wait and serve meats by waiter --- src/game/mouse/grilled_meat/game.js | 28 ++++++++++++---------- src/game/mouse/grilled_meat/meat_base.js | 24 ++++++++++++++----- src/game/mouse/grilled_meat/normal_meat.js | 22 ++++++++--------- src/game/mouse/grilled_meat/waiter.js | 8 +++---- 4 files changed, 49 insertions(+), 33 deletions(-) diff --git a/src/game/mouse/grilled_meat/game.js b/src/game/mouse/grilled_meat/game.js index 072f9ee..5988320 100644 --- a/src/game/mouse/grilled_meat/game.js +++ b/src/game/mouse/grilled_meat/game.js @@ -148,6 +148,10 @@ var Game = { this.heatPlate.onChangeDialLevel(dialLevel); }, + setClickEnable: function(value) { + this.isEnableClick = value; + }, + back: function() { sessionStorageManager.resetPlayingAppData(); location.href = '../../web/client/main_menu.html'; @@ -188,6 +192,7 @@ var Game = { this.playingStageNo = 1; this.clearedMeatCount = 0; this.badMeatCount = 0; + this.badMeatCountPrevStage = 0; this.startStage(); this.realtimeStageTimer.start(); @@ -195,30 +200,29 @@ var Game = { startStage: function() { this.clearedMeatCount = 0; - this.activatedMeatCount = this.getStageMeatCount(); - this.serveNormalMeats(); + this.activatedMeatCount = this.playingStageNo + 2; - this.serveBonusMeat(); + this.badMeatCountPrevStage = this.badMeatCount; this.badMeatCount = 0; - if(this.playingStageNo > 1) + if(this.playingStageNo > 1) { this.waiter.animateServing(); + game.time.events.add(Waiter.SERVING_WAIT_TIME_MS, this.serveMeats, this); + } else { + this.serveMeats(); + } }, - setClickEnable: function(value) { - this.isEnableClick = value; - }, - - getStageMeatCount: function() { - this.activatedMeatCount = this.playingStageNo + 2; - return this.activatedMeatCount; + serveMeats: function() { + this.serveBonusMeat(); + this.serveNormalMeats(); }, serveBonusMeat: function() { if(this.playingStageNo == 1) return; - if(this.badMeatCount > 0) + if(this.badMeatCountPrevStage > 0) return; if(this.bonusMeat.isActivate()) diff --git a/src/game/mouse/grilled_meat/meat_base.js b/src/game/mouse/grilled_meat/meat_base.js index 26c8738..e29d422 100644 --- a/src/game/mouse/grilled_meat/meat_base.js +++ b/src/game/mouse/grilled_meat/meat_base.js @@ -34,15 +34,10 @@ MeatBase.prototype.update = function() { MeatBase.prototype.initMeatTypeVariables = function() { - this.cookingSpeed = 0.0; + this.className = "MeatBase"; this.baseScale = 0.5; - this.className = "MeatBase"; -} - - -MeatBase.prototype.initMeatTypeVariables = function() { this.cookingSide = MeatBase.MEAT_NONE; this.cookingTime = []; this.cookingGrade = []; @@ -60,6 +55,23 @@ MeatBase.prototype.initMeatTypeVariables = function() { this.spriteNameRare = ""; this.spriteNameWelldone = ""; this.spriteNameBurnBlack = ""; + + this.initCookingSpeedArray(); + this.initScoreArray(); +} + +MeatBase.prototype.initCookingSpeedArray = function() { + this.cookingSpeedArray = []; + this.cookingSpeedArray[HeatPlate.BURN_LEVEL_WEAK] = 1; + this.cookingSpeedArray[HeatPlate.BURN_LEVEL_NORMAL] = 2; + this.cookingSpeedArray[HeatPlate.BURN_LEVEL_STRONG] = 3; +} + +MeatBase.prototype.initScoreArray = function() { + this.scoreArray = []; + this.scoreArray[MeatBase.DONENESS_RARE] = 0; + this.scoreArray[MeatBase.DONENESS_WELLDONE] = 0; + this.scoreArray[MeatBase.DONENESS_BURN_BLACK] = 0; } MeatBase.prototype.initMouseEventHandler = function() { diff --git a/src/game/mouse/grilled_meat/normal_meat.js b/src/game/mouse/grilled_meat/normal_meat.js index 4a899cb..0be9abd 100644 --- a/src/game/mouse/grilled_meat/normal_meat.js +++ b/src/game/mouse/grilled_meat/normal_meat.js @@ -15,15 +15,15 @@ function NormalMeat(mainGame) { NormalMeat.prototype.setNormalMeatTypeVariables = function() { this.className = NormalMeat.CLASS_NAME; - this.cookingSpeedArray = []; - this.cookingSpeedArray[HeatPlate.BURN_LEVEL_WEAK] = NormalMeat.COOKING_SPEED_BURN_LEVEL_WEAK; - this.cookingSpeedArray[HeatPlate.BURN_LEVEL_NORMAL] = NormalMeat.COOKING_SPEED_BURN_LEVEL_NORMAL; - this.cookingSpeedArray[HeatPlate.BURN_LEVEL_STRONG] = NormalMeat.COOKING_SPEED_BURN_LEVEL_STRONG; + // this.cookingSpeedArray = []; + this.cookingSpeedArray[HeatPlate.BURN_LEVEL_WEAK] = NormalMeat.COOKING_SPEED_BURN_LEVEL_WEAK; + this.cookingSpeedArray[HeatPlate.BURN_LEVEL_NORMAL] = NormalMeat.COOKING_SPEED_BURN_LEVEL_NORMAL; + this.cookingSpeedArray[HeatPlate.BURN_LEVEL_STRONG] = NormalMeat.COOKING_SPEED_BURN_LEVEL_STRONG; - this.scoreArray = []; - this.scoreArray[MeatBase.DONENESS_RARE] = NormalMeat.SCORE_NAME_RARE; - this.scoreArray[MeatBase.DONENESS_WELLDONE] = NormalMeat.SCORE_NAME_WELLDONE; - this.scoreArray[MeatBase.DONENESS_BURN_BLACK] = NormalMeat.SCORE_NAME_BURN_BLACK; + // this.scoreArray = []; + this.scoreArray[MeatBase.DONENESS_RARE] = NormalMeat.SCORE_NAME_RARE; + this.scoreArray[MeatBase.DONENESS_WELLDONE] = NormalMeat.SCORE_WELLDONE; + this.scoreArray[MeatBase.DONENESS_BURN_BLACK] = NormalMeat.SCORE_BURN_BLACK; } NormalMeat.prototype.randomizeMeatType = function() { @@ -61,9 +61,9 @@ NormalMeat.COOKING_SPEED_BURN_LEVEL_WEAK = 0.1; NormalMeat.COOKING_SPEED_BURN_LEVEL_NORMAL = 0.2; NormalMeat.COOKING_SPEED_BURN_LEVEL_STRONG = 0.3; -NormalMeat.SCORE_NAME_RARE = 1; -NormalMeat.SCORE_NAME_WELLDONE = 2; -NormalMeat.SCORE_NAME_BURN_BLACK = 1; +NormalMeat.SCORE_RARE = 1; +NormalMeat.SCORE_WELLDONE = 2; +NormalMeat.SCORE_BURN_BLACK = 1; NormalMeat.SPRITE_NAME_RARE = "meat"; NormalMeat.SPRITE_NAME_WELLDONE = "meat_welldone"; diff --git a/src/game/mouse/grilled_meat/waiter.js b/src/game/mouse/grilled_meat/waiter.js index 803e2ad..b994042 100644 --- a/src/game/mouse/grilled_meat/waiter.js +++ b/src/game/mouse/grilled_meat/waiter.js @@ -25,7 +25,7 @@ Waiter.prototype.animateServing = function() { this.x = Waiter.POSITION_X; this.show(); var tween = game.add.tween(this); - tween.to({x:200}, 300, Phaser.Easing.Linear.In, true, 0); + tween.to({x:200}, Waiter.SERVING_WAIT_TIME_MS, Phaser.Easing.Linear.In, true, 0); // tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Elastic.InOut, true, 0, 2, true); // tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0); // tween.onComplete.add(this.smileAgain, this); @@ -47,7 +47,7 @@ Waiter.prototype.show = function() { } - - Waiter.POSITION_X = -150; -Waiter.POSITION_Y = 340; \ No newline at end of file +Waiter.POSITION_Y = 340; + +Waiter.SERVING_WAIT_TIME_MS = 300; \ No newline at end of file