LayaBox 游戏提示
private static tips: Array<Laya.Label> = [];
public static showTip(msg: string,owner: laya.display.Node): void {
let label: Laya.Label;
if (this.tips.length <= 0) {
label = new Laya.Label("");
label.fontSize = 35;
label.color = "#f4f4f3";
label.bold = true;
Laya.stage.addChild(label);
label.visible = false;
this.tips.push(label);
}
label = this.tips.shift();
label.text = msg;
label.x = (Laya.stage.width - label.width) / 2;
label.y = (Laya.stage.height - label.height) / 2;
let y: number = label.y - 200;
label.visible = true;
label.alpha = 1;
label.zOrder =5;
Laya.Tween.to(label, { y: y, alpha: 0 }, 1 * 1000, Laya.Ease.linearNone, Laya.Handler.create(this, () => {
label.visible = false;
this.tips.push(label);
}));
}## 标题