格式化代码

This commit is contained in:
2025-05-28 18:47:51 +08:00
parent 6d44fc21b4
commit a7df8ec739
38 changed files with 2768 additions and 2840 deletions

View File

@@ -1,45 +1,47 @@
import { config } from "../../constants/config";
import { respath } from "../../constants/respath";
import { StorageManager } from "../../models/StorageManager";
import { UIManager } from "../../models/UIManager";
import { config } from "../../constants/config"
import { respath } from "../../constants/respath"
import { StorageManager } from "../../models/StorageManager"
import { UIManager } from "../../models/UIManager"
const { regClass, property } = Laya;
const { regClass, property } = Laya
@regClass()
export class TrophyUnit extends Laya.Script {
declare owner : Laya.Box;
declare owner: Laya.Box
@property(Laya.Image)
public bg_light: Laya.Image;
@property(Laya.Image)
public icon: Laya.Image;
@property(Laya.Label)
public label_count: Laya.Label;
@property(Laya.Label)
public label_month: Laya.Label;
@property(Laya.Image)
public bg_light: Laya.Image
public onInit(info: any): void {
var user = StorageManager.getInstance().getUser()
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]
if (starCount >= info.dayCount) {
this.bg_light.skin = respath.trophy_bg_light_gold
this.icon.gray = false
this.label_month.color = "#2d3138"
}
else {
this.bg_light.skin = respath.trophy_bg_light_grey
this.icon.gray = true
this.label_month.color = "#a7abb3"
}
@property(Laya.Image)
public icon: Laya.Image
this.icon.on(Laya.Event.CLICK, this, ()=>{
var find = user.get_trophyRecord(info.year, info.month)
if (find) {
UIManager.getInstance().loadTrophyShowUI(find)
}
})
@property(Laya.Label)
public label_count: Laya.Label
@property(Laya.Label)
public label_month: Laya.Label
public onInit(info: any): void {
const user = StorageManager.getInstance().getUser()
const 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]
if (starCount >= info.dayCount) {
this.bg_light.skin = respath.trophy_bg_light_gold
this.icon.gray = false
this.label_month.color = "#2d3138"
} else {
this.bg_light.skin = respath.trophy_bg_light_grey
this.icon.gray = true
this.label_month.color = "#a7abb3"
}
}
this.icon.on(Laya.Event.CLICK, this, () => {
const find = user.get_trophyRecord(info.year, info.month)
if (find) {
UIManager.getInstance().loadTrophyShowUI(find)
}
})
}
}