Commit d6ddd7e9 authored by zjz1994's avatar zjz1994

修改糖果bug

parent ef9b23b9
...@@ -1486,7 +1486,7 @@ export default class MainScene extends Scene { ...@@ -1486,7 +1486,7 @@ export default class MainScene extends Scene {
const ele: Element = this.lattices[i].element; const ele: Element = this.lattices[i].element;
if(isCandyEle) { //糖果元素 if(isCandyEle) { //糖果元素
if(baseElement == CandyBaseElementType.RANDOM) {//如果是随机糖果,目前只有随机糖果 if(baseElement == CandyBaseElementType.RANDOM) {//如果是随机糖果,目前只有随机糖果
ele.resetToCandyView(convertBaseElementType(ele.type),this);//切换成糖果视图 ele.resetToCandyView(convertBaseElementType(ele.type));//切换成糖果视图
} else { } else {
// const baseType = convertCandyBaseElementType(resultBaseElement); // const baseType = convertCandyBaseElementType(resultBaseElement);
// ele.resetType(baseType);//先重置ele类型 // ele.resetType(baseType);//先重置ele类型
...@@ -2769,7 +2769,9 @@ export default class MainScene extends Scene { ...@@ -2769,7 +2769,9 @@ export default class MainScene extends Scene {
this.eliminatedElements.push(re[j][k]); this.eliminatedElements.push(re[j][k]);
} else { } else {
//原先在消除队列,是交叉点,变成爆炸特效 //原先在消除队列,是交叉点,变成爆炸特效
if(ele.temEffectType != EffectType.MAGICLION) ele.temEffectType = EffectType.EXPLOSIVE; if(ele.temEffectType != EffectType.MAGICLION){
ele.temEffectType = EffectType.EXPLOSIVE;
}
} }
} }
} }
...@@ -3666,8 +3668,12 @@ export default class MainScene extends Scene { ...@@ -3666,8 +3668,12 @@ export default class MainScene extends Scene {
//如果other带特效,符合的元素都加上特效,没动效,直接加吧先, //如果other带特效,符合的元素都加上特效,没动效,直接加吧先,
if(other.effectType != null) { if(other.effectType != null) {
if(other.effectType == EffectType.EXPLOSIVE) { if(other.effectType == EffectType.EXPLOSIVE) {
this.setCandyToEffect(lat.element);
lat.element.effectType = EffectType.EXPLOSIVE lat.element.effectType = EffectType.EXPLOSIVE
} else { } else {
this.setCandyToEffect(lat.element);
lat.element.effectType = Math.random() > 0.5 ? EffectType.HORIZONTAL : EffectType.VERTICAL; lat.element.effectType = Math.random() > 0.5 ? EffectType.HORIZONTAL : EffectType.VERTICAL;
} }
} else { } else {
...@@ -4005,6 +4011,7 @@ export default class MainScene extends Scene { ...@@ -4005,6 +4011,7 @@ export default class MainScene extends Scene {
} else { } else {
//即将生成特效的,变成特效,不消除, //即将生成特效的,变成特效,不消除,
if(ele.temEffectType != null) { if(ele.temEffectType != null) {
this.setCandyToEffect(ele);
ele.effectType = ele.temEffectType; ele.effectType = ele.temEffectType;
ele.temEffectType = null; ele.temEffectType = null;
//有气泡的需要去掉状态, //有气泡的需要去掉状态,
...@@ -4396,6 +4403,7 @@ export default class MainScene extends Scene { ...@@ -4396,6 +4403,7 @@ export default class MainScene extends Scene {
//算角度 //算角度
var r = Tool.getForwardRotation(stepPosition, [ele.x, ele.y]) var r = Tool.getForwardRotation(stepPosition, [ele.x, ele.y])
bonusShootAni.play(r * 180 / Math.PI, [ele.x, ele.y], () => { bonusShootAni.play(r * 180 / Math.PI, [ele.x, ele.y], () => {
this.setCandyToEffect(ele);
ele.effectType = Math.random() > 0.5 ? EffectType.HORIZONTAL : EffectType.VERTICAL; ele.effectType = Math.random() > 0.5 ? EffectType.HORIZONTAL : EffectType.VERTICAL;
//去掉所有状态 //去掉所有状态
ele.removeAllState(); ele.removeAllState();
...@@ -5729,10 +5737,13 @@ export default class MainScene extends Scene { ...@@ -5729,10 +5737,13 @@ export default class MainScene extends Scene {
} }
//新增糖果转特效元素处理 //新增糖果转特效元素处理
setCandyToEffect(){ setCandyToEffect(ele){
if(ele&&ele.candy&&ele.candy.step){
this.playAni(RecoverName.STEP_ANI, [50, 100]); this.playAni(RecoverName.STEP_ANI, [50, 100]);
setTimeout(() => { setTimeout(() => {
this.steps += 5; this.steps += 5;
}, 333) }, 333)
} }
}
} }
\ No newline at end of file
...@@ -222,10 +222,7 @@ export class Element extends eui.Component { ...@@ -222,10 +222,7 @@ export class Element extends eui.Component {
} }
private _candy: Candy; private _candy: Candy;
resetToCandyView(baseElement: CandyBaseElementType,mainscene?) { resetToCandyView(baseElement: CandyBaseElementType) {
if(mainscene){
this.mainScene = mainscene;
}
const res = transElementRes(baseElement); const res = transElementRes(baseElement);
this.changeSource("ele" + res + "_png"); this.changeSource("ele" + res + "_png");
...@@ -717,6 +714,7 @@ export class Element extends eui.Component { ...@@ -717,6 +714,7 @@ export class Element extends eui.Component {
} }
playCandySubAni() { playCandySubAni() {
console.log("candy动画1111");
return new Promise((r) => { return new Promise((r) => {
egret.Tween.removeTweens(this.showImage); egret.Tween.removeTweens(this.showImage);
egret.Tween.get(this.showImage).to({ scaleX: 0, scaleY: 0 }, 200) egret.Tween.get(this.showImage).to({ scaleX: 0, scaleY: 0 }, 200)
...@@ -730,6 +728,7 @@ export class Element extends eui.Component { ...@@ -730,6 +728,7 @@ export class Element extends eui.Component {
} }
addCandyStandbyAni() { addCandyStandbyAni() {
console.log("candy动画2222");
egret.Tween.removeTweens(this.showImage); egret.Tween.removeTweens(this.showImage);
egret.Tween.get(this.showImage, { loop: true }) egret.Tween.get(this.showImage, { loop: true })
.to({ scaleX: 1.1, scaleY: 0.9 }, 500).to({ scaleX: 0.9, scaleY: 1.1 }, 200).to({ scaleX: 1, scaleY: 1 }, 200).wait(1000); .to({ scaleX: 1.1, scaleY: 0.9 }, 500).to({ scaleX: 0.9, scaleY: 1.1 }, 200).to({ scaleX: 1, scaleY: 1 }, 200).wait(1000);
...@@ -763,14 +762,18 @@ export class Element extends eui.Component { ...@@ -763,14 +762,18 @@ export class Element extends eui.Component {
set effectType(value: EffectType) { set effectType(value: EffectType) {
//糖果被直接设置成特效元素 //糖果被直接设置成特效元素
if(this.candy&&this.candy.step){ if(this.candy&&this.candy.step){
console.log("清除candy动画")
this.playCandyDieAni(); this.playCandyDieAni();
this.candy.visible = false; if(this.candy&&this.candy.parent){
this.candy.parent.removeChild(this.candy);
this._candy = null;
}
egret.Tween.removeTweens(this.showImage); egret.Tween.removeTweens(this.showImage);
this.showImage.scaleX = 1; this.showImage.scaleX = 1;
this.showImage.scaleY = 1; this.showImage.scaleY = 1;
this.showImage.alpha = 1; this.showImage.alpha = 1;
this.showImage.anchorOffsetX = 0;
this.mainScene&&this.mainScene.setCandyToEffect(); this.showImage.anchorOffsetY = 0;
} }
if (this.monster) { if (this.monster) {
value = null; value = null;
......
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