mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
[phaser] Fix GameObjectCreator.spine parameter types.
This commit is contained in:
parent
8db318ab85
commit
ba2eb2cf9c
@ -27,12 +27,20 @@
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
import Phaser from "phaser";
|
||||
import phaser from "phaser";
|
||||
import { SPINE_ATLAS_CACHE_KEY, SPINE_CONTAINER_TYPE, SPINE_GAME_OBJECT_TYPE, SPINE_ATLAS_TEXTURE_CACHE_KEY, SPINE_SKELETON_DATA_FILE_TYPE, SPINE_ATLAS_FILE_TYPE, SPINE_SKELETON_FILE_CACHE_KEY as SPINE_SKELETON_DATA_CACHE_KEY } from "./keys";
|
||||
import { AtlasAttachmentLoader, Bone, GLTexture, SceneRenderer, Skeleton, SkeletonBinary, SkeletonData, SkeletonJson, TextureAtlas } from "@esotericsoftware/spine-webgl"
|
||||
import { SpineGameObject, SpineGameObjectBoundsProvider } from "./SpineGameObject";
|
||||
import { CanvasTexture, SkeletonRenderer } from "@esotericsoftware/spine-canvas";
|
||||
|
||||
export interface SpineGameObjectConfig extends Phaser.Types.GameObjects.GameObjectConfig {
|
||||
x?: number,
|
||||
y?: number,
|
||||
dataKey: string,
|
||||
atlasKey: string
|
||||
boundsProvider?: SpineGameObjectBoundsProvider
|
||||
}
|
||||
|
||||
export class SpinePlugin extends Phaser.Plugins.ScenePlugin {
|
||||
game: Phaser.Game;
|
||||
isWebGL: boolean;
|
||||
@ -105,13 +113,11 @@ export class SpinePlugin extends Phaser.Plugins.ScenePlugin {
|
||||
return gameObject;
|
||||
};
|
||||
|
||||
let makeSpineGameObject = function (this: Phaser.GameObjects.GameObjectFactory, config: any, addToScene: boolean) {
|
||||
let makeSpineGameObject = function (this: Phaser.GameObjects.GameObjectFactory, config: SpineGameObjectConfig, addToScene: boolean) {
|
||||
let x = config.x ? config.x : 0;
|
||||
let y = config.y ? config.y : 0;
|
||||
let dataKey = config.dataKey ? config.dataKey : null;
|
||||
let atlasKey = config.atlasKey ? config.atlasKey : null;
|
||||
let y = config.y ? config.y : 0;
|
||||
let boundsProvider = config.boundsProvider ? config.boundsProvider : undefined;
|
||||
let gameObject = new SpineGameObject(this.scene, self, x, y, dataKey, atlasKey, boundsProvider);
|
||||
let gameObject = new SpineGameObject(this.scene, self, x, y, config.dataKey, config.atlasKey, boundsProvider);
|
||||
if (addToScene !== undefined) {
|
||||
config.add = addToScene;
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ export * from "./SpineGameObject"
|
||||
export * from "./mixins"
|
||||
export * from "@esotericsoftware/spine-core";
|
||||
export * from "@esotericsoftware/spine-webgl";
|
||||
import { SpinePlugin } from "./SpinePlugin";
|
||||
import { SpineGameObjectConfig, SpinePlugin } from "./SpinePlugin";
|
||||
(window as any).spine = { SpinePlugin: SpinePlugin };
|
||||
(window as any)["spine.SpinePlugin"] = SpinePlugin;
|
||||
|
||||
@ -25,7 +25,7 @@ declare global {
|
||||
}
|
||||
|
||||
export interface GameObjectCreator {
|
||||
spine(config: any, addToScene: boolean): SpineGameObject;
|
||||
spine(config: SpineGameObjectConfig, addToScene?: boolean): SpineGameObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user