diff --git a/spine-ts/spine-phaser/example/basic-example.html b/spine-ts/spine-phaser/example/basic-example.html index 144f985fcc..0b962deafc 100644 --- a/spine-ts/spine-phaser/example/basic-example.html +++ b/spine-ts/spine-phaser/example/basic-example.html @@ -14,15 +14,30 @@

Basic example

\ No newline at end of file diff --git a/spine-ts/spine-phaser/src/SpinePlugin.ts b/spine-ts/spine-phaser/src/SpinePlugin.ts index 0f8297e6a4..8a537c7ecb 100644 --- a/spine-ts/spine-phaser/src/SpinePlugin.ts +++ b/spine-ts/spine-phaser/src/SpinePlugin.ts @@ -112,7 +112,7 @@ export class SpinePlugin extends Phaser.Plugins.ScenePlugin { return gameObject; }; - let makeSpineGameObject = function (this: Phaser.GameObjects.GameObjectFactory, config: SpineGameObjectConfig, addToScene: boolean) { + let makeSpineGameObject = function (this: Phaser.GameObjects.GameObjectFactory, config: SpineGameObjectConfig, addToScene: boolean = false) { let x = config.x ? config.x : 0; let y = config.y ? config.y : 0; let boundsProvider = config.boundsProvider ? config.boundsProvider : undefined; @@ -184,10 +184,10 @@ export class SpinePlugin extends Phaser.Plugins.ScenePlugin { } createSkeleton (dataKey: string, atlasKey: string) { - return new Skeleton(this.createSkeletonData(dataKey, atlasKey)); + return new Skeleton(this.getSkeletonData(dataKey, atlasKey)); } - createAtlas(atlasKey: string) { + getAtlas(atlasKey: string) { let atlas: TextureAtlas; if (this.atlasCache.exists(atlasKey)) { atlas = this.atlasCache.get(atlasKey); @@ -210,8 +210,8 @@ export class SpinePlugin extends Phaser.Plugins.ScenePlugin { return atlas; } - createSkeletonData(dataKey: string, atlasKey: string) { - const atlas = this.createAtlas(atlasKey) + getSkeletonData(dataKey: string, atlasKey: string) { + const atlas = this.getAtlas(atlasKey) const combinedKey = dataKey + atlasKey; let skeletonData: SkeletonData; if (this.skeletonDataCache.exists(combinedKey)) { diff --git a/spine-ts/spine-phaser/src/index.ts b/spine-ts/spine-phaser/src/index.ts index 8e9f26c484..6d40ee2990 100644 --- a/spine-ts/spine-phaser/src/index.ts +++ b/spine-ts/spine-phaser/src/index.ts @@ -28,4 +28,10 @@ declare global { spine (config: SpineGameObjectConfig, addToScene?: boolean): SpineGameObject; } } + + namespace Phaser { + export interface Scene { + spine: SpinePlugin; + } + } }