From 0fc30e839e49d3dc8824e662390f5349116f1fa4 Mon Sep 17 00:00:00 2001 From: Luc Bloom Date: Tue, 22 Jul 2014 10:42:47 +0200 Subject: [PATCH] Removed some more checks --- src/animation/AnimationManager.js | 29 ++++------------------------- src/loader/Cache.js | 2 +- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/animation/AnimationManager.js b/src/animation/AnimationManager.js index b44b568c1..9f101f25e 100644 --- a/src/animation/AnimationManager.js +++ b/src/animation/AnimationManager.js @@ -112,15 +112,7 @@ Phaser.AnimationManager.prototype = { this.isLoaded = true; - if (this._frameData) - { - return true; - } - else - { - return false; - } - + return true; }, /** @@ -137,12 +129,6 @@ Phaser.AnimationManager.prototype = { */ add: function (name, frames, frameRate, loop, useNumericIndex) { - if (this._frameData === null) - { - console.warn('No FrameData available for Phaser.Animation ' + name); - return; - } - frames = frames || []; frameRate = frameRate || 60; @@ -441,14 +427,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'frameTotal', { get: function () { - if (this._frameData) - { - return this._frameData.total; - } - else - { - return -1; - } + return this._frameData.total; } }); @@ -490,7 +469,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'frame', { set: function (value) { - if (typeof value === 'number' && this._frameData && this._frameData.getFrame(value) !== null) + if (typeof value === 'number' && this._frameData.getFrame(value) !== null) { this.currentFrame = this._frameData.getFrame(value); @@ -529,7 +508,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'frameName', { set: function (value) { - if (typeof value === 'string' && this._frameData && this._frameData.getFrameByName(value) !== null) + if (typeof value === 'string' && this._frameData.getFrameByName(value) !== null) { this.currentFrame = this._frameData.getFrameByName(value); diff --git a/src/loader/Cache.js b/src/loader/Cache.js index d9d2f708b..07a5ddeea 100644 --- a/src/loader/Cache.js +++ b/src/loader/Cache.js @@ -1053,7 +1053,7 @@ Phaser.Cache.prototype = { if (this._images[key]) { - return this._images[key].frameData._frames.length; + return this._images[key].frameData.total; } return 0;