通用hover效果

This commit is contained in:
2025-05-30 11:52:25 +08:00
parent 6d4bb79a45
commit 23a2f686cb
12 changed files with 395 additions and 122 deletions

View File

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

View File

@@ -0,0 +1,3 @@
{
"uuid": "a541bdfc-e8e1-4795-b68e-7138c5190f17"
}