Commit 5e5729df authored by wjf's avatar wjf

l

parent 05d0d630
...@@ -65,6 +65,7 @@ import { GameGuide } from '../something/uis/GameGuide'; ...@@ -65,6 +65,7 @@ import { GameGuide } from '../something/uis/GameGuide';
import { PropBtnCon } from '../something/uis/PropBtnCon'; import { PropBtnCon } from '../something/uis/PropBtnCon';
import { ChapterNum } from '../something/uis/ChapterNum'; import { ChapterNum } from '../something/uis/ChapterNum';
import { CurScoreNum } from '../something/uis/CurScoreNum'; import { CurScoreNum } from '../something/uis/CurScoreNum';
import { FestivalTarget } from '../something/uis/FestivalTarget';
const aniClass = { const aniClass = {
"BoomAni": BoomAni, "BoomAni": BoomAni,
...@@ -157,6 +158,8 @@ export default class MainScene extends Scene { ...@@ -157,6 +158,8 @@ export default class MainScene extends Scene {
//通关的目标元素的计数,下标和元素类型ElementType枚举一致 //通关的目标元素的计数,下标和元素类型ElementType枚举一致
passElements: number[]; passElements: number[];
elementTargets: ElementTargets; elementTargets: ElementTargets;
//节日元素目标
festivalTarget: FestivalTarget;
//所有元素的消耗数量,需要传给后端 //所有元素的消耗数量,需要传给后端
hasEliminatedElements: number[]; hasEliminatedElements: number[];
//得分的动画,首先特效组合的单独算分,然后把所有符合的放入,在波及的特效触发时不算分 //得分的动画,首先特效组合的单独算分,然后把所有符合的放入,在波及的特效触发时不算分
...@@ -232,8 +235,11 @@ export default class MainScene extends Scene { ...@@ -232,8 +235,11 @@ export default class MainScene extends Scene {
//初始化目标信息 //初始化目标信息
this.initTarget(); this.initTarget();
//添加节日元素,条件可能会变 //添加节日元素,条件可能会变
if(data&&data.aaa){ if (111) {
this.festivalTarget = new FestivalTarget();
this.festivalTarget.x = 580;
this.festivalTarget.y = 115;
this.addChildAt(this.festivalTarget, 1);
} }
//初始化索引信息,包括10*10的, //初始化索引信息,包括10*10的,
Tool.init(Tool.getColOddEven(this.chapterData.map.lattices), !!(this.passElements && this.passElements[ElementType.LOLLIPOP])); Tool.init(Tool.getColOddEven(this.chapterData.map.lattices), !!(this.passElements && this.passElements[ElementType.LOLLIPOP]));
...@@ -438,7 +444,6 @@ export default class MainScene extends Scene { ...@@ -438,7 +444,6 @@ export default class MainScene extends Scene {
const { index, row } = endRowNumHash[key]; const { index, row } = endRowNumHash[key];
if (endRowNum == row) this.recycleIndexs.push(index) if (endRowNum == row) this.recycleIndexs.push(index)
} }
console
} }
//如果有数据,直接用数据, //如果有数据,直接用数据,
else { else {
...@@ -2607,7 +2612,9 @@ export default class MainScene extends Scene { ...@@ -2607,7 +2612,9 @@ export default class MainScene extends Scene {
if (this.passElements[type] != 0) { if (this.passElements[type] != 0) {
this.passElements[type]--; this.passElements[type]--;
var p = this.elementTargets.targets[type].localToGlobal(40 * 0.8, 40 * 0.8) var p = this.elementTargets.targets[type].localToGlobal(40 * 0.8, 40 * 0.8)
FlyTargetAni(type, fromP, [p.x, p.y], this); this.addChild(FlyTargetAni(type, fromP, [p.x, p.y], () => {
this.elementTargets.targets[type].count--;
}))
} }
//数量增加 //数量增加
this.hasEliminatedElements[type]++; this.hasEliminatedElements[type]++;
......
...@@ -9,25 +9,30 @@ export function FlyTargetAni( ...@@ -9,25 +9,30 @@ export function FlyTargetAni(
type: ElementType, type: ElementType,
fromP: number[], fromP: number[],
targetP: number[], targetP: number[],
con: egret.DisplayObjectContainer callback: Function
) { ) {
var texture: egret.Texture = RES.getRes("ele" + type + "_png"); var texture: egret.Texture = RES.getRes("ele" + type + "_png");
//弄一个替代的 //弄一个替代的
let eleC: BitmapRecycle = Pool.takeOut(RecoverName.BITMAPRECYCLE); let eleC: BitmapRecycle = Pool.takeOut(RecoverName.BITMAPRECYCLE);
if (!eleC) { if (!eleC) {
eleC = new BitmapRecycle(texture); eleC = new BitmapRecycle(texture);
}else{ } else {
eleC.reset(texture); eleC.reset(texture);
} }
eleC.x = fromP[0]; eleC.x = fromP[0];
eleC.y = fromP[1]; eleC.y = fromP[1];
con.addChild(eleC);
egret.Tween.get(eleC) egret.Tween.get(eleC)
.to({ x: targetP[0], y: targetP[1], scaleX: 0.3, scaleY: 0.3 }, 500 + (Math.random() * 100) >> 0) .to({ x: targetP[0], y: targetP[1], scaleX: 0.3, scaleY: 0.3 }, 500 + (Math.random() * 100) >> 0)
.call(() => { .call(() => {
//回收 //回收
con.removeChild(eleC); if (eleC.parent) {
Pool.recover(RecoverName.BITMAPRECYCLE, eleC); eleC.parent.removeChild(eleC);
con["elementTargets"].targets[type].count--; Pool.recover(RecoverName.BITMAPRECYCLE, eleC);
}
//回调
callback();
// con["elementTargets"].targets[type].count--;
}) })
return eleC
} }
\ No newline at end of file
...@@ -37,13 +37,15 @@ export class FestivalTarget extends egret.DisplayObjectContainer { ...@@ -37,13 +37,15 @@ export class FestivalTarget extends egret.DisplayObjectContainer {
this.addChild(showImage); this.addChild(showImage);
var texture: egret.Texture = RES.getRes("rightMark_png"); var texture: egret.Texture = RES.getRes("rightMark_png");
this.zeroMark = new egret.Bitmap(texture); this.zeroMark = new egret.Bitmap(texture);
this.zeroMark.x = 35; this.zeroMark.x = 23;
this.zeroMark.y = 35; this.zeroMark.y = 50;
this.zeroMark.visible = false; this.zeroMark.visible = false;
this.addChild(this.zeroMark); this.addChild(this.zeroMark);
this.countNum = new TargetNumber(); this.countNum = new TargetNumber();
this.countNum.x = 55; this.countNum.x = 40;
this.countNum.y = 45; this.countNum.y = 60;
this.addChild(this.countNum); this.addChild(this.countNum);
this.count = 6;
} }
} }
\ No newline at end of file
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