修正代码格式

This commit is contained in:
2025-05-30 16:52:51 +08:00
parent 84d1ac4798
commit 2b4ff0638b
7 changed files with 24 additions and 33 deletions

View File

@@ -1,27 +1,24 @@
const { regClass, property } = Laya;
const { regClass, property } = Laya
@regClass()
export class CommonHover extends Laya.Script {
declare owner : Laya.Box;
declare owner: Laya.Box
@property(Boolean)
public hoverAlpha: boolean = true
@property(Boolean)
public hoverAlpha: boolean = true
onAwake(): void {
this.owner.on(Laya.Event.MOUSE_OVER, this, ()=>{
Laya.Render.canvas.style.cursor = "pointer"
if (this.hoverAlpha) {
this.owner.alpha = 0.7
}
})
this.owner.on(Laya.Event.MOUSE_OUT, this, ()=>{
Laya.Render.canvas.style.cursor = ""
if (this.hoverAlpha) {
this.owner.alpha = 1
}
})
}
}
onAwake(): void {
this.owner.on(Laya.Event.MOUSE_OVER, this, () => {
Laya.Render.canvas.style.cursor = "pointer"
if (this.hoverAlpha) {
this.owner.alpha = 0.7
}
})
this.owner.on(Laya.Event.MOUSE_OUT, this, () => {
Laya.Render.canvas.style.cursor = ""
if (this.hoverAlpha) {
this.owner.alpha = 1
}
})
}
}