mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ts][pixi-v7][pixi-v8] Clean up ticker correctly.
This commit is contained in:
parent
460072ec1e
commit
14bfef61dd
@ -325,6 +325,7 @@ export class Spine extends Container {
|
|||||||
}
|
}
|
||||||
/** Sets the ticker to use when {@link autoUpdate} is `true`. If `autoUpdate` is already `true`, the update callback will be moved from the old ticker to the new one. */
|
/** Sets the ticker to use when {@link autoUpdate} is `true`. If `autoUpdate` is already `true`, the update callback will be moved from the old ticker to the new one. */
|
||||||
public set ticker (value: Ticker) {
|
public set ticker (value: Ticker) {
|
||||||
|
value = value ?? Ticker.shared;
|
||||||
if (this._ticker === value) return;
|
if (this._ticker === value) return;
|
||||||
|
|
||||||
if (this._autoUpdate) {
|
if (this._autoUpdate) {
|
||||||
@ -453,6 +454,7 @@ export class Spine extends Container {
|
|||||||
/** Destroy Spine game object elements, then call the {@link Container.destroy} with the given options */
|
/** Destroy Spine game object elements, then call the {@link Container.destroy} with the given options */
|
||||||
public override destroy (options?: boolean | IDestroyOptions | undefined): void {
|
public override destroy (options?: boolean | IDestroyOptions | undefined): void {
|
||||||
if (this.autoUpdate) this.autoUpdate = false;
|
if (this.autoUpdate) this.autoUpdate = false;
|
||||||
|
(this._ticker as any) = null;
|
||||||
for (const [, mesh] of this.meshesCache) {
|
for (const [, mesh] of this.meshesCache) {
|
||||||
mesh?.destroy();
|
mesh?.destroy();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -380,6 +380,7 @@ export class Spine extends ViewContainer {
|
|||||||
}
|
}
|
||||||
/** Sets the ticker to use when {@link autoUpdate} is `true`. If `autoUpdate` is already `true`, the update callback will be moved from the old ticker to the new one. */
|
/** Sets the ticker to use when {@link autoUpdate} is `true`. If `autoUpdate` is already `true`, the update callback will be moved from the old ticker to the new one. */
|
||||||
public set ticker (value: Ticker) {
|
public set ticker (value: Ticker) {
|
||||||
|
value = value ?? Ticker.shared;
|
||||||
if (this._ticker === value) return;
|
if (this._ticker === value) return;
|
||||||
|
|
||||||
if (this._autoUpdate) {
|
if (this._autoUpdate) {
|
||||||
@ -1050,6 +1051,7 @@ export class Spine extends ViewContainer {
|
|||||||
super.destroy(options);
|
super.destroy(options);
|
||||||
|
|
||||||
this._ticker.remove(this.internalUpdate, this);
|
this._ticker.remove(this.internalUpdate, this);
|
||||||
|
(this._ticker as any) = null;
|
||||||
this.state.clearListeners();
|
this.state.clearListeners();
|
||||||
this.debug = undefined;
|
this.debug = undefined;
|
||||||
this.skeleton = null as any;
|
this.skeleton = null as any;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user