import { _decorator, resources, SpriteFrame, Asset } from 'cc' import Singleton from '../Base/Singleton' export class ResourceManager extends Singleton { static get Instance() { return super.GetInstance() } loadRes(path: string, type: new (...args: any[]) => T) { return new Promise((resolve, reject) => { resources.load(path, type, (err, res) => { if (err) { reject(err) return } resolve(res) }) }) } loadDir(path: string, type: new (...args: any[]) => T) { return new Promise((resolve, reject) => { resources.loadDir(path, type, (err, res) => { if (err) { reject(err) return } resolve(res) }) }) } }