File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ var Remove = function ( event )
2+ {
3+ if ( event === undefined ) { event = this . currentAnim ; }
4+
5+ if ( this . isPlaying && event . key === this . currentAnim . key )
6+ {
7+ console . log ( 'animationRemoved' , event . key ) ;
8+
9+ this . stop ( ) ;
10+
11+ var sprite = this . parent ;
12+ var frame = this . currentAnim . frames [ 0 ] ;
13+
14+ this . currentFrame = frame ;
15+
16+ sprite . texture = frame . frame . texture ;
17+ sprite . frame = frame . frame ;
18+ }
19+ } ;
20+
21+ module . exports = Remove ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ module.exports = {
1111 Paused : require ( './Paused' ) ,
1212 Play : require ( './Play' ) ,
1313 Progress : require ( './Progress' ) ,
14+ Remove : require ( './Remove' ) ,
1415 Repeat : require ( './Repeat' ) ,
1516 RepeatDelay : require ( './RepeatDelay' ) ,
1617 Restart : require ( './Restart' ) ,
Original file line number Diff line number Diff line change 66
77var Map = require ( '../../structs/Map' ) ;
88var Components = require ( './components/' ) ;
9+ var EventDispatcher = require ( '../../events/EventDispatcher' ) ;
10+ var Event = require ( './events' ) ;
911
1012/**
1113* Animations are managed by the global AnimationManager. This is a singleton class that is
@@ -24,6 +26,8 @@ var AnimationManager = function (game)
2426
2527 this . textureManager = null ;
2628
29+ this . events = new EventDispatcher ( ) ;
30+
2731 this . globalTimeScale = 1 ;
2832
2933 this . anims = new Map ( ) ;
Original file line number Diff line number Diff line change 1+ var Event = require ( '../events/' ) ;
2+
13var RemoveAnimation = function ( key )
24{
35 var anim = this . get ( key ) ;
46
57 if ( anim )
68 {
9+ this . events . dispatch ( new Event . REMOVE_ANIMATION_EVENT ( key , anim ) ) ;
10+
711 this . anims . delete ( key ) ;
812 }
913
Original file line number Diff line number Diff line change 1+ var Event = require ( '../../../events/Event' ) ;
2+
3+ var RemoveAnimationEvent = function ( key , animation )
4+ {
5+ Event . call ( this , 'REMOVE_ANIMATION_EVENT' ) ;
6+
7+ this . key = key ;
8+ this . animation = animation ;
9+ } ;
10+
11+ RemoveAnimationEvent . prototype = Object . create ( Event . prototype ) ;
12+ RemoveAnimationEvent . prototype . constructor = RemoveAnimationEvent ;
13+
14+ module . exports = RemoveAnimationEvent ;
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ REMOVE_ANIMATION_EVENT : require ( './RemoveAnimationEvent' )
3+ } ;
Original file line number Diff line number Diff line change 11var CHECKSUM = {
2- build : '82740cb0-2d95 -11e7-8444-edea5df707e2 '
2+ build : '3e738b80-2f48 -11e7-aac0-63674b1afef9 '
33} ;
44module . exports = CHECKSUM ;
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ var Animation = new Class({
1313
1414 this . animationManager = parent . state . sys . anims ;
1515
16+ this . animationManager . events . once ( 'REMOVE_ANIMATION_EVENT' , this . remove . bind ( this ) ) ;
17+
1618 this . isPlaying = false ;
1719
1820 // Reference to the Phaser.Animation object
@@ -73,13 +75,20 @@ var Animation = new Class({
7375 this . _updateParams = [ ] ;
7476 } ,
7577
78+
79+ destroy : function ( )
80+ {
81+
82+ } ,
83+
7684 delay : Components . Delay ,
7785 delayedPlay : Components . DelayedPlay ,
7886 load : Components . Load ,
7987 pause : Components . Pause ,
8088 paused : Components . Paused ,
8189 play : Components . Play ,
8290 progress : Components . Progress ,
91+ remove : Components . Remove ,
8392 repeat : Components . Repeat ,
8493 repeatDelay : Components . RepeatDelay ,
8594 restart : Components . Restart ,
You can’t perform that action at this time.
0 commit comments