BundleConfig.ts 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import { Prefab, SpriteFrame, Texture2D } from "cc";
  2. /*['data', {
  3. loadAtLaunch: true,//是否加载配置的bundle
  4. preloadAssets: [
  5. { path: 'textures/background', skipLoading: true }这个资源跳过加载
  6. { path: 'csv', isDirectory: true }, // 加载csv目录下所有文件
  7. { path: 'json/config', isDirectory: true }, // 加载config目录下所有文件
  8. { path: 'special/item', type: Prefab } // 单独加载某个特定资源
  9. ],
  10. autoLoadAll: true //自动加载所有资源
  11. excludePaths?: [],//要排除的资源路径前缀(当autoLoadAll为true时生效
  12. excludeExtensions?: []//要排除的文件扩展名(如['.meta']
  13. }],
  14. ['prefabs', {
  15. loadAtLaunch: true,
  16. preloadAssets: [
  17. { path: 'ui', isDirectory: true, type: Prefab }, // 加载ui目录下所有Prefab
  18. { path: 'effects', isDirectory: true } // 加载effects目录下所有资源
  19. { path: 'enemies/enemie_01', type: Prefab },
  20. { path: 'enemies/enemie_02', type: Prefab },
  21. { path: 'texture/msg_hint/spriteFrame', type: SpriteFrame },
  22. { path: 'texture/test_01/texture', type: Texture2D },
  23. { path: 'texture/test_02/spriteFrame', type: SpriteFrame }
  24. ]
  25. }]*/
  26. //游戏初始化资源加载配置
  27. export const bundleConfig: any = new Map([
  28. ['audios', {
  29. loadAtLaunch: true,
  30. autoLoadAll: true //自动加载所有资源
  31. }],
  32. ['data', {
  33. loadAtLaunch: true,
  34. preloadAssets: [
  35. { path: 'csv', isDirectory: true},
  36. ]
  37. }],
  38. ['prefabs', {
  39. loadAtLaunch: true,//参与启动加载
  40. preloadAssets: [
  41. /*{ path: 'enemy/enemy/generalPistol', type: Prefab },
  42. { path: 'enemy/enemy/scatterCaptain', type: Prefab },
  43. { path: 'enemy/enemy/shieldSoldier', type: Prefab },
  44. { path: 'enemy/enemy/snipeCaptain', type: Prefab },
  45. { path: 'enemy/enemy/sniperSoldier', type: Prefab },
  46. { path: 'enemy/enemy/soldierPistol', type: Prefab },
  47. { path: 'enemy/enemy/tank', type: Prefab },*/
  48. { path: 'enemy/gun/pistol', type: Prefab },
  49. { path: 'enemy/gun/scatter', type: Prefab },
  50. { path: 'enemy/gun/shield', type: Prefab },
  51. { path: 'enemy/gun/sniper_rifle', type: Prefab },
  52. { path: 'enemy/gun/tank_pao', type: Prefab },
  53. { path: 'player/98k', type: Prefab },
  54. /*{ path: 'player/m24', type: Prefab },
  55. { path: 'player/awm', type: Prefab },
  56. { path: 'player/barrettM82A1', type: Prefab },
  57. { path: 'player/m416', type: Prefab },
  58. { path: 'player/akm', type: Prefab },
  59. { path: 'player/vss', type: Prefab },
  60. { path: 'player/sks', type: Prefab },*/
  61. { path: 'texture/msg_hint/spriteFrame', type: SpriteFrame },
  62. { path: 'texture/test_01/texture', type: Texture2D },
  63. { path: 'texture/test_02/spriteFrame', type: SpriteFrame }
  64. ]
  65. }]
  66. ]);