Commit 21bffd19 authored by liujiangnan's avatar liujiangnan

feat: tips的BUG

parent 1aa69a39
......@@ -53,19 +53,27 @@ export default class NewClass extends middleLayerBase {
}
}
}
tipsTween = null;
async showTips(str: string) {
const tipsLayer = cc.find('middleLayer/tipsLayer');
if (this.tipsTween) {
this.tipsTween.stop();
tipsLayer.active = false;
}
const label = cc.find('middleLayer/tipsLayer/tips/label');
label.getComponent(cc.Label).string = ` ${str} `;
const tips = cc.find('middleLayer/tipsLayer/tips');
tipsLayer.active = true;
tips.width = Math.max(300, label.width + 50);
cc.tween(tips)
this.tipsTween = cc.tween(tips)
.set({ opacity: 255 })
.to(2, { opacity: 0 })
.to(5, { opacity: 0 })
.call(() => {
tipsLayer.active = false;
this.tipsTween = null;
})
.start();
}
......
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