Commit d6ddd7e9 authored by zjz1994's avatar zjz1994

修改糖果bug

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