add trophy logic

This commit is contained in:
2025-05-22 14:54:48 +08:00
parent 16a5eb9e6b
commit 2bf07ab8f6
27 changed files with 587 additions and 127 deletions

36
src/views/TrophyClaim.ts Normal file
View File

@@ -0,0 +1,36 @@
import { config } from "../constants/config";
import { MONTH_LIST } from "../models/DCManager";
import { TrophyRecord } from "../types/global";
const { regClass, property } = Laya;
@regClass()
export class TrophyClaim 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 (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()
})
}
}