Files
sudoku/src/views/dc/TrophyShow.ts

37 lines
965 B
TypeScript
Raw Normal View History

2025-05-22 14:54:48 +08:00
2025-05-23 20:47:03 +08:00
import { config } from "../../constants/config";
import { MONTH_LIST } from "../../models/DCManager";
import { TrophyRecord } from "../../types/global";
2025-05-22 14:54:48 +08:00
2025-05-22 10:55:37 +08:00
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
2025-05-22 14:54:48 +08:00
public onSetShow(record: TrophyRecord): void {
for (var i=0; i<MONTH_LIST.length; i++) {
var 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()
})
2025-05-22 10:55:37 +08:00
}
}