game pause
This commit is contained in:
19
src/views/common/AutoDestroy.ts
Normal file
19
src/views/common/AutoDestroy.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
const { regClass, property } = Laya;
|
||||
|
||||
@regClass()
|
||||
export class AutoDestroy extends Laya.Script {
|
||||
declare owner : Laya.Box;
|
||||
|
||||
@property(Number)
|
||||
public lifeTime: number = 1;
|
||||
|
||||
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
||||
onAwake(): void {
|
||||
if (this.lifeTime < 1) {
|
||||
this.lifeTime = 1
|
||||
}
|
||||
Laya.timer.once(this.lifeTime*1000, this, ()=>{
|
||||
this.owner.destroy()
|
||||
})
|
||||
}
|
||||
}
|
||||
3
src/views/common/AutoDestroy.ts.meta
Normal file
3
src/views/common/AutoDestroy.ts.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"uuid": "bdb0e671-99fa-47a5-9101-7ec008b1d25d"
|
||||
}
|
||||
13
src/views/common/CommonData.ts
Normal file
13
src/views/common/CommonData.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
const { regClass, property } = Laya;
|
||||
|
||||
@regClass()
|
||||
export class CommonData extends Laya.Script {
|
||||
declare owner : Laya.Box;
|
||||
|
||||
@property(Number)
|
||||
public intValue: number = 0;
|
||||
|
||||
@property(String)
|
||||
public strValue: string = "";
|
||||
|
||||
}
|
||||
3
src/views/common/CommonData.ts.meta
Normal file
3
src/views/common/CommonData.ts.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"uuid": "8857686b-9b2c-4e9c-af0f-0164c0994e46"
|
||||
}
|
||||
10
src/views/common/GUITips.ts
Normal file
10
src/views/common/GUITips.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { respath } from "../../constants/respath"
|
||||
|
||||
export function G_ShowScoreTips(text: string, parent: any): void {
|
||||
Laya.loader.load(respath.score_add_ui_res).then((go)=>{
|
||||
var prefab = go.create()
|
||||
var obj = parent.addChild(prefab)
|
||||
var Label = obj.getChildByName("offset").getChildByName("Label") as Laya.Label
|
||||
Label.text = text
|
||||
})
|
||||
}
|
||||
3
src/views/common/GUITips.ts.meta
Normal file
3
src/views/common/GUITips.ts.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"uuid": "0a00337c-1c20-470f-930f-2b47f0294e23"
|
||||
}
|
||||
Reference in New Issue
Block a user