mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 12:43:26 +00:00
Merge pull request #4961 from ourcade/update-spineplugin-defintions
update SpineGameObject.d.ts
This commit is contained in:
commit
e7b616978a
3 changed files with 159 additions and 117 deletions
18
types/SpineFile.d.ts
vendored
18
types/SpineFile.d.ts
vendored
|
@ -1,18 +1,18 @@
|
||||||
declare namespace Phaser.Loader.FileTypes {
|
declare namespace Phaser.Loader.FileTypes {
|
||||||
interface SpineFileConfig {
|
interface SpineFileConfig {
|
||||||
key: string
|
key: string;
|
||||||
textureURL?: string
|
textureURL?: string;
|
||||||
textureExtension?: string
|
textureExtension?: string;
|
||||||
textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject
|
textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject;
|
||||||
normalMap?: string
|
normalMap?: string;
|
||||||
atlasURL?: string
|
atlasURL?: string;
|
||||||
atlasExtension?: string
|
atlasExtension?: string;
|
||||||
atlasXhrSettings?: Phaser.Types.Loader.XHRSettingsObject
|
atlasXhrSettings?: Phaser.Types.Loader.XHRSettingsObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SpineFile extends Phaser.Loader.MultiFile {
|
class SpineFile extends Phaser.Loader.MultiFile {
|
||||||
constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Loader.FileTypes.SpineFileConfig, jsonURL: string | string[], atlasURL: string, preMultipliedAlpha: boolean, jsonXhrSettings: Phaser.Types.Loader.XHRSettingsObject, atlasXhrSettings: Phaser.Types.Loader.XHRSettingsObject)
|
constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Loader.FileTypes.SpineFileConfig, jsonURL: string | string[], atlasURL: string, preMultipliedAlpha: boolean, jsonXhrSettings: Phaser.Types.Loader.XHRSettingsObject, atlasXhrSettings: Phaser.Types.Loader.XHRSettingsObject)
|
||||||
|
|
||||||
addToCache()
|
addToCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
184
types/SpineGameObject.d.ts
vendored
184
types/SpineGameObject.d.ts
vendored
|
@ -1,85 +1,125 @@
|
||||||
/// <reference path="./spine.d.ts" />
|
/// <reference path="./spine.d.ts" />
|
||||||
|
/// <reference path="./SpinePlugin.d.ts" />
|
||||||
|
|
||||||
declare class SpineGameObject {
|
declare class SpineGameObject extends Phaser.GameObjects.GameObject implements Omit<Phaser.GameObjects.Components.ComputedSize, 'setSize'>, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Flip, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible {
|
||||||
constructor(scene: Phaser.Scene, pluginManager: SpinePlugin, x: number, y: number, key?: string, animationName?: string, loop?: boolean)
|
constructor(scene: Phaser.Scene, pluginManager: SpinePlugin, x: number, y: number, key?: string, animationName?: string, loop?: boolean);
|
||||||
|
|
||||||
alpha: number
|
alpha: number;
|
||||||
|
angle: integer;
|
||||||
|
|
||||||
readonly blendMode: number
|
readonly blendMode: number;
|
||||||
|
|
||||||
blue: number
|
blue: number;
|
||||||
bounds: any
|
bounds: any;
|
||||||
displayOriginX: number
|
displayOriginX: number;
|
||||||
displayOriginY: number
|
displayOriginY: number;
|
||||||
drawDebug: boolean
|
drawDebug: boolean;
|
||||||
green: number
|
depth: number;
|
||||||
plugin: SpinePlugin
|
displayWidth: number;
|
||||||
preMultipliedAlpha: boolean
|
displayHeight: number;
|
||||||
red: number
|
flipX: boolean;
|
||||||
root: spine.Bone
|
flipY: boolean;
|
||||||
|
green: number;
|
||||||
|
height: number;
|
||||||
|
plugin: SpinePlugin;
|
||||||
|
preMultipliedAlpha: boolean;
|
||||||
|
red: number;
|
||||||
|
root: spine.Bone;
|
||||||
|
rotation: number;
|
||||||
|
scale: number;
|
||||||
scaleX: number
|
scaleX: number
|
||||||
scaleY: number
|
scaleY: number
|
||||||
skeleton: spine.Skeleton
|
scrollFactorX: number;
|
||||||
skeletonData: spine.SkeletonData
|
scrollFactorY: number;
|
||||||
state: spine.AnimationState
|
skeleton: spine.Skeleton;
|
||||||
stateData: spine.AnimationStateData
|
skeletonData: spine.SkeletonData;
|
||||||
timeScale: number
|
// @ts-ignore - spine.AnimationState significantly different than GameObject.state
|
||||||
|
state: spine.AnimationState;
|
||||||
|
stateData: spine.AnimationStateData;
|
||||||
|
timeScale: number;
|
||||||
|
visible: boolean;
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
z: number;
|
||||||
|
w: number;
|
||||||
|
width: number;
|
||||||
|
|
||||||
addAnimation(trackIndex: integer, animationName: string, loop?: boolean, delay?: integer): spine.TrackEntry
|
addAnimation(trackIndex: integer, animationName: string, loop?: boolean, delay?: integer): spine.TrackEntry;
|
||||||
angleBoneToXY(bone: spine.Bone, worldX: number, worldY: number, offset?: number, minAngle?: number, maxAngle?: number): SpineGameObject
|
angleBoneToXY(bone: spine.Bone, worldX: number, worldY: number, offset?: number, minAngle?: number, maxAngle?: number): SpineGameObject;
|
||||||
clearTrack(trackIndex: integer): SpineGameObject
|
clearTrack(trackIndex: integer): SpineGameObject;
|
||||||
clearTracks(): SpineGameObject
|
clearTracks(): SpineGameObject;
|
||||||
findAnimation(animationName: string): spine.Animation
|
findAnimation(animationName: string): spine.Animation;
|
||||||
findBone(boneName: string): spine.Bone
|
findBone(boneName: string): spine.Bone;
|
||||||
findBoneIndex(boneName: string): number
|
findBoneIndex(boneName: string): number;
|
||||||
findEvent(eventDataName: string): spine.EventData
|
findEvent(eventDataName: string): spine.EventData;
|
||||||
findIkConstraint(constraintName: string): spine.IkConstraintData
|
findIkConstraint(constraintName: string): spine.IkConstraintData;
|
||||||
findPathConstraint(constraintName: string): spine.PathConstraintData
|
findPathConstraint(constraintName: string): spine.PathConstraintData;
|
||||||
findPathConstraintIndex(constraintName: string): number
|
findPathConstraintIndex(constraintName: string): number;
|
||||||
findSkin(skinName: string): spine.Skin
|
findSkin(skinName: string): spine.Skin;
|
||||||
findSlot(slotName: string): spine.Slot
|
findSlot(slotName: string): spine.Slot;
|
||||||
findSlotIndex(slotName: string): number
|
findSlotIndex(slotName: string): number;
|
||||||
findTransformConstraint(constraintName: string): spine.TransformConstraintData
|
findTransformConstraint(constraintName: string): spine.TransformConstraintData;
|
||||||
getAnimationList(): string[]
|
getAnimationList(): string[];
|
||||||
getAttachment(slotIndex: integer, attachmentName: string): spine.Attachment
|
getAttachment(slotIndex: integer, attachmentName: string): spine.Attachment;
|
||||||
getAttachmentByName(slotName: string, attachmentName: string): spine.Attachment
|
getAttachmentByName(slotName: string, attachmentName: string): spine.Attachment;
|
||||||
getBoneList(): string[]
|
getBoneList(): string[];
|
||||||
getBounds(): any
|
getBounds(): any;
|
||||||
getCurrentAnimation(trackIndex?: integer): spine.Animation
|
getCurrentAnimation(trackIndex?: integer): spine.Animation;
|
||||||
getRootBone(): spine.Bone
|
getLocalTransformMatrix(tempMatrix?: Phaser.GameObjects.Components.TransformMatrix): Phaser.GameObjects.Components.TransformMatrix;
|
||||||
getSkinList(): string[]
|
getParentRotation(): number;
|
||||||
getSlotList(): string[]
|
getRootBone(): spine.Bone;
|
||||||
play(animationName: string, loop?: boolean, ignoreIfPlaying?: boolean): SpineGameObject
|
getSkinList(): string[];
|
||||||
|
getSlotList(): string[];
|
||||||
|
getWorldTransformMatrix(tempMatrix?: Phaser.GameObjects.Components.TransformMatrix, parentMatrix?: Phaser.GameObjects.Components.TransformMatrix): Phaser.GameObjects.Components.TransformMatrix;
|
||||||
|
play(animationName: string, loop?: boolean, ignoreIfPlaying?: boolean): SpineGameObject;
|
||||||
|
|
||||||
protected preUpdate(time: number, delta: number): void
|
protected preUpdate(time: number, delta: number): void;
|
||||||
protected preDestroy(): void
|
protected preDestroy(): void;
|
||||||
|
|
||||||
refresh(): SpineGameObject
|
refresh(): SpineGameObject;
|
||||||
setAlpha(value?: number): SpineGameObject
|
resetFlip(): this;
|
||||||
setAnimation(trackIndex: integer, animationName: string, loop?: boolean, ignoreIfPlaying?: boolean): spine.TrackEntry
|
setAlpha(value?: number): SpineGameObject;
|
||||||
setAttachment(slotName: string, attachmentName: string): SpineGameObject
|
setAngle(degrees?: number): this;
|
||||||
setBonesToSetupPose(): SpineGameObject
|
setAnimation(trackIndex: integer, animationName: string, loop?: boolean, ignoreIfPlaying?: boolean): spine.TrackEntry;
|
||||||
setColor(color?: integer, slotName?: string): SpineGameObject
|
setAttachment(slotName: string, attachmentName: string): SpineGameObject;
|
||||||
setEmptyAnimation(trackIndex: integer, mixDuration?: integer): spine.TrackEntry
|
setBonesToSetupPose(): SpineGameObject;
|
||||||
setMix(fromName: string, toName: string, duration?: number): SpineGameObject
|
setColor(color?: integer, slotName?: string): SpineGameObject;
|
||||||
setOffset(offsetX?: number, offsetY?: number): SpineGameObject
|
setDepth(value: integer): this;
|
||||||
setSize(width?: number, height?: number, offsetX?: number, offsetY?: number): SpineGameObject
|
setDisplaySize(width: number, height: number): this;
|
||||||
setSkeleton(atlasDataKey: string, skeletonJSON: object, animationName?: string, loop?: boolean): SpineGameObject
|
setEmptyAnimation(trackIndex: integer, mixDuration?: integer): spine.TrackEntry;
|
||||||
setSkeletonFromJSON(atlasDataKey: string, skeletonJSON: object, animationName?: string, loop?: boolean): SpineGameObject
|
setFlipX(value: boolean): this;
|
||||||
setSkin(newSkin: spine.Skin): SpineGameObject
|
setFlipY(value: boolean): this;
|
||||||
setSkinByName(skinName: string): SpineGameObject
|
setFlip(x: boolean, y: boolean): this;
|
||||||
setSlotsToSetupPose(): SpineGameObject
|
setMix(fromName: string, toName: string, duration?: number): SpineGameObject;
|
||||||
setToSetupPose(): SpineGameObject
|
setOffset(offsetX?: number, offsetY?: number): SpineGameObject;
|
||||||
updateSize(): SpineGameObject
|
setPosition(x?: number, y?: number, z?: number, w?: number): this;
|
||||||
willRender(): boolean
|
setRandomPosition(x?: number, y?: number, width?: number, height?: number): this;
|
||||||
|
setRotation(radians?: number): this;
|
||||||
|
setScale(x: number, y?: number): this;
|
||||||
|
setScrollFactor(x: number, y?: number): this;
|
||||||
|
setSize(width?: number, height?: number, offsetX?: number, offsetY?: number): SpineGameObject;
|
||||||
|
setSkeleton(atlasDataKey: string, skeletonJSON: object, animationName?: string, loop?: boolean): SpineGameObject;
|
||||||
|
setSkeletonFromJSON(atlasDataKey: string, skeletonJSON: object, animationName?: string, loop?: boolean): SpineGameObject;
|
||||||
|
setSkin(newSkin: spine.Skin): SpineGameObject;
|
||||||
|
setSkinByName(skinName: string): SpineGameObject;
|
||||||
|
setSlotsToSetupPose(): SpineGameObject;
|
||||||
|
setToSetupPose(): SpineGameObject;
|
||||||
|
setVisible(value: boolean): this;
|
||||||
|
setX(value?: number): this;
|
||||||
|
setY(value?: number): this;
|
||||||
|
setZ(value?: number): this;
|
||||||
|
setW(value?: number): this;
|
||||||
|
toggleFlipX(): this;
|
||||||
|
toggleFlipY(): this;
|
||||||
|
updateSize(): SpineGameObject;
|
||||||
|
willRender(): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare interface SpineGameObjectConfig extends Phaser.Types.GameObjects.GameObjectConfig
|
declare interface SpineGameObjectConfig extends Phaser.Types.GameObjects.GameObjectConfig {
|
||||||
{
|
key?: string;
|
||||||
key?: string
|
animationName?: string;
|
||||||
animationName?: string
|
loop?: boolean;
|
||||||
loop?: boolean
|
skinName?: string;
|
||||||
skinName?: string
|
slotName?: string;
|
||||||
slotName?: string
|
attachmentName?: string;
|
||||||
attachmentName?: string
|
|
||||||
}
|
}
|
||||||
|
|
74
types/SpinePlugin.d.ts
vendored
74
types/SpinePlugin.d.ts
vendored
|
@ -1,57 +1,59 @@
|
||||||
/// <reference path="./spine.d.ts" />
|
/// <reference path="./spine.d.ts" />
|
||||||
|
/// <reference path="./SpineFile.d.ts" />
|
||||||
|
/// <reference path="./SpineGameObject.d.ts" />
|
||||||
|
|
||||||
declare namespace Phaser.Loader {
|
declare namespace Phaser.Loader {
|
||||||
interface LoaderPlugin extends Phaser.Events.EventEmitter {
|
interface LoaderPlugin extends Phaser.Events.EventEmitter {
|
||||||
spine(key: string | Phaser.Loader.FileTypes.SpineFileConfig | Phaser.Loader.FileTypes.SpineFileConfig[], jsonURL: string, atlasURL: string | string[], preMultipliedAlpha?: boolean, textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, atlasXhrSettings?: Phaser.Types.Loader.XHRSettingsObject): LoaderPlugin
|
spine(key: string | Phaser.Loader.FileTypes.SpineFileConfig | Phaser.Loader.FileTypes.SpineFileConfig[], jsonURL: string, atlasURL: string | string[], preMultipliedAlpha?: boolean, textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, atlasXhrSettings?: Phaser.Types.Loader.XHRSettingsObject): LoaderPlugin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare namespace Phaser.GameObjects {
|
declare namespace Phaser.GameObjects {
|
||||||
interface GameObjectFactory {
|
interface GameObjectFactory {
|
||||||
spine(x: number, y: number, key?: string, aimationName?: string, loop?: boolean): SpineGameObject
|
spine(x: number, y: number, key?: string, aimationName?: string, loop?: boolean): SpineGameObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GameObjectCreator {
|
interface GameObjectCreator {
|
||||||
spine(config: SpineGameObjectConfig, addToScene?: boolean): SpineGameObject
|
spine(config: SpineGameObjectConfig, addToScene?: boolean): SpineGameObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class SpinePlugin extends Phaser.Plugins.ScenePlugin {
|
declare class SpinePlugin extends Phaser.Plugins.ScenePlugin {
|
||||||
constructor(scene: Phaser.Scene, pluginManager: Phaser.Plugins.PluginManager)
|
constructor(scene: Phaser.Scene, pluginManager: Phaser.Plugins.PluginManager);
|
||||||
|
|
||||||
readonly isWebGL: boolean
|
readonly isWebGL: boolean;
|
||||||
|
|
||||||
cache: Phaser.Cache.BaseCache
|
cache: Phaser.Cache.BaseCache;
|
||||||
spineTextures: Phaser.Cache.BaseCache
|
spineTextures: Phaser.Cache.BaseCache;
|
||||||
json: Phaser.Cache.BaseCache
|
json: Phaser.Cache.BaseCache;
|
||||||
textures: Phaser.Textures.TextureManager
|
textures: Phaser.Textures.TextureManager;
|
||||||
drawDebug: boolean
|
drawDebug: boolean;
|
||||||
gl: WebGLRenderingContext
|
gl: WebGLRenderingContext;
|
||||||
renderer: Phaser.Renderer.Canvas.CanvasRenderer | Phaser.Renderer.WebGL.WebGLRenderer
|
renderer: Phaser.Renderer.Canvas.CanvasRenderer | Phaser.Renderer.WebGL.WebGLRenderer;
|
||||||
sceneRenderer: spine.webgl.SceneRenderer
|
sceneRenderer: spine.webgl.SceneRenderer;
|
||||||
skeletonRenderer: spine.canvas.SkeletonRenderer | spine.webgl.SkeletonRenderer
|
skeletonRenderer: spine.canvas.SkeletonRenderer | spine.webgl.SkeletonRenderer;
|
||||||
skeletonDebugRenderer: spine.webgl.SkeletonDebugRenderer
|
skeletonDebugRenderer: spine.webgl.SkeletonDebugRenderer;
|
||||||
|
|
||||||
plugin: typeof spine
|
plugin: typeof spine;
|
||||||
|
|
||||||
getAtlasCanvas(key: string): spine.TextureAtlas
|
getAtlasCanvas(key: string): spine.TextureAtlas;
|
||||||
getAtlasWebGL(key: string): spine.TextureAtlas
|
getAtlasWebGL(key: string): spine.TextureAtlas;
|
||||||
worldToLocal(x: number, y: number, skeleton: spine.Skeleton, bone?: spine.Bone): spine.Vector2
|
worldToLocal(x: number, y: number, skeleton: spine.Skeleton, bone?: spine.Bone): spine.Vector2;
|
||||||
getVector2(x: number, y: number): spine.Vector2
|
getVector2(x: number, y: number): spine.Vector2;
|
||||||
getVector3(x: number, y: number, z: number): spine.Vector2
|
getVector3(x: number, y: number, z: number): spine.Vector2;
|
||||||
setDebugBones(value?: boolean): SpinePlugin
|
setDebugBones(value?: boolean): SpinePlugin;
|
||||||
setDebugRegionAttachments(value?: boolean): SpinePlugin
|
setDebugRegionAttachments(value?: boolean): SpinePlugin;
|
||||||
setDebugBoundingBoxes(value?: boolean): SpinePlugin
|
setDebugBoundingBoxes(value?: boolean): SpinePlugin;
|
||||||
setDebugMeshHull(value?: boolean): SpinePlugin
|
setDebugMeshHull(value?: boolean): SpinePlugin;
|
||||||
setDebugMeshTriangles(value?: boolean): SpinePlugin
|
setDebugMeshTriangles(value?: boolean): SpinePlugin;
|
||||||
setDebugPaths(value?: boolean): SpinePlugin
|
setDebugPaths(value?: boolean): SpinePlugin;
|
||||||
setDebugSkeletonXY(value?: boolean): SpinePlugin
|
setDebugSkeletonXY(value?: boolean): SpinePlugin;
|
||||||
setDebugClipping(value?: boolean): SpinePlugin
|
setDebugClipping(value?: boolean): SpinePlugin;
|
||||||
setEffect(effect?: spine.VertexEffect): SpinePlugin
|
setEffect(effect?: spine.VertexEffect): SpinePlugin;
|
||||||
createSkeleton(key: string, skeletonJSON?: object): any | null
|
createSkeleton(key: string, skeletonJSON?: object): any | null;
|
||||||
createAnimationState(skeleton: spine.Skeleton): any
|
createAnimationState(skeleton: spine.Skeleton): any;
|
||||||
getBounds(skeleton: spine.Skeleton): any
|
getBounds(skeleton: spine.Skeleton): any;
|
||||||
onResize(): void
|
onResize(): void;
|
||||||
add(x: number, y: number, key?: string, animationName?: string, loop?: boolean): SpineGameObject
|
add(x: number, y: number, key?: string, animationName?: string, loop?: boolean): SpineGameObject;
|
||||||
make(config: SpineGameObjectConfig, addToScene?: boolean): SpineGameObject
|
make(config: SpineGameObjectConfig, addToScene?: boolean): SpineGameObject;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue