通用hover效果
This commit is contained in:
@@ -42,9 +42,6 @@ export class Home extends Laya.Script {
|
||||
@property(Laya.Box)
|
||||
public btn_new_white: Laya.Box
|
||||
|
||||
@property(Laya.Box)
|
||||
public btn_clean: Laya.Box
|
||||
|
||||
// 组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
||||
onAwake(): void {
|
||||
const user = StorageManager.getInstance().getUser()
|
||||
@@ -140,13 +137,6 @@ export class Home extends Laya.Script {
|
||||
}
|
||||
}
|
||||
|
||||
// 测试逻辑
|
||||
this.btn_clean.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
||||
console.log("btn_clean=", evt)
|
||||
StorageManager.getInstance().cleanAll()
|
||||
})
|
||||
this.btn_clean.visible = config.DEBUG
|
||||
// ======
|
||||
}
|
||||
|
||||
public onClickNew(_evt: Laya.Event): void {
|
||||
|
||||
20
src/views/common/CommonHover.ts
Normal file
20
src/views/common/CommonHover.ts
Normal 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
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
3
src/views/common/CommonHover.ts.meta
Normal file
3
src/views/common/CommonHover.ts.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"uuid": "a541bdfc-e8e1-4795-b68e-7138c5190f17"
|
||||
}
|
||||
Reference in New Issue
Block a user