整理代码格式

This commit is contained in:
2025-06-05 10:34:58 +08:00
parent 55427c473a
commit 10333a3bdc
4 changed files with 67 additions and 74 deletions

View File

@@ -1,6 +1,3 @@
export class ResourceManager { export class ResourceManager {
private static instance: ResourceManager private static instance: ResourceManager
public static getInstance(): ResourceManager { public static getInstance(): ResourceManager {
@@ -9,5 +6,4 @@ export class ResourceManager {
} }
return ResourceManager.instance return ResourceManager.instance
} }
} }

View File

@@ -1,8 +1,7 @@
const { regClass, property } = Laya; const { regClass, property } = Laya
@regClass() @regClass()
export class Script extends Laya.Script { export class Script extends Laya.Script {
@property(Laya.Label) @property(Laya.Label)
public title: Laya.Label public title: Laya.Label
@@ -13,7 +12,7 @@ export class Script extends Laya.Script {
public obj_eases: Laya.Box public obj_eases: Laya.Box
onAwake(): void { onAwake(): void {
let list = [] const list: Array<any> = []
list.push(Laya.Ease.backIn) list.push(Laya.Ease.backIn)
list.push(Laya.Ease.backInOut) list.push(Laya.Ease.backInOut)
list.push(Laya.Ease.backOut) list.push(Laya.Ease.backOut)
@@ -66,17 +65,17 @@ export class Script extends Laya.Script {
this.title.text = "" this.title.text = ""
for (let i = 0; i<list.length; i++) { for (let i = 0; i < list.length; i++) {
const label = this.obj_eases.getChildAt(i) as Laya.Label const label = this.obj_eases.getChildAt(i) as Laya.Label
label.text = list[i].name label.text = list[i].name
label.on(Laya.Event.CLICK, this, (evt: Laya.Event)=>{ label.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
const label = evt.target as Laya.Label const label = evt.target as Laya.Label
this.title.text = label.text this.title.text = label.text
this.icon.x = 400 this.icon.x = 400
for (let j=0; j<list.length; j++) { for (let j = 0; j < list.length; j++) {
const obj = list[j] const obj = list[j]
if (obj.name === label.text) { if (obj.name === label.text) {
Laya.Tween.to(this.icon, {x: 1500}, 2000, obj) Laya.Tween.to(this.icon, { x: 1500 }, 2000, obj)
break break
} }
} }

View File

@@ -18,7 +18,6 @@ export class ScoreAdd extends Laya.Script {
} }
onStart(): void { onStart(): void {
Laya.Tween.to(this.label, { scaleX: 1, scaleY: 1 }, 300, Laya.Ease.bounceIn, null, 0) Laya.Tween.to(this.label, { scaleX: 1, scaleY: 1 }, 300, Laya.Ease.bounceIn, null, 0)
Laya.Tween.to(this.label, { y: -102 }, 300, Laya.Ease.linearOut, null, 500) Laya.Tween.to(this.label, { y: -102 }, 300, Laya.Ease.linearOut, null, 500)

View File

@@ -143,12 +143,11 @@ export class Stage extends Laya.Script {
this.btn_hint_ad = this.btn_hint.getChildByName("Image").getChildByName("ad") as Laya.Box this.btn_hint_ad = this.btn_hint.getChildByName("Image").getChildByName("ad") as Laya.Box
this.btn_hint_label = this.btn_hint.getChildByName("Image").getChildByName("normal").getChildByName("label") as Laya.Label this.btn_hint_label = this.btn_hint.getChildByName("Image").getChildByName("normal").getChildByName("label") as Laya.Label
// 失去舞台焦点(切出游戏)的处理
//失去舞台焦点(切出游戏)的处理
Laya.stage.on(Laya.Event.BLUR, this, () => { Laya.stage.on(Laya.Event.BLUR, this, () => {
Stage.EventUpdatePause(true) Stage.EventUpdatePause(true)
}) })
//获得舞台焦点(切回游戏)的处理 // 获得舞台焦点(切回游戏)的处理
Laya.stage.on(Laya.Event.FOCUS, this, () => { Laya.stage.on(Laya.Event.FOCUS, this, () => {
Stage.EventUpdatePause(false) Stage.EventUpdatePause(false)
}) })