Commit b909732b authored by zjz1994's avatar zjz1994

樱花动画

parent 556f8e84
......@@ -3183,7 +3183,7 @@ export default class MainScene extends Scene {
//樱花绽放
var amove = this.checkFaCherry();
if(!amove){
console.log("樱花未消除,等待消除");
// console.log("樱花未消除,等待消除");
this.waitCherry = true;
return;
}else{
......@@ -7706,6 +7706,12 @@ export default class MainScene extends Scene {
//樱花动画
playCherryAni(idx:number,statold,statnew,isfina:boolean){
let lastani = this.effectContainer.getChildByName("cherryAni_"+idx);
if(lastani){
let lastoname = lastani["oname"];
this.effectContainer.removeChild(lastani);
cherryAniArr[lastoname].push(lastani);
}
let oneani:any;
let aniname = "cherry"+statold+"_"+statnew;
......@@ -7725,6 +7731,9 @@ export default class MainScene extends Scene {
// console.log(statold,statnew,idx,oneani.totalFrames);
oneani.x = p[0]-100;
oneani.y = p[1]-100;
oneani.touchEnabled = false;
oneani.name = "cherryAni_"+idx;
oneani["oname"] = aniname;
this.effectContainer.addChild(oneani);
let framefunc = ()=>{
......@@ -7765,9 +7774,12 @@ export default class MainScene extends Scene {
}
let compfunc = ()=>{
oneani.removeEventListener(egret.Event.COMPLETE,compfunc,this);
//移除樱花动画
this.effectContainer.removeChild(oneani);
cherryAniArr[aniname].push(oneani);
oneani.stop();
if(isfina){
//移除樱花动画
this.effectContainer.removeChild(oneani);
cherryAniArr[aniname].push(oneani);
}
}
oneani.addEventListener(egret.Event.ENTER_FRAME,framefunc,this);
oneani.addEventListener(egret.Event.COMPLETE,compfunc,this);
......
......@@ -88,7 +88,7 @@ chapters.forEach((chapter,index) => {
* @param index 关数 从1开始
*/
export function getChapterData(index: number): ChapterData {
return chapters[801];
// return chapters[801];
//没有数据就返回第一关数据
return chapters[index] || chapters[1];
}
......
......@@ -1346,6 +1346,7 @@ export class Element extends eui.Component {
this.cherrystat += 1;
this.isInCherryAni = true;
this.setCherryImg();
this.showImage.alpha = 0;
}
}
activeCherry(){
......
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