From 57f159c64b649d214095800aabe3f134cddc419f Mon Sep 17 00:00:00 2001 From: Edwin222 Date: Sat, 23 Jun 2018 17:17:10 +0900 Subject: [PATCH 1/4] Add description comments to TextureManager.js --- src/textures/TextureManager.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/textures/TextureManager.js b/src/textures/TextureManager.js index fb9667229..48903622c 100644 --- a/src/textures/TextureManager.js +++ b/src/textures/TextureManager.js @@ -18,7 +18,7 @@ var Texture = require('./Texture'); /** * @callback EachTextureCallback * - * @param {Phaser.Textures.Texture} texture - [description] + * @param {Phaser.Textures.Texture} texture - Each texture in Texture Manager. * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. */ @@ -37,7 +37,7 @@ var Texture = require('./Texture'); * @constructor * @since 3.0.0 * - * @param {Phaser.Game} game - [description] + * @param {Phaser.Game} game - The Phaser.Game instance this Texture Manager belongs to. */ var TextureManager = new Class({ @@ -50,7 +50,7 @@ var TextureManager = new Class({ EventEmitter.call(this); /** - * [description] + * The Game that this TextureManager belongs to. * * @name Phaser.Textures.TextureManager#game * @type {Phaser.Game} @@ -59,7 +59,7 @@ var TextureManager = new Class({ this.game = game; /** - * [description] + * The name of this manager. * * @name Phaser.Textures.TextureManager#name * @type {string} @@ -68,7 +68,8 @@ var TextureManager = new Class({ this.name = 'TextureManager'; /** - * [description] + * An object that has all of textures that Texture Manager creates. + * Textures are assigned to keys so we can access to any texture that this object has directly by key value without iteration. * * @name Phaser.Textures.TextureManager#list * @type {object} @@ -78,7 +79,7 @@ var TextureManager = new Class({ this.list = {}; /** - * [description] + * The temporary canvas element to save an pixel data of an arbitrary texture in getPixel() and getPixelAlpha() method. * * @name Phaser.Textures.TextureManager#_tempCanvas * @type {HTMLCanvasElement} @@ -88,7 +89,7 @@ var TextureManager = new Class({ this._tempCanvas = CanvasPool.create2D(this, 1, 1); /** - * [description] + * The context of the temporary canvas element made to save an pixel data in getPixel() and getPixelAlpha() method. * * @name Phaser.Textures.TextureManager#_tempContext * @type {CanvasRenderingContext2D} @@ -98,7 +99,7 @@ var TextureManager = new Class({ this._tempContext = this._tempCanvas.getContext('2d'); /** - * [description] + * An counting value used for emitting 'ready' event after all of managers in game is loaded. * * @name Phaser.Textures.TextureManager#_pending * @type {integer} @@ -112,7 +113,7 @@ var TextureManager = new Class({ }, /** - * [description] + * The Boot Handler called by Phaser.Game when it first starts up. * * @method Phaser.Textures.TextureManager#boot * @since 3.0.0 @@ -131,7 +132,7 @@ var TextureManager = new Class({ }, /** - * [description] + * After 'onload' or 'onerror' invoked twice, emit 'ready' event. * * @method Phaser.Textures.TextureManager#updatePending * @since 3.0.0 @@ -296,7 +297,7 @@ var TextureManager = new Class({ * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {object} config - [description] + * @param {object} config - The configuration object needed to generate the texture. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -909,7 +910,7 @@ var TextureManager = new Class({ * @method Phaser.Textures.TextureManager#setTexture * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the texture would be set on. * @param {string} key - The unique string-based key of the Texture. * @param {(string|integer)} frame - The string or index of the Frame. * From 16eae3887e45c697d7f8cd2dde2d2043f2df6582 Mon Sep 17 00:00:00 2001 From: Edwin222 Date: Sat, 21 Jul 2018 19:50:47 +0900 Subject: [PATCH 2/4] Add ability to play animations in reverse --- src/animations/Animation.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/animations/Animation.js b/src/animations/Animation.js index c6f83bf8b..c8e92cda0 100644 --- a/src/animations/Animation.js +++ b/src/animations/Animation.js @@ -51,6 +51,7 @@ var GetValue = require('../utils/object/GetValue'); * @property {boolean} [yoyo=false] - Should the animation yoyo? (reverse back down to the start) before repeating? * @property {boolean} [showOnStart=false] - Should sprite.visible = true when the animation starts to play? * @property {boolean} [hideOnComplete=false] - Should sprite.visible = false when the animation finishes? + * @property {boolean} [reverse=false] - Should the animation be played in reversed sequence? */ /** @@ -106,6 +107,13 @@ var Animation = new Class({ */ this.type = 'frame'; + // if config.reverse is true, reverse sequence of AnimationFrameConfig[] + var animFrames = GetValue(config, 'frames', []); + if(GetValue(config, 'reverse', false)) + { + animFrames.reverse(); + } + /** * Extract all the frame data into the frames array * @@ -115,7 +123,7 @@ var Animation = new Class({ */ this.frames = this.getFrames( manager.textureManager, - GetValue(config, 'frames', []), + animFrames, GetValue(config, 'defaultTextureKey', null) ); From 98ceb329464e58c67ab150d19c1423b0eeeee6b4 Mon Sep 17 00:00:00 2001 From: Kwondo Park Date: Sat, 21 Jul 2018 20:11:07 +0900 Subject: [PATCH 3/4] Fix trailing space in code --- src/animations/Animation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/animations/Animation.js b/src/animations/Animation.js index c8e92cda0..192f71616 100644 --- a/src/animations/Animation.js +++ b/src/animations/Animation.js @@ -109,7 +109,7 @@ var Animation = new Class({ // if config.reverse is true, reverse sequence of AnimationFrameConfig[] var animFrames = GetValue(config, 'frames', []); - if(GetValue(config, 'reverse', false)) + if(GetValue(config, 'reverse', false)) { animFrames.reverse(); } From a0cc60256919cafc999a906b08e12b12e8695f80 Mon Sep 17 00:00:00 2001 From: Kwondo Park Date: Mon, 23 Jul 2018 14:21:31 +0900 Subject: [PATCH 4/4] cancel reverse animation --- src/animations/Animation.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/animations/Animation.js b/src/animations/Animation.js index 192f71616..c6f83bf8b 100644 --- a/src/animations/Animation.js +++ b/src/animations/Animation.js @@ -51,7 +51,6 @@ var GetValue = require('../utils/object/GetValue'); * @property {boolean} [yoyo=false] - Should the animation yoyo? (reverse back down to the start) before repeating? * @property {boolean} [showOnStart=false] - Should sprite.visible = true when the animation starts to play? * @property {boolean} [hideOnComplete=false] - Should sprite.visible = false when the animation finishes? - * @property {boolean} [reverse=false] - Should the animation be played in reversed sequence? */ /** @@ -107,13 +106,6 @@ var Animation = new Class({ */ this.type = 'frame'; - // if config.reverse is true, reverse sequence of AnimationFrameConfig[] - var animFrames = GetValue(config, 'frames', []); - if(GetValue(config, 'reverse', false)) - { - animFrames.reverse(); - } - /** * Extract all the frame data into the frames array * @@ -123,7 +115,7 @@ var Animation = new Class({ */ this.frames = this.getFrames( manager.textureManager, - animFrames, + GetValue(config, 'frames', []), GetValue(config, 'defaultTextureKey', null) );