@ives_xxz/framework 2.1.16 → 2.1.17
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/package.json +1 -1
- package/utils/FWObjectPool.ts +4 -6
package/package.json
CHANGED
package/utils/FWObjectPool.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import FWObject from './FWObject';
|
|
2
|
-
|
|
3
1
|
const POOL_DISABLE_POSITION: cc.Vec3 = cc.v3(50000, 50000);
|
|
4
2
|
|
|
5
|
-
export class FWObjectPool<T extends
|
|
3
|
+
export class FWObjectPool<T extends FW.Object = FW.Object> implements FW.ObjectPool {
|
|
6
4
|
private uniqueId: number;
|
|
7
5
|
private type: FW.SystemDefine.FWObjectType;
|
|
8
6
|
private enablePoolMap: Map<number, FW.ObjectProperty>;
|
|
@@ -51,7 +49,7 @@ export class FWObjectPool<T extends FWObject = FWObject> implements FW.ObjectPoo
|
|
|
51
49
|
if (property.node.uuid == uuid) {
|
|
52
50
|
return property;
|
|
53
51
|
}
|
|
54
|
-
} else if (arguments[0] instanceof
|
|
52
|
+
} else if (arguments[0] instanceof FW.Object) {
|
|
55
53
|
if (uniqueId == arguments[0]?.uniqueId) {
|
|
56
54
|
return property;
|
|
57
55
|
}
|
|
@@ -77,7 +75,7 @@ export class FWObjectPool<T extends FWObject = FWObject> implements FW.ObjectPoo
|
|
|
77
75
|
};
|
|
78
76
|
if (this.isEmpty()) {
|
|
79
77
|
node = cc.instantiate(this.node);
|
|
80
|
-
element = (node.getComponent(
|
|
78
|
+
element = (node.getComponent(FW.Object) as T) || undefined;
|
|
81
79
|
ObjectProperty.uniqueId = ++this.uniqueId;
|
|
82
80
|
ObjectProperty.node = node;
|
|
83
81
|
ObjectProperty.component = element;
|
|
@@ -142,7 +140,7 @@ export class FWObjectPool<T extends FWObject = FWObject> implements FW.ObjectPoo
|
|
|
142
140
|
let property: FW.ObjectProperty = this.findObjectProperty(arguments[0]);
|
|
143
141
|
|
|
144
142
|
const node: cc.Node = property.node;
|
|
145
|
-
const element = (node.getComponent(
|
|
143
|
+
const element = (node.getComponent(FW.Object) as T) || undefined;
|
|
146
144
|
|
|
147
145
|
if (!cc.isValid(node)) {
|
|
148
146
|
return;
|