import type { TrophyRecord } from "../../types/global" import { config } from "../../constants/config" import { MONTH_LIST } from "../../models/DCManager" const { regClass, property } = Laya @regClass() export class TrophyShow extends Laya.Script { declare owner: Laya.Box @property(Laya.Image) public icon: Laya.Image @property(Laya.Label) public label_date: Laya.Label @property(Laya.Box) public btn_close: Laya.Box public onSetShow(record: TrophyRecord): void { for (let i = 0; i < MONTH_LIST.length; i++) { const obj = MONTH_LIST[i] if (obj.year == record.year && obj.month == record.month) { this.icon.skin = obj.icon_res break } } this.label_date.text = `${config.MONTH_ABBRS[record.month - 1]} ${record.day},${record.year}` this.btn_close.on(Laya.Event.CLICK, this, () => { this.owner.destroy() }) } }