增加图片预加载逻辑
This commit is contained in:
@@ -2,6 +2,7 @@ import { config } from "../../constants/config"
|
||||
import { respath } from "../../constants/respath"
|
||||
import { MONTH_LIST } from "../../models/DCManager"
|
||||
import { EVENT_TYPES, EventManager } from "../../models/EventManager"
|
||||
import { ResourceManager } from "../../models/ResourceManager"
|
||||
import { StorageManager } from "../../models/StorageManager"
|
||||
import { UIManager } from "../../models/UIManager"
|
||||
import { Utility_ConvertSecondToString } from "../../utils/utility"
|
||||
@@ -188,14 +189,14 @@ export class DailyChallenge extends Laya.Script {
|
||||
const nowMonth = now.getMonth() + 1
|
||||
const nowDay = new Date().getDate()
|
||||
|
||||
this.trophy_icon.skin = info.icon_res
|
||||
ResourceManager.getInstance().loadTexture(info.icon_res, this.trophy_icon)
|
||||
// 设置背景
|
||||
if (user.get_trophyRecord(info.year, info.month)) {
|
||||
this.bg_dc.skin = respath.dc_top_bg_month_finish
|
||||
ResourceManager.getInstance().loadTexture(respath.dc_top_bg_finish, this.bg_dc)
|
||||
this.trophy_light.visible = true
|
||||
this.trophy_icon.gray = false
|
||||
} else {
|
||||
this.bg_dc.skin = respath.dc_top_bg_normal
|
||||
ResourceManager.getInstance().loadTexture(respath.dc_top_bg_normal, this.bg_dc)
|
||||
this.trophy_light.visible = false
|
||||
this.trophy_icon.gray = true
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { TrophyRecord } from "../../types/global"
|
||||
import { config } from "../../constants/config"
|
||||
import { MONTH_LIST } from "../../models/DCManager"
|
||||
import { ResourceManager } from "../../models/ResourceManager"
|
||||
|
||||
const { regClass, property } = Laya
|
||||
|
||||
@@ -21,7 +22,7 @@ export class TrophyClaim extends Laya.Script {
|
||||
for (let i = 0; i < MONTH_LIST.length; i++) {
|
||||
const obj = MONTH_LIST[i]
|
||||
if (obj.year === record.year && obj.month === record.month) {
|
||||
this.icon.skin = obj.icon_res
|
||||
ResourceManager.getInstance().loadTexture(obj.icon_res, this.icon)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { TrophyRecord } from "../../types/global"
|
||||
import { config } from "../../constants/config"
|
||||
import { MONTH_LIST } from "../../models/DCManager"
|
||||
import { ResourceManager } from "../../models/ResourceManager"
|
||||
|
||||
const { regClass, property } = Laya
|
||||
|
||||
@@ -21,7 +22,7 @@ export class TrophyShow extends Laya.Script {
|
||||
for (let i = 0; i < MONTH_LIST.length; i++) {
|
||||
const obj = MONTH_LIST[i]
|
||||
if (obj.year === record.year && obj.month === record.month) {
|
||||
this.icon.skin = obj.icon_res
|
||||
ResourceManager.getInstance().loadTexture(obj.icon_res, this.icon)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { config } from "../../constants/config"
|
||||
import { respath } from "../../constants/respath"
|
||||
import { ResourceManager } from "../../models/ResourceManager"
|
||||
import { StorageManager } from "../../models/StorageManager"
|
||||
import { UIManager } from "../../models/UIManager"
|
||||
|
||||
@@ -24,15 +25,15 @@ export class TrophyUnit extends Laya.Script {
|
||||
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
|
||||
ResourceManager.getInstance().loadTexture(info.icon_res, this.icon)
|
||||
this.label_count.text = `${starCount}/${info.dayCount}`
|
||||
this.label_month.text = config.MONTH_ABBRS[info.month - 1]
|
||||
if (user.get_trophyRecord(info.year, info.month)) {
|
||||
this.bg_light.skin = respath.trophy_bg_light_gold
|
||||
ResourceManager.getInstance().loadTexture(respath.trophy_bg_light_gold, this.bg_light)
|
||||
this.icon.gray = false
|
||||
this.label_month.color = "#2d3138"
|
||||
} else {
|
||||
this.bg_light.skin = respath.trophy_bg_light_grey
|
||||
ResourceManager.getInstance().loadTexture(respath.trophy_bg_light_grey, this.bg_light)
|
||||
this.icon.gray = true
|
||||
this.label_month.color = "#a7abb3"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user