2017-06-30 14:47:51 +00:00
|
|
|
var Class = require('../../utils/Class');
|
2017-05-02 15:02:49 +00:00
|
|
|
var EventDispatcher = require('../../events/EventDispatcher');
|
2017-10-04 23:09:12 +00:00
|
|
|
var CustomMap = require('../../structs/Map');
|
2017-04-12 12:53:55 +00:00
|
|
|
|
2017-08-01 12:10:08 +00:00
|
|
|
// Animations are managed by the global AnimationManager. This is a singleton class that is
|
2017-10-04 16:05:26 +00:00
|
|
|
// responsible for creating and delivering animations and their corresponding data to all Game Objects.
|
2017-08-01 12:10:08 +00:00
|
|
|
// Sprites and other Game Objects get the data they need from the AnimationManager.
|
|
|
|
// Access it via `scene.anims`.
|
|
|
|
|
2017-06-30 14:47:51 +00:00
|
|
|
var AnimationManager = new Class({
|
2017-04-12 12:53:55 +00:00
|
|
|
|
2017-06-30 14:47:51 +00:00
|
|
|
initialize:
|
2017-04-12 12:53:55 +00:00
|
|
|
|
2017-10-04 16:05:26 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @class AnimationManager
|
|
|
|
* @memberOf Phaser.Animations
|
|
|
|
* @constructor
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {Phaser.Game} game - [description]
|
|
|
|
*/
|
2017-06-30 14:47:51 +00:00
|
|
|
function AnimationManager (game)
|
|
|
|
{
|
2017-10-04 16:05:26 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Game} game
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-06-30 14:47:51 +00:00
|
|
|
this.game = game;
|
2017-05-02 15:02:49 +00:00
|
|
|
|
2017-10-04 16:05:26 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {[type]} textureManager
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-06-30 14:47:51 +00:00
|
|
|
this.textureManager = null;
|
2017-04-12 12:53:55 +00:00
|
|
|
|
2017-10-04 16:05:26 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Events.EventDispatcher} events
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-06-30 14:47:51 +00:00
|
|
|
this.events = new EventDispatcher();
|
2017-05-02 15:49:48 +00:00
|
|
|
|
2017-10-04 16:05:26 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {number} [globalTimeScale=1]
|
|
|
|
*/
|
2017-06-30 14:47:51 +00:00
|
|
|
this.globalTimeScale = 1;
|
2017-04-12 12:53:55 +00:00
|
|
|
|
2017-10-04 16:05:26 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Structs.Map} anims
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-10-04 23:09:12 +00:00
|
|
|
this.anims = new CustomMap();
|
2017-04-12 12:53:55 +00:00
|
|
|
|
2017-10-04 16:05:26 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {boolean} [paused=false]
|
|
|
|
*/
|
2017-06-30 14:47:51 +00:00
|
|
|
this.paused = false;
|
|
|
|
},
|
2017-04-12 12:53:55 +00:00
|
|
|
|
2017-10-04 16:05:26 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Animations.AnimationManager#boot
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {[type]} textureManager - [description]
|
|
|
|
*/
|
2017-04-12 12:53:55 +00:00
|
|
|
boot: function (textureManager)
|
|
|
|
{
|
|
|
|
this.textureManager = textureManager;
|
|
|
|
},
|
|
|
|
|
2017-10-04 16:05:26 +00:00
|
|
|
/**
|
|
|
|
* @requires AddAnimation
|
|
|
|
*/
|
2017-09-13 13:17:38 +00:00
|
|
|
add: require('./inc/AddAnimation'),
|
2017-10-04 16:05:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @requires CreateFrameAnimation
|
|
|
|
*/
|
2017-09-13 13:17:38 +00:00
|
|
|
create: require('./inc/CreateFrameAnimation'),
|
2017-10-04 16:05:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @requires FromJSON
|
|
|
|
*/
|
2017-09-13 13:17:38 +00:00
|
|
|
fromJSON: require('./inc/FromJSON'),
|
2017-10-04 16:05:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @requires GenerateFrameNames
|
|
|
|
*/
|
2017-09-13 13:17:38 +00:00
|
|
|
generateFrameNames: require('./inc/GenerateFrameNames'),
|
2017-10-04 16:05:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @requires GenerateFrameNumbers
|
|
|
|
*/
|
2017-09-13 13:17:38 +00:00
|
|
|
generateFrameNumbers: require('./inc/GenerateFrameNumbers'),
|
2017-10-04 16:05:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @requires GetAnimation
|
|
|
|
*/
|
2017-09-13 13:17:38 +00:00
|
|
|
get: require('./inc/GetAnimation'),
|
2017-10-04 16:05:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @requires LoadAnimationToGameObject
|
|
|
|
*/
|
2017-09-13 13:17:38 +00:00
|
|
|
load: require('./inc/LoadAnimationToGameObject'),
|
2017-10-04 16:05:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @requires PauseAll
|
|
|
|
*/
|
2017-09-13 13:17:38 +00:00
|
|
|
pauseAll: require('./inc/PauseAll'),
|
2017-10-04 16:05:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @requires PlayAnimation
|
|
|
|
*/
|
2017-09-13 13:17:38 +00:00
|
|
|
play: require('./inc/PlayAnimation'),
|
2017-10-04 16:05:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @requires RemoveAnimation
|
|
|
|
*/
|
2017-09-13 13:17:38 +00:00
|
|
|
remove: require('./inc/RemoveAnimation'),
|
2017-10-04 16:05:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @requires ResumeAll
|
|
|
|
*/
|
2017-09-13 13:17:38 +00:00
|
|
|
resumeAll: require('./inc/ResumeAll'),
|
2017-10-04 16:05:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @requires StaggerPlayAnimation
|
|
|
|
*/
|
2017-09-13 13:17:38 +00:00
|
|
|
staggerPlay: require('./inc/StaggerPlayAnimation'),
|
2017-10-04 16:05:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @requires ToJSON
|
|
|
|
*/
|
2017-09-13 13:17:38 +00:00
|
|
|
toJSON: require('./inc/ToJSON'),
|
2017-04-12 12:53:55 +00:00
|
|
|
|
2017-10-04 16:05:26 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Animations.AnimationManager#destroy
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-04-12 12:53:55 +00:00
|
|
|
destroy: function ()
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
2017-06-30 14:47:51 +00:00
|
|
|
|
|
|
|
});
|
2017-04-12 12:53:55 +00:00
|
|
|
|
|
|
|
module.exports = AnimationManager;
|