整理代码格式

This commit is contained in:
2025-06-10 18:24:50 +08:00
parent 285a1f9efe
commit 17c25ca099
18 changed files with 108 additions and 116 deletions

View File

@@ -70,10 +70,9 @@ export class ResourceManager {
console.log("预加载资源进度>>>>", resProg)
}))
Laya.timer.frameLoop(1, this, ()=>{
let removes: Array<any> = []
this.prefabReqs.forEach((list: Array<any>, path: string)=>{
Laya.timer.frameLoop(1, this, () => {
const removes: Array<any> = []
this.prefabReqs.forEach((list: Array<any>, path: string) => {
const obj = Laya.loader.getRes(path)
if (obj) {
removes.push(path)
@@ -157,5 +156,4 @@ export class ResourceManager {
}
}
}
}

View File

@@ -11,9 +11,8 @@ import { GameOver } from "../views/GameOver"
import { GamePause } from "../views/GamePause"
import { Stage } from "../views/Stage"
import { TopBar } from "../views/TopBar"
import { StorageManager } from "./StorageManager"
import { ResourceManager } from "./ResourceManager"
import Lottie from "lottie-web"
import { StorageManager } from "./StorageManager"
const { regClass, property } = Laya
@@ -82,14 +81,14 @@ export class UIManager extends Laya.Script {
}
public loadHomeUI(): void {
ResourceManager.getInstance().loadPrefab(respath.home_ui_res, (go: any)=> {
ResourceManager.getInstance().loadPrefab(respath.home_ui_res, (go: any) => {
const prefab = go.create()
this.getUIRoot().addChild(prefab)
})
}
public loadTopBarUI(): void {
ResourceManager.getInstance().loadPrefab(respath.topbar_ui_res, (go: any)=> {
ResourceManager.getInstance().loadPrefab(respath.topbar_ui_res, (go: any) => {
const prefab = go.create()
this.topbar = this.getUIRoot().addChild(prefab).getComponent(TopBar)
})
@@ -109,7 +108,7 @@ export class UIManager extends Laya.Script {
public loadDCUI(): void {
this.mask.visible = true
ResourceManager.getInstance().loadPrefab(respath.dc_ui_res(), (go: any)=> {
ResourceManager.getInstance().loadPrefab(respath.dc_ui_res(), (go: any) => {
const prefab = go.create()
this.dc_ui = this.getUIRoot().addChild(prefab).getComponent(DailyChallenge)
if (this.dc_year <= 0 || this.dc_month <= 0) {
@@ -137,7 +136,7 @@ export class UIManager extends Laya.Script {
}
public loadTrophyClaimUI(record: TrophyRecord): void {
ResourceManager.getInstance().loadPrefab(respath.trophy_claim_ui_res(), (go: any)=> {
ResourceManager.getInstance().loadPrefab(respath.trophy_claim_ui_res(), (go: any) => {
const prefab = go.create()
const obj = this.getUIRoot().addChild(prefab).getComponent(TrophyClaim)
obj.onSetShow(record)
@@ -146,7 +145,7 @@ export class UIManager extends Laya.Script {
public loadTrophyUI(): void {
this.mask.visible = true
ResourceManager.getInstance().loadPrefab(respath.trophy_ui_res(), (go: any)=> {
ResourceManager.getInstance().loadPrefab(respath.trophy_ui_res(), (go: any) => {
const prefab = go.create()
this.trophyRoom = this.getUIRoot().addChild(prefab).getComponent(TrophyRoom)
this.mask.visible = false
@@ -162,7 +161,7 @@ export class UIManager extends Laya.Script {
public loadTrophyShowUI(record: TrophyRecord): void {
this.mask.visible = true
ResourceManager.getInstance().loadPrefab(respath.trophy_show_ui_res(), (go: any)=> {
ResourceManager.getInstance().loadPrefab(respath.trophy_show_ui_res(), (go: any) => {
const prefab = go.create()
const obj = this.getUIRoot().addChild(prefab).getComponent(TrophyShow)
obj.onSetShow(record)
@@ -174,7 +173,7 @@ export class UIManager extends Laya.Script {
if (this.stage) {
this.stage.onLoadStage(StorageManager.getInstance().loadStage(stageID))
} else {
ResourceManager.getInstance().loadPrefab(respath.stage_ui_res(), (go: any)=> {
ResourceManager.getInstance().loadPrefab(respath.stage_ui_res(), (go: any) => {
const prefab = go.create()
this.stage = this.getUIRoot().addChild(prefab).getComponent(Stage)
this.stage.onLoadStage(StorageManager.getInstance().loadStage(stageID))
@@ -191,7 +190,7 @@ export class UIManager extends Laya.Script {
public loadGamePauseUI(doStage: DOStage): void {
this.mask.visible = true
ResourceManager.getInstance().loadPrefab(respath.gamepause_ui_res(), (go: any)=> {
ResourceManager.getInstance().loadPrefab(respath.gamepause_ui_res(), (go: any) => {
const prefab = go.create()
const ui = this.getUIRoot().addChild(prefab).getComponent(GamePause)
ui.onSetStageInfo(doStage)
@@ -201,7 +200,7 @@ export class UIManager extends Laya.Script {
public loadGameOverUI(doStage: DOStage): void {
this.mask.visible = true
ResourceManager.getInstance().loadPrefab(respath.gameover_ui_res(), (go: any)=> {
ResourceManager.getInstance().loadPrefab(respath.gameover_ui_res(), (go: any) => {
const prefab = go.create()
const ui = this.getUIRoot().addChild(prefab).getComponent(GameOver)
ui.onSetStageInfo(doStage)
@@ -211,7 +210,7 @@ export class UIManager extends Laya.Script {
public loadGameDoneUI(isClassic: boolean, doStage: DOStage): void {
this.mask.visible = true
ResourceManager.getInstance().loadPrefab(respath.gamedone_ui_res(isClassic), (go: any)=> {
ResourceManager.getInstance().loadPrefab(respath.gamedone_ui_res(isClassic), (go: any) => {
const prefab = go.create()
const ui = this.getUIRoot().addChild(prefab).getComponent(GameDone)
ui.onSetStageInfo(doStage)