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) }