MaterialUtil.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { SpriteAtlas } from "cc"
  2. import { AssetType, resLoader } from "../res/ResLoader"
  3. import { AsyncQueue, NextFunction } from "../queue/AsyncQueue";
  4. export class MaterialUtil {
  5. static iconGame: SpriteAtlas = null;
  6. static iconFilter: SpriteAtlas = null;
  7. static Restart() {
  8. }
  9. static init(callback) {
  10. // let queue = new AsyncQueue();
  11. // queue.pushMulti("InitPool", async (next: NextFunction, params: any, args: any) => {
  12. // resLoader.load('package', 'texture/hall/Games/Icon_Game', SpriteAtlas, (error: Error, res: SpriteAtlas) => {
  13. // if (!error) {
  14. // this.iconGame = res;
  15. // if(callback) callback();
  16. // next()
  17. // console.log('游戏入口图标加载完成');
  18. // }
  19. // });
  20. // }, async (next: NextFunction, params: any, args: any) => {
  21. // resLoader.load('package', 'texture/hall/Games/Icon_Filter', SpriteAtlas, (error: Error, res: SpriteAtlas) => {
  22. // if (!error) {
  23. // this.iconFilter = res;
  24. // if(callback) callback();
  25. // next()
  26. // console.log('游戏筛选图标加载完成');
  27. // }
  28. // });
  29. // });
  30. // queue.complete = () => {
  31. // console.log('materialUtil初始化完成');
  32. // };
  33. // queue.play();
  34. }
  35. _loadRes(LoadType: AssetType, Url, Back) {
  36. resLoader.load('package', Url, LoadType, (error: Error, res) => {
  37. if (!error) {
  38. Back(res)
  39. }
  40. });
  41. }
  42. // /** 游戏入口图标 */
  43. // static getIconGameByID(id) {
  44. // return this.iconGame.spriteFrames[id];
  45. // }
  46. // /** 游戏筛选图标 */
  47. // static getIconFilterByName(name) {
  48. // return this.iconFilter.spriteFrames[name];
  49. // }
  50. }