zimporter-phaser - v1.0.48
    Preparing search index...

    Class SpinePlugin

    ScenePlugin implementation adding Spine Runtime capabilities to a scene.

    The scene's LoaderPlugin (Scene.load) gets these additional functions:

    • spineBinary(key: string, url: string, xhrSettings?: XHRSettingsObject): loads a skeleton binary .skel file from the url.
    • spineJson(key: string, url: string, xhrSettings?: XHRSettingsObject): loads a skeleton binary .skel file from the url.
    • spineAtlas(key: string, url: string, premultipliedAlpha: boolean = true, xhrSettings?: XHRSettingsObject): loads a texture atlas .atlas file from the url as well as its correponding texture atlas page images.

    The scene's GameObjectFactory (Scene.add) gets these additional functions:

    • spine(x: number, y: number, dataKey: string, atlasKey: string, boundsProvider: SpineGameObjectBoundsProvider = SetupPoseBoundsProvider()): creates a new SpineGameObject from the data and atlas at position (x, y), using the BoundsProvider to calculate its bounding box. The object is automatically added to the scene.

    The scene's GameObjectCreator (Scene.make) gets these additional functions:

    • spine(config: SpineGameObjectConfig): creates a new SpineGameObject from the given configuration object.

    The plugin has additional public methods to work with Spine Runtime core API objects:

    • getAtlas(atlasKey: string): returns the TextureAtlas instance for the given atlas key.
    • getSkeletonData(skeletonDataKey: string): returns the SkeletonData instance for the given skeleton data key.
    • createSkeleton(skeletonDataKey: string, atlasKey: string, premultipliedAlpha: boolean = true): creates a new Skeleton instance from the given skeleton data and atlas key.
    • isPremultipliedAlpha(atlasKey: string): returns true if the atlas with the given key has premultiplied alpha.

    Hierarchy

    • ScenePlugin
      • SpinePlugin
    Index

    Constructors

    • Parameters

      • scene: Scene
      • pluginManager: PluginManager
      • pluginKey: string

      Returns SpinePlugin

    Properties

    canvasRenderer: SkeletonRenderer | null
    game: Game

    A reference to the Game instance this plugin is running under.

    gl: WebGLRenderingContext | null
    phaserRenderer: CanvasRenderer | WebGLRenderer
    pluginKey: string

    The key under which this plugin was installed into the Scene Systems.

    This property is only set when the plugin is instantiated and added to the Scene, not before. You can use it during the boot method.

    pluginManager: PluginManager

    A handy reference to the Plugin Manager that is responsible for this plugin. Can be used as a route to gain access to game systems and events.

    scene: Scene | null

    A reference to the Scene that has installed this plugin. Only set if it's a Scene Plugin, otherwise null. This property is only set when the plugin is instantiated and added to the Scene, not before. You can use it during the boot method.

    systems: Systems | null

    A reference to the Scene Systems of the Scene that has installed this plugin. Only set if it's a Scene Plugin, otherwise null. This property is only set when the plugin is instantiated and added to the Scene, not before. You can use it during the boot method.

    gameWebGLRenderer: SceneRenderer | null
    rendererId: number

    Accessors

    • get webGLRenderer(): SceneRenderer | null

      Returns SceneRenderer | null

    Methods

    • This method is called when the Scene boots. It is only ever called once.

      By this point the plugin properties scene and systems will have already been set.

      In here you can listen for Phaser.Scenes.Events Scene events and set-up whatever you need for this plugin to run. Here are the Scene events you can listen to:

      • start
      • ready
      • preupdate
      • update
      • postupdate
      • resize
      • pause
      • resume
      • sleep
      • wake
      • transitioninit
      • transitionstart
      • transitioncomplete
      • transitionout
      • shutdown
      • destroy

      At the very least you should offer a destroy handler for when the Scene closes down, i.e:

      var eventEmitter = this.systems.events;
      eventEmitter.once('destroy', this.sceneDestroy, this);

      Returns void

    • Creates a new Skeleton instance from the data and atlas.

      Parameters

      • dataKey: string
      • atlasKey: string

      Returns Skeleton

    • Game instance has been destroyed.

      You must release everything in here, all references, all objects, free it all up.

      Returns void

    • Returns void

    • Returns the TextureAtlas instance for the given key

      Parameters

      • atlasKey: string

      Returns TextureAtlas

    • Returns the SkeletonData instance for the given data and atlas key

      Parameters

      • dataKey: string
      • atlasKey: string

      Returns SkeletonData

    • The PluginManager calls this method on a Global Plugin when the plugin is first instantiated. It will never be called again on this instance. In here you can set-up whatever you need for this plugin to run. If a plugin is set to automatically start then BasePlugin.start will be called immediately after this. On a Scene Plugin, this method is never called. Use Phaser.Plugins.ScenePlugin#boot instead.

      Parameters

      • Optionaldata: any

        A value specified by the user, if any, from the data property of the plugin's configuration object (if started at game boot) or passed in the PluginManager's install method (if started manually).

      Returns void

    • Returns whether the TextureAtlas uses premultiplied alpha

      Parameters

      • atlasKey: string

      Returns any

    • Returns void

    • Returns void

    • The PluginManager calls this method on a Global Plugin when the plugin is started. If a plugin is stopped, and then started again, this will get called again. Typically called immediately after BasePlugin.init. On a Scene Plugin, this method is never called.

      Returns void

    • The PluginManager calls this method on a Global Plugin when the plugin is stopped. The game code has requested that your plugin stop doing whatever it does. It is now considered as 'inactive' by the PluginManager. Handle that process here (i.e. stop listening for events, etc) If the plugin is started again then BasePlugin.start will be called again. On a Scene Plugin, this method is never called.

      Returns void