添加预制预加载逻辑
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { respath } from "../constants/respath"
|
||||
import { ResourceManager } from "../models/ResourceManager"
|
||||
import { UIManager } from "../models/UIManager"
|
||||
|
||||
const { regClass, property } = Laya
|
||||
|
||||
export function G_ShowCommonTips(title: string, content: string, showToggle: boolean, func: any): void {
|
||||
Laya.loader.load(respath.common_tips_ui_res).then((go) => {
|
||||
ResourceManager.getInstance().loadPrefab(respath.common_tips_ui_res, (go: any)=> {
|
||||
const prefab = go.create()
|
||||
const obj = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(CommonTips)
|
||||
obj.showCommonTips(title, content, showToggle, func)
|
||||
|
||||
@@ -5,6 +5,7 @@ import { StorageManager } from "../models/StorageManager"
|
||||
import { UIManager } from "../models/UIManager"
|
||||
import { Utility_ConvertSecondToString } from "../utils/utility"
|
||||
import { Difficulty } from "./Difficulty"
|
||||
import { ResourceManager } from "../models/ResourceManager"
|
||||
|
||||
const { regClass, property } = Laya
|
||||
|
||||
@@ -115,7 +116,7 @@ export class GameDone extends Laya.Script {
|
||||
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID)
|
||||
this.owner.destroy()
|
||||
} else {
|
||||
Laya.loader.load(respath.difficulty_ui_res).then((go) => {
|
||||
ResourceManager.getInstance().loadPrefab(respath.difficulty_ui_res, (go: any)=> {
|
||||
const prefab = go.create()
|
||||
const d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
||||
d.onInit((value: string) => {
|
||||
|
||||
@@ -5,6 +5,7 @@ import { EVENT_TYPES, EventManager } from "../models/EventManager"
|
||||
import { StorageManager } from "../models/StorageManager"
|
||||
import { UIManager } from "../models/UIManager"
|
||||
import { Difficulty } from "./Difficulty"
|
||||
import { ResourceManager } from "../models/ResourceManager"
|
||||
|
||||
const { regClass, property } = Laya
|
||||
|
||||
@@ -52,7 +53,7 @@ export class GameOver extends Laya.Script {
|
||||
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID)
|
||||
this.owner.destroy()
|
||||
} else {
|
||||
Laya.loader.load(respath.difficulty_ui_res).then((go) => {
|
||||
ResourceManager.getInstance().loadPrefab(respath.difficulty_ui_res, (go: any)=> {
|
||||
const prefab = go.create()
|
||||
const d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
||||
d.onInit((value: string) => {
|
||||
|
||||
@@ -139,7 +139,7 @@ export class Home extends Laya.Script {
|
||||
}
|
||||
|
||||
public onClickNew(_evt: Laya.Event): void {
|
||||
Laya.loader.load(respath.difficulty_ui_res).then((go) => {
|
||||
ResourceManager.getInstance().loadPrefab(respath.difficulty_ui_res, (go: any)=> {
|
||||
const prefab = go.create()
|
||||
const d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
||||
d.onInit((value: string) => {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { respath } from "../../constants/respath"
|
||||
import { ResourceManager } from "../../models/ResourceManager"
|
||||
import { ScoreAdd } from "../ScoreAdd"
|
||||
|
||||
export function G_ShowScoreTips(text: string, parent: any): void {
|
||||
Laya.loader.load(respath.score_add_ui_res()).then((go) => {
|
||||
ResourceManager.getInstance().loadPrefab(respath.score_add_ui_res(), (go: any)=> {
|
||||
const prefab = go.create()
|
||||
const score = parent.addChild(prefab).getComponent(ScoreAdd)
|
||||
score.onSetText(text)
|
||||
|
||||
@@ -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 { UIManager } from "../../models/UIManager"
|
||||
import { TrophyUnit } from "./TrophyUnit"
|
||||
|
||||
@@ -55,7 +56,7 @@ export class TrophyRoom extends Laya.Script {
|
||||
list.push(obj)
|
||||
}
|
||||
console.log(">>>>>>>>>>>>years=", years)
|
||||
Laya.loader.load(respath.trophy_year_ui_res()).then((go) => {
|
||||
ResourceManager.getInstance().loadPrefab(respath.trophy_year_ui_res(), (go: any)=> {
|
||||
for (let i = 1; i < years.length; i++) {
|
||||
const obj_year = this.obj_items.getChildAt(i)
|
||||
if (!obj_year) {
|
||||
@@ -64,7 +65,7 @@ export class TrophyRoom extends Laya.Script {
|
||||
}
|
||||
}
|
||||
|
||||
Laya.loader.load(respath.trophy_cell_ui_res()).then((go) => {
|
||||
ResourceManager.getInstance().loadPrefab(respath.trophy_cell_ui_res(), (go: any)=> {
|
||||
let itemsHeight = 0
|
||||
for (let i = 0; i < years.length; i++) {
|
||||
const list = monthMap.get(years[i])
|
||||
|
||||
Reference in New Issue
Block a user