12345678910111213141516171819202122232425262728293031323334353637 |
- /** @format */
- import {Data, Mgr} from '../GameControl'
- import {Log} from '../utils/LogUtils'
- /** @format */
- export class ResourceManager {
- public init() {
- if (Mgr.platform.isWeChat()) {
- // @ts-ignore
- wx.onMemoryWarning(() => {
- Log.warn('MemoryWarning!start gc')
- Mgr.platform.gc()
- })
- }
- }
- public dumpSize() {
- cc.assetManager.assets.forEach((value: cc.Asset, key) => {
- console.log(value, key)
- })
- }
- loadTexSync(url: string) {
- return new Promise((resolve, reject) => {
- Data.main.texBundle.load(url, cc.SpriteFrame, (err, sp: cc.SpriteFrame) => {
- if (err) {
- reject(null)
- } else {
- resolve(sp)
- }
- })
- })
- }
- }
|