29 lines
771 B
TypeScript
29 lines
771 B
TypeScript
|
|
import { UIManager } from "../models/UIManager";
|
||
|
|
|
||
|
|
const { regClass, property } = Laya;
|
||
|
|
|
||
|
|
@regClass()
|
||
|
|
export class GameOver extends Laya.Script {
|
||
|
|
declare owner : Laya.Box;
|
||
|
|
|
||
|
|
|
||
|
|
@property(Laya.Button)
|
||
|
|
public btn_restart: Laya.Button
|
||
|
|
|
||
|
|
@property(Laya.Button)
|
||
|
|
public btn_new: Laya.Button
|
||
|
|
|
||
|
|
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
||
|
|
onAwake(): void {
|
||
|
|
this.btn_restart.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
||
|
|
UIManager.getInstance().loadStage("first", true);
|
||
|
|
this.owner.destroy()
|
||
|
|
})
|
||
|
|
|
||
|
|
this.btn_new.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
||
|
|
UIManager.getInstance().loadStage("first", true);
|
||
|
|
this.owner.destroy()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|