36 lines
956 B
TypeScript
36 lines
956 B
TypeScript
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()
|
|
})
|
|
}
|
|
|
|
} |