Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added oncomplete signal #54

Merged
merged 2 commits into from
Jun 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.idea
.tscache
.tscache
.tmp.txt
1 change: 1 addition & 0 deletions build/phaser-spine.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ declare module PhaserSpine {
private globalTint;
game: PhaserSpine.SpineGame;
onEvent: Phaser.Signal;
onComplete: Phaser.Signal;
constructor(game: PhaserSpine.SpineGame, key: string, scalingVariant?: string);
autoUpdate: boolean;
private getScaleFromVariant(variant);
Expand Down
6 changes: 4 additions & 2 deletions build/phaser-spine.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/phaser-spine.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions build/phaser-spine.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions example/spineboy.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
}
});

spineboy.onComplete.add(function (i,e) {
console.log('animation ended');
});

game.input.onDown.add(function () {
spineboy.setAnimationByName(0, "jump", false);
spineboy.addAnimationByName(0, "run", true);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@orange-games/phaser-spine",
"author": "OrangeGames",
"version": "3.0.4",
"version": "3.0.5",
"description": "Spine plugin for Phaser.io!",
"contributors": [
{
Expand Down
3 changes: 3 additions & 0 deletions ts/Spine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module PhaserSpine {

public game: PhaserSpine.SpineGame;
public onEvent: Phaser.Signal;
public onComplete: Phaser.Signal;

/**
* @class Spine
Expand Down Expand Up @@ -58,13 +59,15 @@ module PhaserSpine {
}

this.onEvent = new Phaser.Signal();
this.onComplete = new Phaser.Signal();

this.skeleton = new spine.Skeleton(this.skeletonData);
this.skeleton.updateWorldTransform();

this.stateData = new spine.AnimationStateData(this.skeletonData);
this.state = new spine.AnimationState(this.stateData);
this.state.onEvent = this.onEvent.dispatch.bind(this.onEvent);
this.state.onComplete = this.onComplete.dispatch.bind(this.onComplete);

this.slotContainers = [];

Expand Down