MCPcopy Create free account
hub / github.com/eva-engine/eva.js / remove

Method remove

packages/spine-base/lib/SpineSystem.ts:212–243  ·  view source on GitHub ↗
(changed: ComponentChanged)

Source from the content-addressed store, hash-verified

210 this.add(changed);
211 }
212 async remove(changed: ComponentChanged) {
213 this.increaseAsyncId(changed.gameObject.id);
214 const component = changed.component as Spine;
215 clearTimeout(component.addHandler);
216 const armature = this.armatures[changed.gameObject.id];
217
218 const container = this.renderSystem?.containerManager?.getContainer(changed.gameObject.id);
219 if (container && armature) {
220 container.removeChild(armature);
221 } else {
222 // console.warn('remove时container不存在');
223 }
224
225 if (component.armature) {
226 // 销毁所有挂载到插槽的 GameObject
227 component._destroySlotGameObjects();
228 component.armature.destroy({ children: true });
229 if (!component.keepResource) {
230 const res = await resource.getResource(component.lastResource);
231 const imageSrc = res.data?.image?.src || (res.data?.image as any)?.label;
232 releaseSpineData(res, imageSrc);
233 }
234 }
235
236 component.armature = null;
237 delete this.armatures[changed.gameObject.id];
238 delete this._spineComponents[changed.gameObject.id];
239 if (changed.type === OBSERVER_TYPE.CHANGE) {
240 // // @ts-ignore
241 // component.removeAllListeners();
242 }
243 }
244}

Callers 4

initMethod · 0.95
componentChangedMethod · 0.95
addMethod · 0.95
changeMethod · 0.95

Calls 7

releaseSpineDataFunction · 0.90
increaseAsyncIdMethod · 0.80
getContainerMethod · 0.80
getResourceMethod · 0.80
removeChildMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected