格式化代码
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
const { regClass, property } = Laya;
|
||||
const { regClass, property } = Laya
|
||||
|
||||
@regClass()
|
||||
export class AutoDestroy extends Laya.Script {
|
||||
declare owner : Laya.Box;
|
||||
declare owner: Laya.Box
|
||||
|
||||
@property(Number)
|
||||
public lifeTime: number = 1;
|
||||
@property(Number)
|
||||
public lifeTime: number = 1
|
||||
|
||||
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
||||
onStart(): void {
|
||||
if (this.lifeTime < 1) {
|
||||
this.lifeTime = 1
|
||||
}
|
||||
Laya.timer.once(this.lifeTime*1000, this, ()=>{
|
||||
this.owner.destroy()
|
||||
})
|
||||
// 组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
||||
onStart(): void {
|
||||
if (this.lifeTime < 1) {
|
||||
this.lifeTime = 1
|
||||
}
|
||||
}
|
||||
Laya.timer.once(this.lifeTime * 1000, this, () => {
|
||||
this.owner.destroy()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
const { regClass, property } = Laya;
|
||||
const { regClass, property } = Laya
|
||||
|
||||
@regClass()
|
||||
export class CommonData extends Laya.Script {
|
||||
declare owner : Laya.Box;
|
||||
declare owner: Laya.Box
|
||||
|
||||
@property(Number)
|
||||
public intValue: number = 0;
|
||||
@property(Number)
|
||||
public intValue: number = 0
|
||||
|
||||
@property(String)
|
||||
public strValue: string = "";
|
||||
|
||||
}
|
||||
@property(String)
|
||||
public strValue: string = ""
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ import { respath } from "../../constants/respath"
|
||||
import { ScoreAdd } from "../ScoreAdd"
|
||||
|
||||
export function G_ShowScoreTips(text: string, parent: any): void {
|
||||
Laya.loader.load(respath.score_add_ui_res()).then((go)=>{
|
||||
var prefab = go.create()
|
||||
var score = parent.addChild(prefab).getComponent(ScoreAdd)
|
||||
score.onSetText(text)
|
||||
})
|
||||
Laya.loader.load(respath.score_add_ui_res()).then((go) => {
|
||||
const prefab = go.create()
|
||||
const score = parent.addChild(prefab).getComponent(ScoreAdd)
|
||||
score.onSetText(text)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user