20 lines
468 B
TypeScript
20 lines
468 B
TypeScript
|
|
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
|
||
|
|
})
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|