Commit d7231280 authored by zjz1994's avatar zjz1994

樱花动画暂存

parent 0cf0e2a4
......@@ -326,7 +326,12 @@ export default class MainBase extends eui.UILayer {
RES.getResAsync("ele43fn_png");
RES.getResAsync("ele44fn_png");
RES.getResAsync("ele45fn_png");
RES.getResAsync("ele46_png");
RES.getResAsync("ele46_1_png");
RES.getResAsync("ele46_2_png");
RES.getResAsync("ele46_3_png");
RES.getResAsync("ele46_4_png");
RES.getResAsync("ele46_5_png");
RES.getResAsync("ele46_6_png");
RES.getResAsync("ele46_sz_png");
......
This diff is collapsed.
......@@ -192,6 +192,9 @@ let regoudata:any = null;
let tiantianquandata:any = null;
let xugaodata:any = null;
//樱花
let cherryAniData:any = {};
//所有可能被添加节日红包的关卡及索引,默认索引值都是40;如果没有就不放
const fesChapterData: number[] = [];
......@@ -449,6 +452,8 @@ export default class MainScene extends Scene {
freeCherryData:Array<number> = [];
//已消除樱花
amoveCherryData:Array<number> = [];
//一般樱花动画
normalCherryData:Array<number> = [];
//等待樱花
waitCherry = false;
......@@ -471,6 +476,7 @@ export default class MainScene extends Scene {
this.once(egret.Event.ADDED_TO_STAGE,this.initMainScene,this);
this.initFoodSvgas();
this.initCherrySvgas();
}
initMainScene(){
var stagew = this.stage.stageWidth;
......@@ -7453,6 +7459,21 @@ export default class MainScene extends Scene {
}
//新元素樱花
/**
* 加载樱花动画
*/
initCherrySvgas(call:any=null){
var cherryArr:Array<string> = ["cherry1_2","cherry2_3","cherry3_4","cherry4_5","cherry5_6"];
for(let i=0;i<cherryArr.length;i++){
let icherryname = cherryArr[i];
if(!cherryAniData[icherryname]){
if (!svgaParser) svgaParser = new window["SVGA"].Parser();
svgaParser.load(resPath + 'resource/assets/svgas/'+icherryname+'.svga', (videoItem) => {
cherryAniData[icherryname] = videoItem;
})
}
}
}
//判断当前位置是否樱花
checkisCherry(idx:number){
for(var i=0;i<this.cherryData.length;i++){
......@@ -7476,6 +7497,7 @@ export default class MainScene extends Scene {
}
var indexs = this.getNextIndexs(lat0);
var cherryAnis:Array<any> = new Array();
for(let i=0;i<indexs.length;i++){
let index = indexs[i];
let lat = this.lattices[index];
......@@ -7483,30 +7505,94 @@ export default class MainScene extends Scene {
if(lat&&lat.element){
let ele = lat.element;
if(ele.type==ElementType.cherry&&ele.activeStatus==0){
this.activeCherry(index);
var cherrystats = this.activeCherry(index);
if(cherrystats){
cherryAnis.push({
idx:index,
stats:cherrystats
})
}
}
}
}
//以上仅更新樱花数据
//更新樱花动画
this.checkPlayCherryAni(cherryAnis);
}
//特效激活樱花
solveCherryEle(cherryArr:Array<number>){
var cherryAnis:Array<any> = new Array();
for(var i=0;i<cherryArr.length;i++){
var icheryidx = cherryArr[i];
var lat = this.lattices[icheryidx];
if(lat){
var ele = lat.element;
if(ele&&ele.type==ElementType.cherry&&ele.activeStatus==0){
this.activeCherry(icheryidx);
var cherrystats = this.activeCherry(icheryidx);
if(cherrystats){
cherryAnis.push({
idx:icheryidx,
stats:cherrystats
})
}
}
}
}
//以上仅更新樱花数据
//更新樱花动画
this.checkPlayCherryAni(cherryAnis);
}
//樱花动画播放
checkPlayCherryAni(cherryAnis:Array<{idx:number,stats:Array<number>}>){
var aniArr:Array<{inidx:number,idata:Array<{idx:number,stats:Array<number>}>}> = new Array();
for(var i=0;i<cherryAnis.length;i++){
var icherrydata = cherryAnis[i];
var icherryidx = icherrydata.idx;
var icherrystats = icherrydata.stats;
var incherryidx = this.getInCherryidx(icherryidx);
// var
// for(var j=0;j<aniArr.length;j++){
// var janidata = aniArr[j];
// var janiidx = janidata.inidx;
// if(janiidx)
// }
// aniArr.push({
// inidx:incherryidx,
// idx:icherryidx,
// stats:icherrystats
// })
}
}
//获取樱花所在团
getInCherryidx(idx:number){
for(var i=0;i<this.cherryData.length;i++){
var icherrydata = this.cherryData[i];
if(icherrydata.indexOf(idx)!=-1){
return i;
}
}
}
//激活樱花
activeCherry(idx:number){
// console.log("1消除樱花----------------------",idx);
var lat = this.lattices[idx];
var ele = this.lattices[idx].element;
var ostat = ele.cherrystat;
ele.addCherryStat();
var nstat = ele.cherrystat;
//樱花状态需要更新
if(nstat>ostat){
return [ostat,nstat];
}else{
return null;
}
ele.activeCherry();
this.playCherryAni(idx);
this.addFreeCherryData(idx);
......
......@@ -303,7 +303,7 @@ export const Chapters31: ChapterData[] = [
1, 1, 1, 1, 9, 1, 1, 1, 1,
2, 1, 1, 1, 9, 1, 1, 1, 2 ], baseElements: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], recycles: [], foodsdata: [ ], generateLats: [ { index: 0, type: null }, { index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 7, type: null }, { index: 8, type: null } ] } },
//793
{ baseElementTypes: [ 0,3, 4, 2 ], bubbleProbability: 0, stepCount: 26, passTarget: { type: 1, elements: [ { type: 9, count: 75 } ] }, starScores: [ 15000, 20000, 250000 ], map: { lattices: [
{ baseElementTypes: [ 0,3, 4, 2 ], bubbleProbability: 0, stepCount: 26, passTarget: { type: 1, elements: [ { type: 9, count: 75 } ] }, starScores: [ 15000, 20000, 25000 ], map: { lattices: [
61, 3, 3, 3, 0, 3, 3, 3, 61,
61, 3, 3, 3, 0, 3, 3, 3, 61,
61, 3, 3, 3, 3, 3, 3, 3, 61,
......
......@@ -872,6 +872,8 @@ export class Element extends eui.Component {
//模拟炮台发射情况
protected cannolab: eui.Label;
//樱花阶段绽放
public cherrystat:number = 1;
/**
*
* @param type 只应该是基础元素和特殊元素
......@@ -884,7 +886,12 @@ export class Element extends eui.Component {
if(type==ElementType.Pongo){//猩猩不设默认图
}else{
this.changeSource("ele" + this.type + "_png");
if(this.type==ElementType.cherry){
this.cherrystat = 1;
this.setCherryImg();
}else{
this.changeSource("ele" + this.type + "_png");
}
}
this.addChild(this.showImage);
......@@ -1024,6 +1031,7 @@ export class Element extends eui.Component {
this.showImage.visible = type != ElementType.CANNO;
this.cannolab.visible = false;
this.inPongoPart = null;
this.cherrystat = 1;
//重置element
if(this._mv&&this._mv.parent){
this._mv.removeEventListener(egret.Event.ENTER_FRAME,this._mvEnterFrame1,this);
......@@ -1055,7 +1063,11 @@ export class Element extends eui.Component {
if(type==ElementType.Pongo||type==ElementType.CANNO){
}else{
this.changeSource("ele" + type + "_png");
if(this.type==ElementType.cherry){
this.setCherryImg();
}else{
this.changeSource("ele" + type + "_png");
}
}
//特效重置
this.effectType = null;
......@@ -1316,8 +1328,21 @@ export class Element extends eui.Component {
get isActive() { return false }
canElimite:boolean;
//樱花显示
setCherryImg(){
this.changeSource("ele46_"+this.cherrystat + "_png");
}
//激活樱花
activeStatus:number = 0;//0未激活,1绽放中,2,结束
//樱花动画播放状态
isInCherryAni:boolean = false;
//樱花到下一阶段
addCherryStat(){
if(this.cherrystat<6&&!this.isInCherryAni){
this.cherrystat += 1;
this.isInCherryAni = true;
}
}
activeCherry(){
this.activeStatus = 1;
this.showImage.alpha = 0;
......@@ -1326,6 +1351,4 @@ export class Element extends eui.Component {
dieCherry(){
this.activeStatus = 2;
}
}
\ 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