add trophy logic
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { config } from "../constants/config";
|
||||
import { respath } from "../constants/respath";
|
||||
import { StorageManager } from "../models/StorageManager";
|
||||
import { UIManager } from "../models/UIManager";
|
||||
|
||||
const { regClass, property } = Laya;
|
||||
|
||||
@@ -19,7 +20,7 @@ export class TrophyUnit extends Laya.Script {
|
||||
|
||||
public onInit(info: any): void {
|
||||
var user = StorageManager.getInstance().getUser()
|
||||
var starCount = user.get_doneCountBydate(info.year, info.month)
|
||||
var starCount = user.get_doneCountByDate(info.year, info.month)
|
||||
this.icon.skin = info.icon_res
|
||||
this.label_count.text = `${starCount}/${info.dayCount}`
|
||||
this.label_month.text = config.MONTH_ABBRS[info.month-1]
|
||||
@@ -35,7 +36,10 @@ export class TrophyUnit extends Laya.Script {
|
||||
}
|
||||
|
||||
this.icon.on(Laya.Event.CLICK, this, ()=>{
|
||||
|
||||
var find = user.get_trophyRecord(info.year, info.month)
|
||||
if (find) {
|
||||
UIManager.getInstance().loadTrophyShowUI(find)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user