Commit a6b83c15 authored by huangwenjie's avatar huangwenjie

y

parent 187d8fa1
...@@ -77,6 +77,13 @@ export enum SoundType { ...@@ -77,6 +77,13 @@ export enum SoundType {
showPanel = 'showPanel', showPanel = 'showPanel',
countDown = "countDown", countDown = "countDown",
speedUp = "speedUp", speedUp = "speedUp",
move = "move",
createEle = "createEle",
createEles = "createELes",
bomb = "bomb",
exchange = "exchange",
gameOver = "gameOver",
} }
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"name": "gameOverPanel" "name": "gameOverPanel"
}, },
{ {
"keys": "bomb(1).png,bomb(10).png,bomb(11).png,bomb(12).png,bomb(13).png,bomb(14).png,bomb(15).png,bomb(16).png,bomb(17).png,bomb(18).png,bomb(19).png,bomb(2).png,bomb(20).png,bomb(3).png,bomb(4).png,bomb(5).png,bomb(6).png,bomb(7).png,bomb(8).png,bomb(9).png,bombBtn.png,bombTips.png,create1024.svga,create128.svga,create16.svga,create2048.svga,create256.svga,create32.svga,create4.svga,create512.svga,create64.svga,create8.svga,doFilterBtn.png,ele1024.png,ele128.png,ele16.png,ele2.png,ele2048.png,ele256.png,ele32.png,ele4.png,ele512.png,ele64.png,ele8.png,exchangeBtn.png,exchangeTips.png,filterBtn.png,filterTips.png,filting (1).png,filting (10).png,filting (11).png,filting (12).png,filting (13).png,filting (14).png,filting (15).png,filting (16).png,filting (17).png,filting (2).png,filting (3).png,filting (4).png,filting (5).png,filting (6).png,filting (7).png,filting (8).png,filting (9).png,focusTips.png,goBackBtn.png,guideArrow.png,guideFinger.png,musicOff.png,musicOn.png,playBg.png,propBottom.png", "keys": "bomb(1).png,bomb(10).png,bomb(11).png,bomb(12).png,bomb(13).png,bomb(14).png,bomb(15).png,bomb(16).png,bomb(17).png,bomb(18).png,bomb(19).png,bomb(2).png,bomb(20).png,bomb(3).png,bomb(4).png,bomb(5).png,bomb(6).png,bomb(7).png,bomb(8).png,bomb(9).png,bomb.mp3,bombBtn.png,bombTips.png,create1024.svga,create128.svga,create16.svga,create2048.svga,create256.svga,create32.svga,create4.svga,create512.svga,create64.svga,create8.svga,createEle.mp3,createEles.mp3,doFilterBtn.png,ele1024.png,ele128.png,ele16.png,ele2.png,ele2048.png,ele256.png,ele32.png,ele4.png,ele512.png,ele64.png,ele8.png,exchange.mp3,exchangeBtn.png,exchangeTips.png,filterBtn.png,filterTips.png,filting (1).png,filting (10).png,filting (11).png,filting (12).png,filting (13).png,filting (14).png,filting (15).png,filting (16).png,filting (17).png,filting (2).png,filting (3).png,filting (4).png,filting (5).png,filting (6).png,filting (7).png,filting (8).png,filting (9).png,focusTips.png,gameOver.mp3,goBackBtn.png,guideArrow.png,guideFinger.png,move.mp3,musicOff.png,musicOn.png,playBg.png,propBottom.png",
"name": "playScene" "name": "playScene"
}, },
{ {
......
import { playSound, SoundType } from './../../../module/ctrls/soundCtrl';
export const noBlockLeft = (x, y, yl, beforeArr) => { export const noBlockLeft = (x, y, yl, beforeArr) => {
if (y > yl + 1) { if (y > yl + 1) {
for (let t = yl - 1; t < y; t++) { for (let t = yl - 1; t < y; t++) {
...@@ -68,4 +69,31 @@ export const noBlockBottom = (x, xb, y, beforeArr) => { ...@@ -68,4 +69,31 @@ export const noBlockBottom = (x, xb, y, beforeArr) => {
} }
} }
return true return true
}
export const checkMusic = (type, isPlay) => {
if (!isPlay) {
return
}
switch (type) {
case "move":
playSound(SoundType.move)
break
case "createEle":
playSound(SoundType.createEle)
break
case "createEles":
playSound(SoundType.createEles)
break
case "exchange":
playSound(SoundType.exchange)
break
case "bomb":
playSound(SoundType.bomb)
break
case "gameOver":
playSound(SoundType.gameOver)
break
}
} }
\ No newline at end of file
import { FrameAni } from './../../../engine/2d/ui/FrameAni'; import { FrameAni } from './../../../engine/2d/ui/FrameAni';
import { MovieClip } from './../../../engine/2d/svga/MovieClip'; import { MovieClip } from './../../../engine/2d/svga/MovieClip';
import { Shape } from './../../../engine/2d/graphics/Shape'; import { Shape } from './../../../engine/2d/graphics/Shape';
import { noBlockLeft, noBlockRight, noBlockTop, noBlockBottom } from './Check'; import { noBlockLeft, noBlockRight, noBlockTop, noBlockBottom, checkMusic } from './Check';
import { GDispatcher } from './../../../engine/2d/events/GDispatcher'; import { GDispatcher } from './../../../engine/2d/events/GDispatcher';
import { Button } from './../../../engine/2d/ui/Button'; import { Button } from './../../../engine/2d/ui/Button';
import { GameEle } from './GameEle'; import { GameEle } from './GameEle';
...@@ -13,11 +13,14 @@ import { Container, Sprite } from '../../../engine/2d/display'; ...@@ -13,11 +13,14 @@ import { Container, Sprite } from '../../../engine/2d/display';
import { Graphics } from '../../../engine/2d/graphics'; import { Graphics } from '../../../engine/2d/graphics';
import Tween from '../../../engine/tween/Tween'; import Tween from '../../../engine/tween/Tween';
import { RES } from '../../../module/RES'; import { RES } from '../../../module/RES';
import { getTools } from '../../commonNet'
export class PlayScene extends Scene { export class PlayScene extends Scene {
get groupNames() { return ["playScene"] } get groupNames() { return ["playScene"] }
constructor() { gameData
constructor(data) {
super() super()
this.gameData = data
} }
start() { start() {
...@@ -48,6 +51,8 @@ export class PlayScene extends Scene { ...@@ -48,6 +51,8 @@ export class PlayScene extends Scene {
return this._unlockScore return this._unlockScore
} }
isPlayMusic: boolean = true
bg: Sprite bg: Sprite
goBackBtn: Button goBackBtn: Button
musicBtn: Button musicBtn: Button
...@@ -372,6 +377,8 @@ export class PlayScene extends Scene { ...@@ -372,6 +377,8 @@ export class PlayScene extends Scene {
this.removeAnis() this.removeAnis()
checkMusic("exchange", this.isPlayMusic)
// 交换动效 // 交换动效
await this.exchangeAni() await this.exchangeAni()
// if (num0 == num1) { // if (num0 == num1) {
...@@ -398,6 +405,9 @@ export class PlayScene extends Scene { ...@@ -398,6 +405,9 @@ export class PlayScene extends Scene {
this.removeChild(this.exchangeMask) this.removeChild(this.exchangeMask)
this.removeAllClick() this.removeAllClick()
this.exchangeTargetPool = [] this.exchangeTargetPool = []
getTools()
this.exchanging = false this.exchanging = false
this.exchangeBtn.mouseEnable = true this.exchangeBtn.mouseEnable = true
if (!this.isGameWin()) if (!this.isGameWin())
...@@ -507,6 +517,8 @@ export class PlayScene extends Scene { ...@@ -507,6 +517,8 @@ export class PlayScene extends Scene {
showImage.scale.set(0.5, 0.5) showImage.scale.set(0.5, 0.5)
this.addChild(showImage); this.addChild(showImage);
showImage.play() showImage.play()
checkMusic("bomb", this.isPlayMusic)
setTimeout(() => { setTimeout(() => {
this.board[x][y] = 0 this.board[x][y] = 0
this.renderBoard() this.renderBoard()
...@@ -714,14 +726,17 @@ export class PlayScene extends Scene { ...@@ -714,14 +726,17 @@ export class PlayScene extends Scene {
// 只有0 // 只有0
this.generateOneElement() this.generateOneElement()
} }
this.moving = true this.moving = true
let beforeArr = this.cloneArr(this.board) let beforeArr = this.cloneArr(this.board)
if (Math.abs(this.offsetX) > Math.abs(this.offsetY)) { if (Math.abs(this.offsetX) > Math.abs(this.offsetY)) {
// 横向移动 // 横向移动
if (this.offsetX > 0) { if (this.offsetX > 0) {
console.log("右滑"); console.log("右滑");
// 复制一份原先的数组 // 复制一份原先的数组
if (this.moveToRight(true)) { if (this.moveToRight(true)) {
checkMusic("move", this.isPlayMusic)
await this.moveAni(beforeArr) await this.moveAni(beforeArr)
this.renderBoard() this.renderBoard()
this.generateOneElement() this.generateOneElement()
...@@ -732,6 +747,7 @@ export class PlayScene extends Scene { ...@@ -732,6 +747,7 @@ export class PlayScene extends Scene {
if (this.offsetX < 0) { if (this.offsetX < 0) {
console.log("左滑") console.log("左滑")
if (this.moveToLeft(true)) { if (this.moveToLeft(true)) {
checkMusic("move", this.isPlayMusic)
await this.moveAni(beforeArr) await this.moveAni(beforeArr)
this.renderBoard() this.renderBoard()
this.generateOneElement() this.generateOneElement()
...@@ -744,6 +760,7 @@ export class PlayScene extends Scene { ...@@ -744,6 +760,7 @@ export class PlayScene extends Scene {
if (this.offsetY > 0) { if (this.offsetY > 0) {
console.log("下滑") console.log("下滑")
if (this.moveToBottom(true)) { if (this.moveToBottom(true)) {
checkMusic("move", this.isPlayMusic)
await this.moveAni(beforeArr) await this.moveAni(beforeArr)
this.renderBoard() this.renderBoard()
this.generateOneElement() this.generateOneElement()
...@@ -754,6 +771,7 @@ export class PlayScene extends Scene { ...@@ -754,6 +771,7 @@ export class PlayScene extends Scene {
if (this.offsetY < 0) { if (this.offsetY < 0) {
console.log("上滑") console.log("上滑")
if (this.moveToTop(true)) { if (this.moveToTop(true)) {
checkMusic("move", this.isPlayMusic)
await this.moveAni(beforeArr) await this.moveAni(beforeArr)
this.renderBoard() this.renderBoard()
this.generateOneElement() this.generateOneElement()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment