Commit a6b83c15 authored by huangwenjie's avatar huangwenjie

y

parent 187d8fa1
......@@ -77,6 +77,13 @@ export enum SoundType {
showPanel = 'showPanel',
countDown = "countDown",
speedUp = "speedUp",
move = "move",
createEle = "createEle",
createEles = "createELes",
bomb = "bomb",
exchange = "exchange",
gameOver = "gameOver",
}
/**
......
......@@ -9,7 +9,7 @@
"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"
},
{
......
import { playSound, SoundType } from './../../../module/ctrls/soundCtrl';
export const noBlockLeft = (x, y, yl, beforeArr) => {
if (y > yl + 1) {
for (let t = yl - 1; t < y; t++) {
......@@ -69,3 +70,30 @@ export const noBlockBottom = (x, xb, y, beforeArr) => {
}
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 { MovieClip } from './../../../engine/2d/svga/MovieClip';
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 { Button } from './../../../engine/2d/ui/Button';
import { GameEle } from './GameEle';
......@@ -13,11 +13,14 @@ import { Container, Sprite } from '../../../engine/2d/display';
import { Graphics } from '../../../engine/2d/graphics';
import Tween from '../../../engine/tween/Tween';
import { RES } from '../../../module/RES';
import { getTools } from '../../commonNet'
export class PlayScene extends Scene {
get groupNames() { return ["playScene"] }
constructor() {
gameData
constructor(data) {
super()
this.gameData = data
}
start() {
......@@ -48,6 +51,8 @@ export class PlayScene extends Scene {
return this._unlockScore
}
isPlayMusic: boolean = true
bg: Sprite
goBackBtn: Button
musicBtn: Button
......@@ -372,6 +377,8 @@ export class PlayScene extends Scene {
this.removeAnis()
checkMusic("exchange", this.isPlayMusic)
// 交换动效
await this.exchangeAni()
// if (num0 == num1) {
......@@ -398,6 +405,9 @@ export class PlayScene extends Scene {
this.removeChild(this.exchangeMask)
this.removeAllClick()
this.exchangeTargetPool = []
getTools()
this.exchanging = false
this.exchangeBtn.mouseEnable = true
if (!this.isGameWin())
......@@ -507,6 +517,8 @@ export class PlayScene extends Scene {
showImage.scale.set(0.5, 0.5)
this.addChild(showImage);
showImage.play()
checkMusic("bomb", this.isPlayMusic)
setTimeout(() => {
this.board[x][y] = 0
this.renderBoard()
......@@ -714,14 +726,17 @@ export class PlayScene extends Scene {
// 只有0
this.generateOneElement()
}
this.moving = true
let beforeArr = this.cloneArr(this.board)
if (Math.abs(this.offsetX) > Math.abs(this.offsetY)) {
// 横向移动
if (this.offsetX > 0) {
console.log("右滑");
// 复制一份原先的数组
if (this.moveToRight(true)) {
checkMusic("move", this.isPlayMusic)
await this.moveAni(beforeArr)
this.renderBoard()
this.generateOneElement()
......@@ -732,6 +747,7 @@ export class PlayScene extends Scene {
if (this.offsetX < 0) {
console.log("左滑")
if (this.moveToLeft(true)) {
checkMusic("move", this.isPlayMusic)
await this.moveAni(beforeArr)
this.renderBoard()
this.generateOneElement()
......@@ -744,6 +760,7 @@ export class PlayScene extends Scene {
if (this.offsetY > 0) {
console.log("下滑")
if (this.moveToBottom(true)) {
checkMusic("move", this.isPlayMusic)
await this.moveAni(beforeArr)
this.renderBoard()
this.generateOneElement()
......@@ -754,6 +771,7 @@ export class PlayScene extends Scene {
if (this.offsetY < 0) {
console.log("上滑")
if (this.moveToTop(true)) {
checkMusic("move", this.isPlayMusic)
await this.moveAni(beforeArr)
this.renderBoard()
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