From ea0e00f49589c775aa6f6b57336c05a3fb6941e2 Mon Sep 17 00:00:00 2001 From: yangwen Date: Thu, 19 Jun 2025 20:12:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=83=8C=E6=99=AF=E5=8A=A8?= =?UTF-8?q?=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Difficulty.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/views/Difficulty.ts b/src/views/Difficulty.ts index 4cfd264..fcae667 100644 --- a/src/views/Difficulty.ts +++ b/src/views/Difficulty.ts @@ -1,4 +1,5 @@ import { config } from "../constants/config" +import { Utility_EaseOut, Utility_EaseOut_2 } from "../utils/utility" import { CommonData } from "./common/CommonData" const { regClass, property } = Laya @@ -10,9 +11,14 @@ export class Difficulty extends Laya.Script { @property(Laya.Box) public obj_items: Laya.Box + private mask: Laya.Image private offset: Laya.Box - // 组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次 + onAwake(): void { + this.mask = this.owner.getChildByName("mask") as Laya.Image + this.mask.alpha = 0 + Laya.Tween.to(this.mask, { alpha: 0.4 }, 400, Utility_EaseOut) + this.offset = this.owner.getChildByName("bottom").getChildByName("offset") as Laya.Box this.offset.y = this.offset.width @@ -23,11 +29,17 @@ export class Difficulty extends Laya.Script { const mask = this.owner.getChildByName("mask") mask.on(Laya.Event.CLICK, this, () => { Laya.Tween.to(this.offset, { y: 2400 }, 200, null, Laya.Handler.create(this, () => { - this.owner.destroy() + this.destroyUI() })) }) } +destroyUI(): void { + Laya.Tween.to(this.mask, { alpha: 0 }, 400, Utility_EaseOut_2, Laya.Handler.create(this, () => { + this.owner.destroy() + })) +} + onStart(): void { Laya.Tween.to(this.offset, { y: 0 }, 200) }