预加载特效序列帧
This commit is contained in:
@@ -50,11 +50,30 @@ export const respath = {
|
||||
|
||||
// ===============================
|
||||
bg_done: "images/bg_done.png",
|
||||
icon_star1: "images/star.png",
|
||||
icon_star2: "images/star2.png",
|
||||
|
||||
home_top_dc_bg_normal: "images/bg_dc_top1.png",
|
||||
home_top_dc_bg_finish: "images/bg_dc_top2.png",
|
||||
dc_top_bg_normal: "images/img_dc_bg2.png",
|
||||
dc_top_bg_finish: "images/img_dc_finished.png",
|
||||
dc_lights: new Array(),
|
||||
get_dc_lights: function func(): string[] {
|
||||
const prefix = "sequences/lottie_trophy_light_2x/lottie_trophy_light_2x_00"
|
||||
if (respath.dc_lights.length < 1) {
|
||||
for (let i = 0; i < 120; i++) {
|
||||
let endStr = i.toString()
|
||||
if (i < 10) {
|
||||
endStr = `00${i}`
|
||||
} else if (i < 100) {
|
||||
endStr = `0${i}`
|
||||
}
|
||||
const path = `${prefix + endStr}.png`
|
||||
respath.dc_lights.push(path)
|
||||
}
|
||||
}
|
||||
return respath.dc_lights
|
||||
},
|
||||
|
||||
trophy_bg_light_gold: "trophys/img_trophy_bg_light_gold.png",
|
||||
trophy_bg_light_grey: "trophys/img_trophy_bg_light_gray.png",
|
||||
|
||||
@@ -34,11 +34,17 @@ export class ResourceManager {
|
||||
}
|
||||
|
||||
this.resources.push({ url: respath.bg_done, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.icon_star1, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.icon_star2, type: Laya.Loader.IMAGE })
|
||||
|
||||
this.resources.push({ url: respath.home_top_dc_bg_normal, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.home_top_dc_bg_finish, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.dc_top_bg_normal, type: Laya.Loader.IMAGE })
|
||||
this.resources.push({ url: respath.dc_top_bg_finish, type: Laya.Loader.IMAGE })
|
||||
const dc_lights = respath.get_dc_lights()
|
||||
for (let i = 0; i < dc_lights.length; i++) {
|
||||
this.resources.push({ url: dc_lights[i], type: Laya.Loader.IMAGE })
|
||||
}
|
||||
|
||||
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 })
|
||||
|
||||
@@ -54,6 +54,10 @@ export class GameDone extends Laya.Script {
|
||||
|
||||
onAwake(): void {
|
||||
ResourceManager.getInstance().loadTexture(respath.bg_done, this.bg)
|
||||
ResourceManager.getInstance().loadTexture(respath.icon_star1, this.star1)
|
||||
ResourceManager.getInstance().loadTexture(respath.icon_star1, this.star2)
|
||||
ResourceManager.getInstance().loadTexture(respath.icon_star1, this.star3)
|
||||
ResourceManager.getInstance().loadTexture(respath.icon_star2, this.star4)
|
||||
|
||||
this.owner.x = 0
|
||||
this.owner.y = 0
|
||||
|
||||
@@ -48,7 +48,13 @@ export class UISequenceAnimation extends Laya.Script {
|
||||
}
|
||||
const path = `${this.prefix + endStr}.png`
|
||||
// ResourceManager.getInstance().loadTexture(path, this.image)
|
||||
this.owner.skin = path
|
||||
const obj = Laya.Loader.getRes(path)
|
||||
if (obj) {
|
||||
this.owner.texture = obj
|
||||
} else {
|
||||
this.owner.skin = path
|
||||
}
|
||||
|
||||
|
||||
this.currentIndex++
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user