Commit e30a0296 authored by wildfirecode's avatar wildfirecode

1

parent 60a60cac
......@@ -244,6 +244,13 @@ export default class MainBase extends eui.UILayer {
RES.getResAsync(`nums3_png`);
RES.getResAsync(`nums3_fnt`);
RES.getResAsync(`candynums_fnt`);
RES.getResAsync('candydie0_json');
RES.getResAsync('candydie1_json');
RES.getResAsync('candydie2_json');
RES.getResAsync('candydie3_json');
RES.getResAsync('candydie4_json');
RES.getResAsync('candysub_json');
RES.getResAsync('candydiebg_json');
if (!window['development']) {
RES.getResAsync(`common_json`);
RES.getResAsync(`share3_json`);
......@@ -262,6 +269,7 @@ export default class MainBase extends eui.UILayer {
RES.getResAsync('maplight2_png');
RES.getResAsync('main_mapbottom_png');
RES.getResAsync('lightani_png');
for (var i = 1; i < 19; i++) {
RES.getResAsync("boom" + i + "_png")
......
......@@ -2370,7 +2370,7 @@ export default class MainScene extends Scene {
if (FiveBaseElementTypes.indexOf(ele.type) >= 0) {
if (ele.candy) { //糖果
if (ele.candy.step) {//有步数的时候消除
this.playAni(RecoverName.ELEDIS_ANI, p)
ele.playCandyDieAni();
//这里面会去算个数
this.recoverEle(index);
this.playAni(RecoverName.STEP_ANI, [50, 100]);
......
import { Ani } from "../../class/Ani";
import { ImageAni } from "../../class/ImageAni";
//原点已是中心
export class EleDisAni extends Ani {
/**
* 图片
*/
showImage: ImageAni;
constructor() {
super();
this.aniName = "EleDisAni";
var arr = []
for (var i = 1; i <= 19; i++) {
arr.push("eleDis" + i + "_png");
}
this.showImage = new ImageAni(arr);
this.addChild(this.showImage)
}
play() {
//重置图片
this.showImage.currentFrame = 0;
this.showImage.source = this.showImage.sourceAll[0];
this.showImage.play(() => {
this.recover();
})
}
}
\ No newline at end of file
import { getEffectFramesStr } from "../../../effect/createEffect1";
import MovieClip from "../../../movieclip/MovieClip";
export const createCandyDie0Ani = (x,y,p) => {
const spritesheet = RES.getRes('candydie0_json');
const list = getEffectFramesStr('破碎兔_000', 0, 12);
const movieclip = new MovieClip({
spritesheet: spritesheet,
frameInterval: 2,
frames: list,
position: [x, y],
scale:0.4,
anchor: [.5, 0.25],
loop: false
});
p.addChild(movieclip);
movieclip.once(egret.Event.COMPLETE,()=>{
p.removeChild(movieclip);
},this);
}
\ No newline at end of file
import { getEffectFramesStr } from "../../../effect/createEffect1";
import MovieClip from "../../../movieclip/MovieClip";
export const createCandyDie1Ani = (x,y,p) => {
const spritesheet = RES.getRes('candydie1_json');
const list = getEffectFramesStr('破碎鸟_000', 0, 12);
const movieclip = new MovieClip({
spritesheet: spritesheet,
frameInterval: 2,
frames: list,
position: [x, y],
scale:0.4,
anchor: [.5, 0.25],
loop: false
});
p.addChild(movieclip);
movieclip.once(egret.Event.COMPLETE,()=>{
p.removeChild(movieclip);
},this);
}
\ No newline at end of file
import { getEffectFramesStr } from "../../../effect/createEffect1";
import MovieClip from "../../../movieclip/MovieClip";
export const createCandyDie2Ani = (x,y,p) => {
const spritesheet = RES.getRes('candydie2_json');
const list = getEffectFramesStr('破碎牛_000', 0, 12);
const movieclip = new MovieClip({
spritesheet: spritesheet,
frameInterval: 2,
frames: list,
position: [x, y],
scale:0.4,
anchor: [.5, 0.25],
loop: false
});
p.addChild(movieclip);
movieclip.once(egret.Event.COMPLETE,()=>{
p.removeChild(movieclip);
},this);
}
\ No newline at end of file
import { getEffectFramesStr } from "../../../effect/createEffect1";
import MovieClip from "../../../movieclip/MovieClip";
export const createCandyDie3Ani = (x,y,p) => {
const spritesheet = RES.getRes('candydie3_json');
const list = getEffectFramesStr('破碎狮子_000', 0, 12);
const movieclip = new MovieClip({
spritesheet: spritesheet,
frameInterval: 2,
frames: list,
position: [x, y],
scale:0.4,
anchor: [.5, 0.25],
loop: false
});
p.addChild(movieclip);
movieclip.once(egret.Event.COMPLETE,()=>{
p.removeChild(movieclip);
},this);
}
\ No newline at end of file
import { getEffectFramesStr } from "../../../effect/createEffect1";
import MovieClip from "../../../movieclip/MovieClip";
export const createCandyDie4Ani = (x,y,p) => {
const spritesheet = RES.getRes('candydie4_json');
const list = getEffectFramesStr('破碎猪_000', 0, 12);
const movieclip = new MovieClip({
spritesheet: spritesheet,
frameInterval: 2,
frames: list,
position: [x, y],
scale:0.4,
anchor: [.5, 0.25],
loop: false
});
p.addChild(movieclip);
movieclip.once(egret.Event.COMPLETE,()=>{
p.removeChild(movieclip);
},this);
}
\ No newline at end of file
import { getEffectFramesStr } from "../../../effect/createEffect1";
import MovieClip from "../../../movieclip/MovieClip";
export const createCandyDieBgAni = (x,y,p) => {
const spritesheet = RES.getRes('candydiebg_json');
const list = getEffectFramesStr('糖果消失光_000', 0, 13);
const movieclip = new MovieClip({
spritesheet: spritesheet,
frameInterval: 3,
frames: list,
position: [x, y],
scale:1,
anchor: [.5, 0.5],
loop: false
});
p.addChild(movieclip);
movieclip.once(egret.Event.COMPLETE,()=>{
p.removeChild(movieclip);
},this);
}
\ No newline at end of file
import { getEffectFramesStr } from "../../../effect/createEffect1";
import MovieClip from "../../../movieclip/MovieClip";
export const createCandySubAni = (x,y,p) => {
const spritesheet = RES.getRes('candysub_json');
const list = getEffectFramesStr('数字减少星星_000', 0, 15);
const movieclip = new MovieClip({
spritesheet: spritesheet,
frameInterval: 3,
frames: list,
position: [x, y],
scale: 1,
anchor: [.5, .5],
loop: false
});
p.addChild(movieclip);
movieclip.once(egret.Event.COMPLETE,()=>{
p.removeChild(movieclip);
},this);
}
\ No newline at end of file
......@@ -13,6 +13,13 @@ import { FestivalEle } from "./FestivalEle";
import { FestivalEle2 } from "./FestivalEle2";
import { State } from "./State";
import { Candy } from "./Candy";
import { createCandySubAni } from "../anis/candy/createCandySubAni";
import { createCandyDie0Ani } from "../anis/candy/createCandyDie0Ani";
import { createCandyDieBgAni } from "../anis/candy/createCandyDieBgAni";
import { createCandyDie1Ani } from "../anis/candy/createCandyDie1Ani";
import { createCandyDie2Ani } from "../anis/candy/createCandyDie2Ani";
import { createCandyDie3Ani } from "../anis/candy/createCandyDie3Ani";
import { createCandyDie4Ani } from "../anis/candy/createCandyDie4Ani";
/**
* 考虑到底继承白鹭的啥Component还是Container
* 坐标原点需要坐落在格子的中心点
......@@ -36,12 +43,29 @@ export class Element extends eui.Component {
this.addCandyStandbyAni();
}
playCandyDieAni() {
var p = Tool.getPositionByIndex(this.index);
createCandyDieBgAni(p[0], p[1], this.stage);
if (this.type == ElementType.RABBIT)
createCandyDie0Ani(p[0], p[1], this.stage);
if (this.type == ElementType.CHICKEN)
createCandyDie1Ani(p[0], p[1], this.stage);
if (this.type == ElementType.CATTLE)
createCandyDie2Ani(p[0], p[1], this.stage);
if (this.type == ElementType.LION)
createCandyDie3Ani(p[0], p[1], this.stage);
if (this.type == ElementType.PIG)
createCandyDie4Ani(p[0], p[1], this.stage);
}
playCandySubAni() {
return new Promise((r) => {
egret.Tween.removeTweens(this.showImage);
egret.Tween.get(this.showImage).to({ scaleX: 0, scaleY: 0 }, 200)
.to({ scaleX: 1, scaleY: 1 }, 500, egret.Ease.backOut).call(()=>{
.to({ scaleX: 1, scaleY: 1 }, 500, egret.Ease.backOut).call(() => {
this.addCandyStandbyAni();
var p = Tool.getPositionByIndex(this.index);
createCandySubAni(p[0], p[1], this.stage);
r();
});
});
......@@ -226,6 +250,8 @@ export class Element extends eui.Component {
this.alpha = this.scaleX = this.scaleY = 1;
this.showImage.anchorOffsetX = 0;
this.showImage.anchorOffsetY = 0;
this.showImage.scaleY = 1;
this.showImage.scaleX = 1;
egret.Tween.removeTweens(this.showImage);
//类型重置,showImage修改
this._type = type;
......
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