@ives_xxz/framework 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/FW.d.ts +1845 -0
  2. package/FW.d.ts.meta +6 -0
  3. package/Framework.ts +148 -0
  4. package/Framework.ts.meta +10 -0
  5. package/README.md +93 -0
  6. package/README.md.meta +6 -0
  7. package/animation/FWAnimation.ts +13 -0
  8. package/animation/FWAnimation.ts.meta +10 -0
  9. package/animation/FWSkeleton.ts +176 -0
  10. package/animation/FWSkeleton.ts.meta +10 -0
  11. package/animation/FWTween.ts +60 -0
  12. package/animation/FWTween.ts.meta +10 -0
  13. package/animation.meta +13 -0
  14. package/component/FWVirtualViewComponent.ts +2080 -0
  15. package/component/FWVirtualViewComponent.ts.meta +10 -0
  16. package/component.meta +13 -0
  17. package/config/FWAssetConfig.ts +7 -0
  18. package/config/FWAssetConfig.ts.meta +10 -0
  19. package/config.meta +13 -0
  20. package/controller/FWLayerController.ts +236 -0
  21. package/controller/FWLayerController.ts.meta +10 -0
  22. package/controller.meta +13 -0
  23. package/data/FWData.ts +10 -0
  24. package/data/FWData.ts.meta +10 -0
  25. package/data.meta +13 -0
  26. package/define/FWEventDefine.ts +26 -0
  27. package/define/FWEventDefine.ts.meta +10 -0
  28. package/define/FWSystemDefine.ts +133 -0
  29. package/define/FWSystemDefine.ts.meta +10 -0
  30. package/define.meta +13 -0
  31. package/entry/FWEntry.ts +196 -0
  32. package/entry/FWEntry.ts.meta +10 -0
  33. package/entry.meta +13 -0
  34. package/expand/FWCocosExpand.ts +73 -0
  35. package/expand/FWCocosExpand.ts.meta +10 -0
  36. package/expand/FWDecorator.ts +256 -0
  37. package/expand/FWDecorator.ts.meta +10 -0
  38. package/expand/FWRollingViewNesting.ts +191 -0
  39. package/expand/FWRollingViewNesting.ts.meta +10 -0
  40. package/expand/FWTweenExpand.ts +44 -0
  41. package/expand/FWTweenExpand.ts.meta +10 -0
  42. package/expand.meta +13 -0
  43. package/item/FWVirtualListItem.ts +150 -0
  44. package/item/FWVirtualListItem.ts.meta +10 -0
  45. package/item.meta +13 -0
  46. package/language/FWLanguage.ts +69 -0
  47. package/language/FWLanguage.ts.meta +10 -0
  48. package/language/FWLanguageLabelLocalize.ts +144 -0
  49. package/language/FWLanguageLabelLocalize.ts.meta +10 -0
  50. package/language/FWLanguageSkeletonLocalize.ts +106 -0
  51. package/language/FWLanguageSkeletonLocalize.ts.meta +10 -0
  52. package/language/FWLanguageSpriteLocalize.ts +81 -0
  53. package/language/FWLanguageSpriteLocalize.ts.meta +10 -0
  54. package/language.meta +13 -0
  55. package/layer/FWLayer.ts +13 -0
  56. package/layer/FWLayer.ts.meta +10 -0
  57. package/layer.meta +13 -0
  58. package/log/FWLog.ts +115 -0
  59. package/log/FWLog.ts.meta +10 -0
  60. package/log.meta +13 -0
  61. package/logic/FWLogic.ts +10 -0
  62. package/logic/FWLogic.ts.meta +10 -0
  63. package/logic.meta +13 -0
  64. package/machine/FWAnimationMachine.ts +28 -0
  65. package/machine/FWAnimationMachine.ts.meta +10 -0
  66. package/machine/FWStateMachine.ts +75 -0
  67. package/machine/FWStateMachine.ts.meta +10 -0
  68. package/machine.meta +13 -0
  69. package/manager/FWAnimationManager.ts +128 -0
  70. package/manager/FWAnimationManager.ts.meta +10 -0
  71. package/manager/FWAssetManager.ts +349 -0
  72. package/manager/FWAssetManager.ts.meta +10 -0
  73. package/manager/FWAudioManager.ts +289 -0
  74. package/manager/FWAudioManager.ts.meta +10 -0
  75. package/manager/FWBundleManager.ts +91 -0
  76. package/manager/FWBundleManager.ts.meta +10 -0
  77. package/manager/FWComponentManager.ts +25 -0
  78. package/manager/FWComponentManager.ts.meta +10 -0
  79. package/manager/FWEngineManager.ts +63 -0
  80. package/manager/FWEngineManager.ts.meta +10 -0
  81. package/manager/FWEventManager.ts +275 -0
  82. package/manager/FWEventManager.ts.meta +10 -0
  83. package/manager/FWHotUpdateManager.ts +213 -0
  84. package/manager/FWHotUpdateManager.ts.meta +10 -0
  85. package/manager/FWLanguageManager.ts +116 -0
  86. package/manager/FWLanguageManager.ts.meta +10 -0
  87. package/manager/FWLayerManager.ts +490 -0
  88. package/manager/FWLayerManager.ts.meta +10 -0
  89. package/manager/FWManager.ts +8 -0
  90. package/manager/FWManager.ts.meta +10 -0
  91. package/manager/FWObjectManager.ts +91 -0
  92. package/manager/FWObjectManager.ts.meta +10 -0
  93. package/manager/FWResManager.ts +171 -0
  94. package/manager/FWResManager.ts.meta +10 -0
  95. package/manager/FWSocketManager.ts +94 -0
  96. package/manager/FWSocketManager.ts.meta +10 -0
  97. package/manager/FWStateManager.ts +102 -0
  98. package/manager/FWStateManager.ts.meta +10 -0
  99. package/manager/FWTaskManager.ts +38 -0
  100. package/manager/FWTaskManager.ts.meta +10 -0
  101. package/manager/FWTimeManager.ts +473 -0
  102. package/manager/FWTimeManager.ts.meta +10 -0
  103. package/manager/FWUiManager.ts +164 -0
  104. package/manager/FWUiManager.ts.meta +10 -0
  105. package/manager.meta +13 -0
  106. package/package.json +17 -0
  107. package/package.json.meta +6 -0
  108. package/scene/FWScene.ts +25 -0
  109. package/scene/FWScene.ts.meta +10 -0
  110. package/scene.meta +13 -0
  111. package/service/FWService.ts +7 -0
  112. package/service/FWService.ts.meta +10 -0
  113. package/service/http/FWHttp.ts +70 -0
  114. package/service/http/FWHttp.ts.meta +10 -0
  115. package/service/http.meta +13 -0
  116. package/service/socket/FWSocket.ts +236 -0
  117. package/service/socket/FWSocket.ts.meta +10 -0
  118. package/service/socket/FWSocketHandle.ts +17 -0
  119. package/service/socket/FWSocketHandle.ts.meta +10 -0
  120. package/service/socket/FWSocketSender.ts +16 -0
  121. package/service/socket/FWSocketSender.ts.meta +10 -0
  122. package/service/socket.meta +13 -0
  123. package/service.meta +13 -0
  124. package/state/FWState.ts +8 -0
  125. package/state/FWState.ts.meta +10 -0
  126. package/state.meta +13 -0
  127. package/utils/FWLodash.ts +105 -0
  128. package/utils/FWLodash.ts.meta +10 -0
  129. package/utils/FWMask.ts +222 -0
  130. package/utils/FWMask.ts.meta +10 -0
  131. package/utils/FWObject.ts +22 -0
  132. package/utils/FWObject.ts.meta +10 -0
  133. package/utils/FWObjectPool.ts +178 -0
  134. package/utils/FWObjectPool.ts.meta +10 -0
  135. package/utils/FWQueue.ts +47 -0
  136. package/utils/FWQueue.ts.meta +10 -0
  137. package/utils/FWTask.ts +223 -0
  138. package/utils/FWTask.ts.meta +10 -0
  139. package/utils.meta +13 -0
