预加载字体
This commit is contained in:
@@ -48,6 +48,11 @@ export const respath = {
|
||||
return config.H_SCREEN ? "resources/dc/TrophyRoomCell_H.lh" : "resources/dc/TrophyRoomCell.lh"
|
||||
},
|
||||
|
||||
font_Bold : "fonts/Inter-Bold-700.ttf",
|
||||
font_Medium : "fonts/Inter-Medium-500.ttf",
|
||||
font_Regular : "fonts/Inter-Regular-400.ttf",
|
||||
font_SemiBold : "fonts/Inter-SemiBold-600.ttf",
|
||||
|
||||
// ===============================
|
||||
bg_done: "images/bg_done.png",
|
||||
bg_done_light: "images/bg_done_light.png",
|
||||
|
||||
@@ -73,11 +73,21 @@ export class UIManager extends Laya.Script {
|
||||
private trophyRoom: TrophyRoom
|
||||
|
||||
onStart(): void {
|
||||
if (config.H_SCREEN) {
|
||||
this.loadTopBarUI()
|
||||
} else {
|
||||
this.loadHomeUI()
|
||||
}
|
||||
const resources: Array<{ url: string, type?: any, lazy?: boolean }> = []
|
||||
resources.push({ url: respath.font_Bold, type: Laya.Loader.TTF })
|
||||
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 })
|
||||
Laya.loader.load(resources, Laya.Handler.create(this, (obj: object) => { // 第二个参数:成功回调
|
||||
console.log("预加载字体结束>>>>", obj)
|
||||
if (config.H_SCREEN) {
|
||||
this.loadTopBarUI()
|
||||
} else {
|
||||
this.loadHomeUI()
|
||||
}
|
||||
}), Laya.Handler.create(this, (resProg: number) => { // 第三个参数:进度回调
|
||||
console.log("预加载资源进度>>>>", resProg)
|
||||
}))
|
||||
}
|
||||
|
||||
public loadHomeUI(): void {
|
||||
|
||||
Reference in New Issue
Block a user