@ives_xxz/framework 2.1.29 → 2.1.30
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.
- package/entry/FWEntry.ts +4 -0
- package/manager/FWAssetManager.ts +8 -3
- package/package.json +1 -1
- package/types/FW.d.ts +6 -0
- package/utils/FWUtils.ts +15 -0
- package/utils/FWUtils.ts.meta +10 -0
package/entry/FWEntry.ts
CHANGED
|
@@ -16,6 +16,7 @@ import FWEngineManager from '../manager/FWEngineManager';
|
|
|
16
16
|
import FWHotUpdateManager from '../manager/FWHotUpdateManager';
|
|
17
17
|
import FWPromiseManager from '../manager/FWPromiseManager';
|
|
18
18
|
import { FWPerformanceManager } from '../manager/FWPerformanceManager';
|
|
19
|
+
import FWUtils from '../utils/FWUtils';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* 入口脚本
|
|
@@ -90,6 +91,8 @@ export class FWEntry implements FW.Entry {
|
|
|
90
91
|
* 性能管理器
|
|
91
92
|
*/
|
|
92
93
|
performanceMgr: FW.PerformanceManager;
|
|
94
|
+
|
|
95
|
+
utils: FW.Utils;
|
|
93
96
|
/**
|
|
94
97
|
* 当前Scene
|
|
95
98
|
*/
|
|
@@ -119,6 +122,7 @@ export class FWEntry implements FW.Entry {
|
|
|
119
122
|
this.hotUpdateMgr = new FWHotUpdateManager();
|
|
120
123
|
this.promiseMgr = new FWPromiseManager();
|
|
121
124
|
this.performanceMgr = new FWPerformanceManager();
|
|
125
|
+
this.utils = new FWUtils();
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
/**
|
|
@@ -53,12 +53,17 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
53
53
|
{ url: ske, ext: type },
|
|
54
54
|
],
|
|
55
55
|
async (error, assets) => {
|
|
56
|
-
|
|
56
|
+
if (error != null) {
|
|
57
|
+
reject(error);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const fileName = FW.Entry.utils.getFileName(img);
|
|
61
|
+
const texture: cc.Texture2D = await this.loadRemote(img);
|
|
57
62
|
var asset = new sp.SkeletonData();
|
|
58
|
-
asset.skeletonJson = assets[1];
|
|
59
63
|
asset.atlasText = assets[0];
|
|
64
|
+
asset.skeletonJson = assets[1];
|
|
60
65
|
asset.textures.push(texture);
|
|
61
|
-
asset['textureNames'] = [`${
|
|
66
|
+
asset['textureNames'] = [`${fileName}`];
|
|
62
67
|
asset['_uuid'] = ske;
|
|
63
68
|
resolve(asset);
|
|
64
69
|
},
|
package/package.json
CHANGED
package/types/FW.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ declare namespace FW {
|
|
|
68
68
|
promiseMgr: PromiseManager;
|
|
69
69
|
/** 性能管理器 */
|
|
70
70
|
performanceMgr: PerformanceManager;
|
|
71
|
+
/** 通用工具类 */
|
|
72
|
+
utils: Utils;
|
|
71
73
|
/** 场景组件 */
|
|
72
74
|
scene: Scene;
|
|
73
75
|
/** 当前bundle名称 */
|
|
@@ -2346,6 +2348,10 @@ declare namespace FW {
|
|
|
2346
2348
|
$descriptorOrInitializer?: any,
|
|
2347
2349
|
) => void;
|
|
2348
2350
|
|
|
2351
|
+
type Utils = {
|
|
2352
|
+
getFileName(url: string): string;
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2349
2355
|
declare function timeScale(scale: number);
|
|
2350
2356
|
declare let Entry: Entry;
|
|
2351
2357
|
}
|
package/utils/FWUtils.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default class FWUtils {
|
|
2
|
+
/**
|
|
3
|
+
* 从 URL 中获取完整文件名(含扩展名)
|
|
4
|
+
*/
|
|
5
|
+
public getFileName(url: string): string {
|
|
6
|
+
try {
|
|
7
|
+
const urlObj = new URL(url);
|
|
8
|
+
const pathname = urlObj.pathname;
|
|
9
|
+
return pathname.substring(pathname.lastIndexOf('/') + 1);
|
|
10
|
+
} catch {
|
|
11
|
+
const cleanUrl = url.split('?')[0].split('#')[0];
|
|
12
|
+
return cleanUrl.substring(cleanUrl.lastIndexOf('/') + 1);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|