预加载home页资源
This commit is contained in:
@@ -83,16 +83,20 @@ export const respath = {
|
||||
trophy_bg_light_gold: "trophys/img_trophy_bg_light_gold.png",
|
||||
trophy_bg_light_grey: "trophys/img_trophy_bg_light_gray.png",
|
||||
|
||||
trophy_01: "trophys/trophy_01.png",
|
||||
trophy_02: "trophys/trophy_02.png",
|
||||
trophy_03: "trophys/trophy_03.png",
|
||||
trophy_04: "trophys/trophy_04.png",
|
||||
trophy_05: "trophys/trophy_05.png",
|
||||
trophy_06: "trophys/trophy_06.png",
|
||||
trophy_07: "trophys/trophy_07.png",
|
||||
trophy_08: "trophys/trophy_08.png",
|
||||
trophy_09: "trophys/trophy_09.png",
|
||||
trophy_10: "trophys/trophy_10.png",
|
||||
trophy_11: "trophys/trophy_11.png",
|
||||
trophy_12: "trophys/trophy_12.png"
|
||||
trophys: function func(): string[] {
|
||||
const list: Array<string> = []
|
||||
list.push("trophys/trophy_01.png")
|
||||
list.push("trophys/trophy_02.png")
|
||||
list.push("trophys/trophy_03.png")
|
||||
list.push("trophys/trophy_04.png")
|
||||
list.push("trophys/trophy_05.png")
|
||||
list.push("trophys/trophy_06.png")
|
||||
list.push("trophys/trophy_07.png")
|
||||
list.push("trophys/trophy_08.png")
|
||||
list.push("trophys/trophy_09.png")
|
||||
list.push("trophys/trophy_10.png")
|
||||
list.push("trophys/trophy_11.png")
|
||||
list.push("trophys/trophy_12.png")
|
||||
return list
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +1,7 @@
|
||||
import { respath } from "../constants/respath"
|
||||
|
||||
export const MONTH_LIST = [
|
||||
{ year: 2024, month: 12, begin: 0, dayCount: 31, icon_res: respath.trophy_12 }
|
||||
|
||||
// { year: 2025, month: 1, begin: 3, dayCount: 31, icon_res: respath.trophy_01 },
|
||||
// { year: 2025, month: 2, begin: 6, dayCount: 30, icon_res: respath.trophy_02 },
|
||||
// { year: 2025, month: 3, begin: 6, dayCount: 31, icon_res: respath.trophy_03 },
|
||||
// { year: 2025, month: 4, begin: 2, dayCount: 30, icon_res: respath.trophy_04 },
|
||||
// { year: 2025, month: 5, begin: 4, dayCount: 31, icon_res: respath.trophy_05 },
|
||||
// { year: 2025, month: 6, begin: 0, dayCount: 30, icon_res: respath.trophy_06 },
|
||||
// { year: 2025, month: 7, begin: 2, dayCount: 31, icon_res: respath.trophy_07 },
|
||||
// { year: 2025, month: 8, begin: 5, dayCount: 31, icon_res: respath.trophy_08 },
|
||||
// { year: 2025, month: 9, begin: 1, dayCount: 30, icon_res: respath.trophy_09 },
|
||||
// { year: 2025, month: 10, begin: 3, dayCount: 31, icon_res: respath.trophy_10 },
|
||||
// { year: 2025, month: 11, begin: 6, dayCount: 30, icon_res: respath.trophy_11 },
|
||||
// { year: 2025, month: 12, begin: 1, dayCount: 31, icon_res: respath.trophy_12 },
|
||||
|
||||
// { year: 2026, month: 1, begin: 4, dayCount: 31, icon_res: respath.trophy_01 },
|
||||
// { year: 2026, month: 2, begin: 0, dayCount: 30, icon_res: respath.trophy_02 },
|
||||
// { year: 2026, month: 3, begin: 0, dayCount: 31, icon_res: respath.trophy_03 },
|
||||
// { year: 2026, month: 4, begin: 3, dayCount: 30, icon_res: respath.trophy_04 },
|
||||
// { year: 2026, month: 5, begin: 5, dayCount: 31, icon_res: respath.trophy_05 },
|
||||
// { year: 2026, month: 6, begin: 1, dayCount: 30, icon_res: respath.trophy_06 },
|
||||
// { year: 2026, month: 7, begin: 3, dayCount: 31, icon_res: respath.trophy_07 },
|
||||
// { year: 2026, month: 8, begin: 6, dayCount: 31, icon_res: respath.trophy_08 },
|
||||
// { year: 2026, month: 9, begin: 2, dayCount: 30, icon_res: respath.trophy_09 },
|
||||
// { year: 2026, month: 10, begin: 4, dayCount: 31, icon_res: respath.trophy_10 },
|
||||
// { year: 2026, month: 11, begin: 0, dayCount: 30, icon_res: respath.trophy_11 },
|
||||
// { year: 2026, month: 12, begin: 2, dayCount: 31, icon_res: respath.trophy_12 }
|
||||
{ year: 2024, month: 12, begin: 0, dayCount: 31, icon_res: respath.trophys()[11] }
|
||||
]
|
||||
|
||||
export function G_getMonthInfo(year: number, month: number): any {
|
||||
@@ -50,20 +24,6 @@ export class DCManager {
|
||||
}
|
||||
|
||||
public init(): void {
|
||||
const trophys: Array<string> = []
|
||||
trophys.push(respath.trophy_01)
|
||||
trophys.push(respath.trophy_02)
|
||||
trophys.push(respath.trophy_03)
|
||||
trophys.push(respath.trophy_04)
|
||||
trophys.push(respath.trophy_05)
|
||||
trophys.push(respath.trophy_06)
|
||||
trophys.push(respath.trophy_07)
|
||||
trophys.push(respath.trophy_08)
|
||||
trophys.push(respath.trophy_09)
|
||||
trophys.push(respath.trophy_10)
|
||||
trophys.push(respath.trophy_11)
|
||||
trophys.push(respath.trophy_12)
|
||||
|
||||
const now = new Date()
|
||||
const nowYear = now.getFullYear()
|
||||
const nowMonth = now.getMonth() + 1
|
||||
@@ -84,7 +44,7 @@ export class DCManager {
|
||||
const seconds = date2.getTime() - date1.getTime()
|
||||
const dayCount = Math.round(seconds / 1000 / 86400)
|
||||
const begin = date1.getDay()
|
||||
MONTH_LIST.push({ year: i, month: j, begin, dayCount, icon_res: trophys[j - 1] })
|
||||
MONTH_LIST.push({ year: i, month: j, begin, dayCount, icon_res: respath.trophys()[j - 1] })
|
||||
if (i === year && j === month) {
|
||||
b = true
|
||||
break
|
||||
|
||||
@@ -72,18 +72,10 @@ export class ResourceManager {
|
||||
|
||||
this.resources.push({ url: respath.trophy_bg_light_gold, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.trophy_bg_light_grey, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.trophy_01, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.trophy_02, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.trophy_03, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.trophy_04, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.trophy_05, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.trophy_06, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.trophy_07, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.trophy_08, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.trophy_09, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.trophy_10, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.trophy_11, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.trophy_12, type: Laya.Loader.IMAGE })
|
||||
const trophys = respath.trophys()
|
||||
for (let i = 0; i < trophys.length; i++) {
|
||||
this.resources.push({ url: trophys[i], type: Laya.Loader.IMAGE })
|
||||
}
|
||||
|
||||
Laya.loader.load(this.resources, Laya.Handler.create(this, (obj: object) => { // 第二个参数:成功回调
|
||||
console.log("预加载资源结束>>>>", obj)
|
||||
|
||||
@@ -78,6 +78,13 @@ export class UIManager extends Laya.Script {
|
||||
resources.push({ url: respath.font_Medium, type: Laya.Loader.TTF })
|
||||
resources.push({ url: respath.font_Regular, type: Laya.Loader.TTF })
|
||||
resources.push({ url: respath.font_SemiBold, type: Laya.Loader.TTF })
|
||||
if (!config.H_SCREEN) {//竖屏情况下预加载dc奖杯
|
||||
resources.push({ url: respath.home_top_dc_bg_normal, type: Laya.Loader.IMAGE })
|
||||
resources.push({ url: respath.home_top_dc_bg_finish, type: Laya.Loader.IMAGE })
|
||||
const now = new Date()
|
||||
const nowMonth = now.getMonth()
|
||||
resources.push({ url: respath.trophys()[nowMonth], type: Laya.Loader.IMAGE })
|
||||
}
|
||||
Laya.loader.load(resources, Laya.Handler.create(this, (obj: object) => { // 第二个参数:成功回调
|
||||
console.log("预加载字体结束>>>>", obj)
|
||||
if (config.H_SCREEN) {
|
||||
|
||||
Reference in New Issue
Block a user