Commit 22510841 authored by wildfirecode's avatar wildfirecode

1

parent b20675f3
...@@ -9,20 +9,25 @@ export default class Toast2 extends ComponentBase { ...@@ -9,20 +9,25 @@ export default class Toast2 extends ComponentBase {
get skinResKey() { return 'common' } get skinResKey() { return 'common' }
get skinKey(): string { return 'Toast2' } get skinKey(): string { return 'Toast2' }
toastLabel:eui.Label; toastLabel: eui.Label;
start() { start() {
this.touchEnabled=false;
// this.touchChildren=false;
this.toastLabel.textFlow = (new HtmlTextParser).parser('<u>继续闯关赢好礼</u>'); this.toastLabel.textFlow = (new HtmlTextParser).parser('<u>继续闯关赢好礼</u>');
this.toastLabel.addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{ if (!this.hasEventListener(egret.TouchEvent.TOUCH_TAP)) {
if(SceneCtrl.instance.currentScene instanceof MainScene){ this.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if (SceneCtrl.instance.currentScene instanceof MainScene) {
}else { } else {
gotoNextLevel(); gotoNextLevel();
} }
egret.Tween.removeTweens(this); egret.Tween.removeTweens(this);
this.alpha=0; this.alpha = 0;
},this);
this.touchEnabled = false;
this.touchChildren = false;
}, this);
}
return this; return this;
} }
} }
\ No newline at end of file
...@@ -20,8 +20,13 @@ const initToast = () => { ...@@ -20,8 +20,13 @@ const initToast = () => {
export const showToast2 = () => { export const showToast2 = () => {
const toast = initToast().start(); const toast = initToast().start();
egret.Tween.removeTweens(toast); egret.Tween.removeTweens(toast);
toast.touchEnabled=true;
toast.touchChildren=true;
const tw = egret.Tween.get(toast); const tw = egret.Tween.get(toast);
tw.set({ y: -200, alpha: 1 }).to({ y: 400 }, 500, egret.Ease.quartOut) tw.set({ y: -200, alpha: 1 }).to({ y: 400 }, 500, egret.Ease.quartOut)
.wait(3500) .wait(3500)
.to({ alpha: 0 }, 300) .to({ alpha: 0 }, 300).call(()=>{
toast.touchEnabled=false;
toast.touchChildren=false;
})
} }
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