Commit 68543aaa by Mike Zhu

Merge branch 'develop' of cd.i.strikingly.com:shawn.wang/crazyflirt into develop

parents 2fcd99db 52332cf4
...@@ -8,6 +8,7 @@ class Map extends egret.Sprite { ...@@ -8,6 +8,7 @@ class Map extends egret.Sprite {
public isShowingTouchArea public isShowingTouchArea
private runnerMap:any = {} private runnerMap:any = {}
private runnerList:any = [] private runnerList:any = []
private catchedTip: egret.Bitmap = new egret.Bitmap()
public constructor() { public constructor() {
super(); super();
this.init() this.init()
...@@ -52,6 +53,12 @@ class Map extends egret.Sprite { ...@@ -52,6 +53,12 @@ class Map extends egret.Sprite {
this.showClickedGrid(x, y) this.showClickedGrid(x, y)
} }
}) })
this.catchedTip.texture = RES.getRes('catched_jpg')
this.catchedTip.alpha = 0
this.catchedTip.x = 604
this.catchedTip.y = 316
this.addChild(this.catchedTip)
} }
public getSurroundedGrids(x, y) { public getSurroundedGrids(x, y) {
...@@ -81,8 +88,8 @@ class Map extends egret.Sprite { ...@@ -81,8 +88,8 @@ class Map extends egret.Sprite {
public getCatchedRunners(x, y) { public getCatchedRunners(x, y) {
const catchedRunners = [] const catchedRunners = []
Store.getState().runners.forEach(runner => { Store.getState().runners.forEach(runner => {
const updatedRunner = this.runnerMap[runner.t_cid] const runnerInMap = this.runnerMap[runner.t_cid]
if (updatedRunner.x === x && updatedRunner.y === y) { if (runnerInMap.x === x && runnerInMap.y === y) {
catchedRunners.push(runner) catchedRunners.push(runner)
} }
}) })
...@@ -118,7 +125,8 @@ class Map extends egret.Sprite { ...@@ -118,7 +125,8 @@ class Map extends egret.Sprite {
runnerInMap.alpha = 1 runnerInMap.alpha = 1
} }
}) })
this.getCatchedRunners(x, y).forEach(runner => { const catchedRunners = this.getCatchedRunners(x, y)
catchedRunners.forEach(runner => {
platform.sendSocketMessage({ platform.sendSocketMessage({
data: JSON.stringify({ data: JSON.stringify({
...@@ -135,12 +143,15 @@ class Map extends egret.Sprite { ...@@ -135,12 +143,15 @@ class Map extends egret.Sprite {
}) })
if (Store.isMe(runner.t_cid) || Store.isCatcher()) { if (Store.isMe(runner.t_cid) || Store.isCatcher()) {
SoundManager.getInstance().playCatched() SoundManager.getInstance().playCatched()
const tween = egret.Tween.get(this.catchedTip);
tween.to({alpha: 1}, 300).wait(500).to({alpha: 0}, 300)
} }
if (Store.isCatcher()) { if (Store.isCatcher()) {
this.runnerMap[runner.t_cid].alpha = 0 this.runnerMap[runner.t_cid].alpha = 0
} }
}) })
setTimeout(() => { setTimeout(() => {
centerGrid.bg.texture = RES.getRes('grid_jpg') centerGrid.bg.texture = RES.getRes('grid_jpg')
surroundedGrids.forEach(grid => { surroundedGrids.forEach(grid => {
......
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