From 2b4ff0638bd2f5936f4de6010e2b3409546bcc55 Mon Sep 17 00:00:00 2001 From: yangwen Date: Fri, 30 May 2025 16:52:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BB=A3=E7=A0=81=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Scene.ls | 5 ++-- src/Main.ts | 3 --- src/views/Block.ts | 1 - src/views/Home.ts | 1 - src/views/common/CommonHover.ts | 41 +++++++++++++++------------------ src/views/dc/CalendarUnit.ts | 4 +--- src/views/dc/DailyChallenge.ts | 2 +- 7 files changed, 24 insertions(+), 33 deletions(-) diff --git a/assets/Scene.ls b/assets/Scene.ls index 03fc9cd..5c8c235 100644 --- a/assets/Scene.ls +++ b/assets/Scene.ls @@ -17,7 +17,7 @@ { "_$type": "cd70cd5e-b4cd-4277-ac0a-2224cfbe89ac", "scriptPath": "../src/models/UIManager.ts", - "debug": true, + "debug": false, "mask": { "_$ref": "2668mvhf" }, @@ -64,7 +64,8 @@ "_$comp": [ { "_$type": "a541bdfc-e8e1-4795-b68e-7138c5190f17", - "scriptPath": "../src/views/common/CommonHover.ts" + "scriptPath": "../src/views/common/CommonHover.ts", + "hoverAlpha": true } ], "_$child": [ diff --git a/src/Main.ts b/src/Main.ts index 517bca6..6036893 100644 --- a/src/Main.ts +++ b/src/Main.ts @@ -1,4 +1,3 @@ -import { config } from "./constants/config" import { respath } from "./constants/respath" import { DCManager } from "./models/DCManager" import { LevelManager } from "./models/LevelManager" @@ -8,8 +7,6 @@ const { regClass } = Laya @regClass() export class Main extends Laya.Script { - - onAwake() { console.log("Game onAwake") DCManager.getInstance().init() diff --git a/src/views/Block.ts b/src/views/Block.ts index 376c464..6869363 100644 --- a/src/views/Block.ts +++ b/src/views/Block.ts @@ -1,5 +1,4 @@ import type { DOBlock } from "../models/DOBlock" -import { config } from "../constants/config" import { G_ShowScoreTips } from "../views/common/GUITips" const { regClass, property } = Laya diff --git a/src/views/Home.ts b/src/views/Home.ts index b0efee9..1bab2b3 100644 --- a/src/views/Home.ts +++ b/src/views/Home.ts @@ -136,7 +136,6 @@ export class Home extends Laya.Script { this.btn_go.visible = false } } - } public onClickNew(_evt: Laya.Event): void { diff --git a/src/views/common/CommonHover.ts b/src/views/common/CommonHover.ts index a225ef1..7afda2a 100644 --- a/src/views/common/CommonHover.ts +++ b/src/views/common/CommonHover.ts @@ -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 - } - }) - - } - -} \ No newline at end of file + 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 + } + }) + } +} diff --git a/src/views/dc/CalendarUnit.ts b/src/views/dc/CalendarUnit.ts index 080abb1..89beef9 100644 --- a/src/views/dc/CalendarUnit.ts +++ b/src/views/dc/CalendarUnit.ts @@ -1,5 +1,3 @@ -import { config } from "../../constants/config" - const { regClass, property } = Laya @regClass() @@ -48,7 +46,7 @@ export class CalendarUnit extends Laya.Script { // 组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次 onAwake(): void { - this.pieSize = this.sprite_pie.width /2 + this.pieSize = this.sprite_pie.width / 2 } public setCalendarUnit(year: number, month: number, day: number, open: boolean, progress: number, handler: any, func: any): void { diff --git a/src/views/dc/DailyChallenge.ts b/src/views/dc/DailyChallenge.ts index 4edfed3..b73cbc2 100644 --- a/src/views/dc/DailyChallenge.ts +++ b/src/views/dc/DailyChallenge.ts @@ -165,7 +165,7 @@ export class DailyChallenge extends Laya.Script { this.currentIndex = i break } - } + } this.loadWithIndex(this.currentIndex) }