|
@@ -44,7 +44,7 @@ export default class LoadResUtil {
|
|
|
* @param type 资源类型(cc.Asset)
|
|
* @param type 资源类型(cc.Asset)
|
|
|
* @returns Promise
|
|
* @returns Promise
|
|
|
*/
|
|
*/
|
|
|
- public static load<T extends cc.Asset>(paths: string | any, type: typeof cc.Asset): Promise<any> {
|
|
|
|
|
|
|
+ public load<T extends cc.Asset>(paths: string | any, type: typeof cc.Asset): Promise<any> {
|
|
|
return new Promise<T>((resolve: (data: T) => void, reject) => {
|
|
return new Promise<T>((resolve: (data: T) => void, reject) => {
|
|
|
cc.resources.load(paths, type,
|
|
cc.resources.load(paths, type,
|
|
|
//onProgress
|
|
//onProgress
|
|
@@ -144,7 +144,7 @@ export default class LoadResUtil {
|
|
|
*/
|
|
*/
|
|
|
public preloadScene(sceneName: string, options: Record<string, any>) {
|
|
public preloadScene(sceneName: string, options: Record<string, any>) {
|
|
|
return new Promise<void>((resolve: () => void, reject) => {
|
|
return new Promise<void>((resolve: () => void, reject) => {
|
|
|
- cc.resources.preloadScene(sceneName, options,
|
|
|
|
|
|
|
+ cc.resources.preloadScene(sceneName, options,
|
|
|
//onProgress
|
|
//onProgress
|
|
|
(finish: number, total: number, item: cc.AssetManager.RequestItem) => {
|
|
(finish: number, total: number, item: cc.AssetManager.RequestItem) => {
|
|
|
|
|
|