@ives_xxz/framework 1.2.0 → 1.2.2
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/FW.d.ts +5 -5
- package/manager/FWBundleManager.ts +2 -1
- package/manager/FWTaskManager.ts +1 -1
- package/package.json +1 -1
- package/service/socket/FWSocket.ts +1 -0
- package/utils/FWTask.ts +12 -10
package/FW.d.ts
CHANGED
|
@@ -1092,7 +1092,7 @@ declare namespace FW {
|
|
|
1092
1092
|
* tasksFrameCount?: number; 每帧最多执行的任务个数
|
|
1093
1093
|
*/
|
|
1094
1094
|
|
|
1095
|
-
createTask(options: FW.TaskOptions): FW.Task;
|
|
1095
|
+
createTask(options: Partial<FW.TaskOptions>): FW.Task;
|
|
1096
1096
|
/**
|
|
1097
1097
|
* 获取任务
|
|
1098
1098
|
* @param taskId
|
|
@@ -1732,19 +1732,19 @@ declare namespace FW {
|
|
|
1732
1732
|
}
|
|
1733
1733
|
|
|
1734
1734
|
type TaskOptions = {
|
|
1735
|
-
taskId
|
|
1735
|
+
taskId: number;
|
|
1736
1736
|
/**
|
|
1737
1737
|
* 每帧最大执行时间(ms),默认16ms (60fps) 帧预算
|
|
1738
1738
|
*/
|
|
1739
|
-
frameBudget
|
|
1739
|
+
frameBudget: number;
|
|
1740
1740
|
/**
|
|
1741
1741
|
* 每帧最多执行的任务个数
|
|
1742
1742
|
*/
|
|
1743
|
-
tasksFrameCount
|
|
1743
|
+
tasksFrameCount: number;
|
|
1744
1744
|
/**
|
|
1745
1745
|
* 是否打印日志
|
|
1746
1746
|
*/
|
|
1747
|
-
log
|
|
1747
|
+
log: boolean;
|
|
1748
1748
|
};
|
|
1749
1749
|
|
|
1750
1750
|
type TaskEvent = {
|
|
@@ -70,9 +70,10 @@ export class FWBundleManager extends FWManager implements FW.BundleManager {
|
|
|
70
70
|
/** 释放bundle */
|
|
71
71
|
release(bundleName: string): void {
|
|
72
72
|
if (!this.has(bundleName)) {
|
|
73
|
-
FWLog.warn('bundle未加载,无需释放!');
|
|
74
73
|
return;
|
|
75
74
|
}
|
|
75
|
+
this.bundleMap.delete(bundleName);
|
|
76
|
+
cc.assetManager.removeBundle(this.bundleMap.get(bundleName));
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
/**
|
package/manager/FWTaskManager.ts
CHANGED
|
@@ -13,7 +13,7 @@ export default class FWTaskManager extends FWManager implements FW.TaskManager {
|
|
|
13
13
|
*/
|
|
14
14
|
private taskId = 0;
|
|
15
15
|
|
|
16
|
-
createTask(options
|
|
16
|
+
createTask(options?: Partial<FW.TaskOptions>): FW.Task {
|
|
17
17
|
const task = new FWTask({
|
|
18
18
|
tasksFrameCount: options?.tasksFrameCount,
|
|
19
19
|
frameBudget: options?.frameBudget,
|
package/package.json
CHANGED
package/utils/FWTask.ts
CHANGED
|
@@ -20,13 +20,13 @@ export default class FWTask implements FW.Task {
|
|
|
20
20
|
|
|
21
21
|
readonly id: number;
|
|
22
22
|
|
|
23
|
-
constructor(options
|
|
24
|
-
this.id = options
|
|
23
|
+
constructor(options?: Partial<FW.TaskOptions>) {
|
|
24
|
+
this.id = options?.taskId || 0;
|
|
25
25
|
this.taskCounter = 0;
|
|
26
26
|
this.totalTaskDuration = 0;
|
|
27
|
-
this.log = options
|
|
28
|
-
this.frameBudget = options
|
|
29
|
-
this.tasksFrameCount = options
|
|
27
|
+
this.log = options?.log ?? true;
|
|
28
|
+
this.frameBudget = options?.frameBudget ?? 16;
|
|
29
|
+
this.tasksFrameCount = options?.tasksFrameCount ?? 3;
|
|
30
30
|
this.performanceData = {
|
|
31
31
|
frameTimes: [],
|
|
32
32
|
detailedFrames: [],
|
|
@@ -138,11 +138,13 @@ export default class FWTask implements FW.Task {
|
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
if ((result?.value as any)?.message) {
|
|
142
|
+
frameTasks.push({
|
|
143
|
+
taskId: taskId,
|
|
144
|
+
result: result.done ? FWEventDefine.TaskEvent.COMPLETE : FWEventDefine.TaskEvent.YIELDED,
|
|
145
|
+
message: (result?.value as any)?.message,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
146
148
|
|
|
147
149
|
processed++;
|
|
148
150
|
}
|