@@ -0,0 +1,128 @@
1
+ import { FWSkeleton } from '../animation/FWSkeleton';
2
+ import { FWTween } from '../animation/FWTween';
3
+ import { FWManager } from './FWManager';
4
+ import { FWSystemDefine } from '../define/FWSystemDefine';
5
+ import FWLog from '../log/FWLog';
6
+ import { FWAnimationMachine } from '../machine/FWAnimationMachine';
7
+
8
+ export default class FWAnimationManager extends FWManager {
9
+ private animationMachineMap: Map<string, FWAnimationMachine>;
10
+ public initialize(): void {
11
+ this.animationMachineMap = new Map<string, FWAnimationMachine>();
12
+
13
+ this.createAnimationMachine(FWSystemDefine.FWAnimationMachineType.TWEEN);
14
+ this.createAnimationMachine(FWSystemDefine.FWAnimationMachineType.SKELETON);
15
+ this.createAnimationMachine(FWSystemDefine.FWAnimationMachineType.ANIMATION);
16
+ }
17
+
18
+ /**
19
+ * 创建一个tween动画
20
+ * @param args
21
+ * @returns
22
+ */
23
+ createTween(args?: FW.TweenArgs) {
24
+ const t = new FWTween();
25
+ const machine = this.animationMachineMap.get(FWSystemDefine.FWAnimationMachineType.TWEEN);
26
+ t.animationName = args?.tag || '';
27
+ t.animation = cc.tween(args?.target);
28
+ t.timeScale(args?.timeScale || 1);
29
+ machine.addAnimation(t);
30
+ return t;
31
+ }
32
+
33
+ /**
34
+ * 创建一个skeleton动画
35
+ * @param skeleton
36
+ * @returns
37
+ */
38
+ createSkeleton(skeleton: sp.Skeleton) {
39
+ const s = new FWSkeleton();
40
+ const machine = this.animationMachineMap.get(FWSystemDefine.FWAnimationMachineType.SKELETON);
41
+ s.animationName = skeleton.name;
42
+ s.animation = skeleton;
43
+ machine.addAnimation(s);
44
+ return s;
45
+ }
46
+
47
+ /**
48
+ * 获取一个skeleton动画
49
+ * @param animationName
50
+ * @returns
51
+ */
52
+ getSkeleton(animationName: string) {
53
+ if (!this.animationMachineMap.has(FWSystemDefine.FWAnimationMachineType.SKELETON)) return;
54
+ return this.animationMachineMap
55
+ .get(FWSystemDefine.FWAnimationMachineType.SKELETON)
56
+ .getAnimation(animationName) as FWSkeleton;
57
+ }
58
+
59
+ /**
60
+ * 暂停一个skeleton动画
61
+ * @param animationName
62
+ * @returns
63
+ */
64
+ pauseSkeleton(animationName: string) {
65
+ if (!this.animationMachineMap.has(FWSystemDefine.FWAnimationMachineType.SKELETON)) return;
66
+ this.animationMachineMap.get(animationName).pause();
67
+ }
68
+
69
+ /**
70
+ * 恢复一个skeleton动画
71
+ * @param animationName
72
+ * @returns
73
+ */
74
+ resumeSkeleton(animationName: string) {
75
+ if (!this.animationMachineMap.has(FWSystemDefine.FWAnimationMachineType.SKELETON)) return;
76
+ this.animationMachineMap.get(animationName).resume();
77
+ }
78
+ /**
79
+ * 移除一个skeleton动画
80
+ * @param animationName
81
+ * @returns
82
+ */
83
+ removeSkeleton(animationName: string) {
84
+ if (!this.animationMachineMap.has(FWSystemDefine.FWAnimationMachineType.SKELETON)) return;
85
+ this.animationMachineMap.delete(animationName);
86
+ }
87
+
88
+ /**
89
+ * 暂停所有动画
90
+ */
91
+ pauseAll() {
92
+ this.animationMachineMap.forEach((v) => v.pause());
93
+ }
94
+
95
+ /** 恢复所有动画 */
96
+ resumeAll() {
97
+ this.animationMachineMap.forEach((v) => v.resume());
98
+ }
99
+
100
+ /**
101
+ * 创建动画机
102
+ * @param animationMachineName
103
+ * @returns
104
+ */
105
+ createAnimationMachine(animationMachineName: string) {
106
+ if (this.animationMachineMap.has(animationMachineName)) {
107
+ FWLog.warn(`已创建动画机:${animationMachineName},请勿重复注册!`);
108
+ return;
109
+ }
110
+ const machine = new FWAnimationMachine();
111
+ this.animationMachineMap.set(animationMachineName, machine);
112
+ return machine;
113
+ }
114
+
115
+ /**
116
+ * 移除动画机
117
+ * @param animationMachineName
118
+ * @returns
119
+ */
120
+ removeAnimationMachine(animationMachineName: string) {
121
+ if (!this.animationMachineMap.has(animationMachineName)) {
122
+ return;
123
+ }
124
+ this.animationMachineMap.delete(animationMachineName);
125
+ }
126
+
127
+ onDestroy(): void {}
128
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "ver": "1.1.0",
3
+ "uuid": "c2448e26-e096-4b98-83bc-f54fe3600ac8",
4
+ "importer": "typescript",
5
+ "isPlugin": false,
6
+ "loadPluginInWeb": true,
7
+ "loadPluginInNative": true,
8
+ "loadPluginInEditor": false,
9
+ "subMetas": {}
10
+ }
@@ -0,0 +1,349 @@
1
+ import FWLog from '../log/FWLog';
2
+ import { FWManager } from './FWManager';
3
+
4
+ /**
5
+ * 资源数据
6
+ */
7
+ class FWAssetData implements FW.AssetData {
8
+ asset: cc.Asset;
9
+ uuid: string;
10
+ user: string;
11
+ depend: string[];
12
+ reference: string[];
13
+ type: typeof cc.Asset;
14
+ dependentBundle: string;
15
+ loaded: boolean;
16
+ autoRelease: boolean;
17
+ refCount: number;
18
+ }
19
+
20
+ export class FWAssetManager extends FWManager implements FW.AssetManager {
21
+ assetsMap: Map<string, FWAssetData>;
22
+
23
+ constructor(protected readonly resMgr: FW.ResManager) {
24
+ super();
25
+ }
26
+
27
+ public async initialize(): Promise<void> {
28
+ this.assetsMap = new Map<string, FWAssetData>();
29
+ }
30
+
31
+ /**
32
+ * 从远程加载spine动画
33
+ * @param data
34
+ * @returns
35
+ */
36
+ async loadSpineDataFromRemote(data: {
37
+ img: string;
38
+ ske: string;
39
+ atlas: string;
40
+ bin?: boolean;
41
+ }): Promise<sp.SkeletonData> {
42
+ try {
43
+ return new Promise((resolve) => {
44
+ const bin = data.bin === undefined ? false : data.bin;
45
+ const img = data.img;
46
+ const ske = data.ske;
47
+ const atlas = data.atlas;
48
+ const type = bin ? '.bin' : '.txt';
49
+ cc.assetManager.loadAny(
50
+ [
51
+ { url: atlas, ext: type },
52
+ { url: ske, ext: type },
53
+ ],
54
+ (error, assets) => {
55
+ cc.assetManager.loadRemote(img, (error, texture: cc.Texture2D) => {
56
+ var asset = new sp.SkeletonData();
57
+ asset.skeletonJson = assets[1];
58
+ asset.atlasText = assets[0];
59
+ asset.textures.push(texture);
60
+ asset['textureNames'] = [`${img}.png`];
61
+ asset['_uuid'] = ske;
62
+ resolve(asset);
63
+ });
64
+ },
65
+ );
66
+ });
67
+ } catch (e) {
68
+ FWLog.error('从远程加载spine动画资源失败!');
69
+ }
70
+ }
71
+
72
+ /** 加载远程资源 */
73
+ loadRemote<T extends cc.Asset = cc.Asset>(
74
+ url?: string,
75
+ cb?: (asset: cc.Asset) => void,
76
+ ): Promise<T> {
77
+ return new Promise((resolve, reject) => {
78
+ cc.assetManager.loadRemote(url, { cacheEnabled: true, maxRetryCount: 0 }, (err, asset) => {
79
+ cb?.(asset as T);
80
+ resolve(asset as T);
81
+ });
82
+ });
83
+ }
84
+
85
+ /**
86
+ * 加载资源
87
+ * @param assetProperty
88
+ * @returns
89
+ */
90
+ async load(assetProperty: FW.AssetProperty): Promise<FW.AssetData> {
91
+ if (!assetProperty) {
92
+ FWLog.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
93
+ return undefined;
94
+ }
95
+ const bundleName = assetProperty.bundle || FW.Entry.bundleName;
96
+ const type = assetProperty.type;
97
+ const path = assetProperty.path;
98
+ const cb = assetProperty.cb;
99
+ const progress = assetProperty.progress;
100
+ const autoRelease = assetProperty.autoRelease;
101
+
102
+ if (!bundleName || bundleName === '') {
103
+ FWLog.error(`找不到bundle${bundleName},或者bundle未加载!`);
104
+ return undefined;
105
+ }
106
+
107
+ if (!path || path === '') {
108
+ FWLog.error(`找不到资源路径${path},请检查!`);
109
+ return undefined;
110
+ }
111
+
112
+ let bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(bundleName);
113
+
114
+ if (!bundle) {
115
+ FWLog.error(`加载bundle失败,请检查!`);
116
+ return undefined;
117
+ }
118
+ const key = this.createAssetMapKey(assetProperty);
119
+
120
+ if (this.assetsMap.has(key)) {
121
+ const assetData = this.assetsMap.get(key);
122
+ assetData.refCount++;
123
+ return assetData;
124
+ }
125
+
126
+ const assetData = new FWAssetData();
127
+
128
+ assetData.loaded = false;
129
+
130
+ return new Promise(
131
+ (
132
+ resolve: (value: FW.AssetData | PromiseLike<FW.AssetData>) => void,
133
+ reject: (reason?: any) => void,
134
+ ) => {
135
+ const self = this;
136
+ bundle.load(
137
+ path,
138
+ type,
139
+ (finish: number, total: number, item: cc.AssetManager.RequestItem) => {
140
+ progress?.(finish, total, item);
141
+ },
142
+ (err: Error, asset: cc.Asset) => {
143
+ if (err || !asset) {
144
+ FWLog.error(`加载资源失败:${asset},请检查!`);
145
+ reject(err);
146
+ }
147
+
148
+ assetData.loaded = true;
149
+ assetData.dependentBundle = bundleName;
150
+ assetData.uuid = asset['_uuid'];
151
+ assetData.autoRelease = autoRelease;
152
+ assetData.asset = asset;
153
+ assetData.user = assetProperty.user;
154
+ assetData.refCount = 1;
155
+ self.assetsMap.set(key, assetData);
156
+
157
+ cb?.(assetData);
158
+ resolve(assetData);
159
+ },
160
+ );
161
+ },
162
+ );
163
+ }
164
+ /**
165
+ * 加载文件夹
166
+ * @param assetProperty
167
+ * @returns
168
+ */
169
+ async loadDir(assetProperty: FW.AssetProperty): Promise<FW.AssetData[]> {
170
+ if (!assetProperty) {
171
+ FWLog.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
172
+ return undefined;
173
+ }
174
+
175
+ const bundleName = assetProperty.bundle || FW.Entry.bundleName;
176
+ const type = assetProperty.type;
177
+ const path = assetProperty.path;
178
+ const cb = assetProperty.cb;
179
+ const autoRelease = assetProperty.autoRelease;
180
+
181
+ if (!bundleName || bundleName === '') {
182
+ FWLog.error(`找不到bundle${bundleName},或者bundle未加载!`);
183
+ return undefined;
184
+ }
185
+
186
+ if (!path || path === '') {
187
+ FWLog.error(`找不到资源路径${path},请检查!`);
188
+ return undefined;
189
+ }
190
+
191
+ const bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(bundleName);
192
+
193
+ if (!bundle) {
194
+ FWLog.error(`加载bundle失败,请检查!`);
195
+ return undefined;
196
+ }
197
+
198
+ return new Promise(
199
+ (
200
+ resolve: (value: FW.AssetData[] | PromiseLike<FW.AssetData[]>) => void,
201
+ reject: (reason?: any) => void,
202
+ ) => {
203
+ bundle.loadDir(path, type, (err: Error, assets: cc.Asset[]) => {
204
+ if (err || assets.length === 0) {
205
+ FWLog.error(`加载资源失败:${assets},请检查!`);
206
+ reject(err);
207
+ }
208
+
209
+ const assetDataList = [];
210
+
211
+ for (const asset of assets) {
212
+ const assetData = new FWAssetData();
213
+ assetData.loaded = true;
214
+ assetData.dependentBundle = bundleName;
215
+ assetData.uuid = asset['_uuid'];
216
+ assetData.autoRelease = autoRelease;
217
+ assetData.asset = asset;
218
+ assetData.type = type;
219
+
220
+ const key = `${this.createAssetMapKey({
221
+ bundle: bundleName,
222
+ path: path,
223
+ })}/${asset.name}${type ? `_${type?.name}` : ''}`;
224
+
225
+ this.assetsMap.set(key, assetData);
226
+
227
+ assetDataList.push(assetData);
228
+ }
229
+
230
+ cb?.(assetDataList);
231
+ resolve(assetDataList);
232
+ });
233
+ },
234
+ );
235
+ }
236
+
237
+ /**
238
+ * 获取资源
239
+ * @param assetProperty
240
+ * @returns
241
+ */
242
+ get(assetProperty: FW.AssetProperty): FW.AssetData {
243
+ if (!assetProperty) {
244
+ FWLog.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
245
+ return undefined;
246
+ }
247
+ const bundleName = assetProperty.bundle || FW.Entry.bundleName;
248
+ const path = assetProperty.path;
249
+
250
+ if (!bundleName || bundleName === '') {
251
+ FWLog.error(`找不到bundle${bundleName},或者bundle未加载!`);
252
+ return undefined;
253
+ }
254
+
255
+ if (!path || path === '') {
256
+ FWLog.error(`找不到资源路径${path},请检查!`);
257
+ return undefined;
258
+ }
259
+
260
+ if (!this.has(assetProperty)) {
261
+ FWLog.error('获取资源失败,请先加载!');
262
+ return undefined;
263
+ }
264
+
265
+ const key = this.createAssetMapKey(assetProperty);
266
+ const assetsData = this.assetsMap.get(key);
267
+ assetsData.refCount++;
268
+ return assetsData;
269
+ }
270
+
271
+ /**
272
+ * 释放资源
273
+ * @param assetProperty
274
+ * @returns
275
+ */
276
+ release(assetProperty: FW.AssetProperty): void {
277
+ if (!assetProperty) {
278
+ FWLog.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
279
+ return undefined;
280
+ }
281
+ const bundleName = assetProperty.bundle || FW.Entry.bundleName;
282
+ const path = assetProperty.path;
283
+ const autoRelease = assetProperty.autoRelease;
284
+
285
+ if (!bundleName || bundleName === '') {
286
+ FWLog.error(`找不到bundle${bundleName},或者bundle未加载!`);
287
+ return undefined;
288
+ }
289
+
290
+ if (!path || path === '') {
291
+ FWLog.error(`找不到资源路径${path},请检查!`);
292
+ return undefined;
293
+ }
294
+
295
+ if (!this.has(assetProperty)) {
296
+ FWLog.error('获取资源失败,请先加载!');
297
+ return undefined;
298
+ }
299
+ const key = this.createAssetMapKey(assetProperty);
300
+ const assetData = this.assetsMap.get(key);
301
+ assetData.refCount--;
302
+
303
+ if (assetData.refCount <= 0) {
304
+ this.assetsMap.delete(key);
305
+ autoRelease && this.resMgr.getBundle(bundleName)?.release(path);
306
+ }
307
+ }
308
+
309
+ /**
310
+ * 获取资源引用计数
311
+ * @param assetProperty
312
+ * @returns
313
+ */
314
+ public getReferenceCount(assetProperty: FW.AssetProperty): number {
315
+ const bundleName = assetProperty.bundle || FW.Entry.bundleName;
316
+ const path = assetProperty.path;
317
+ const type = assetProperty.type;
318
+ const key = this.createAssetMapKey(assetProperty);
319
+ return this.assetsMap.get(key)?.refCount || 0;
320
+ }
321
+
322
+ /**
323
+ * 资源是否存在
324
+ * @param uid
325
+ * @returns
326
+ */
327
+ has(assetProperty: FW.AssetProperty) {
328
+ if (!assetProperty) {
329
+ FWLog.error(`判断资源是否存在失败,请检查参数列表:${assetProperty}!`);
330
+ return;
331
+ }
332
+
333
+ return this.assetsMap.has(this.createAssetMapKey(assetProperty));
334
+ }
335
+
336
+ private createAssetMapKey(assetProperty: FW.AssetProperty) {
337
+ const bundleName = assetProperty.bundle || FW.Entry.bundleName;
338
+ const path = assetProperty.path;
339
+ const type = assetProperty.type;
340
+ if (!type) {
341
+ return `${bundleName}_${path}`;
342
+ }
343
+ return `${bundleName}_${path}_${type}`;
344
+ }
345
+
346
+ public onDestroy(): void {
347
+ this.assetsMap.clear();
348
+ }
349
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "ver": "1.1.0",
3
+ "uuid": "eb4a5a74-0281-4aba-af9b-ae616f1d94f2",
4
+ "importer": "typescript",
5
+ "isPlugin": false,
6
+ "loadPluginInWeb": true,
7
+ "loadPluginInNative": true,
8
+ "loadPluginInEditor": false,
9
+ "subMetas": {}
10
+ }