mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 13:13:43 +00:00
Renamed GetObjectValue to GetValue and replaced through-out entire codebase. More consistent now with GetAdvancedValue, etc.
This commit is contained in:
parent
427018d291
commit
8264351f75
21 changed files with 198 additions and 198 deletions
|
@ -1,7 +1,7 @@
|
|||
var CONST = require('../utils/align/const');
|
||||
var AlignIn = require('../utils/align/AlignIn');
|
||||
var Zone = require('../gameobjects/zone/Zone');
|
||||
var GetObjectValue = require('../utils/object/GetObjectValue');
|
||||
var GetValue = require('../utils/object/GetValue');
|
||||
|
||||
var tempZone = new Zone({}, 0, 0, 1, 1);
|
||||
|
||||
|
@ -58,15 +58,15 @@ var tempZone = new Zone({}, 0, 0, 1, 1);
|
|||
*/
|
||||
var GridAlign = function (items, options)
|
||||
{
|
||||
var width = GetObjectValue(options, 'width', -1);
|
||||
var height = GetObjectValue(options, 'height', -1);
|
||||
var cellWidth = GetObjectValue(options, 'cellWidth', 1);
|
||||
var cellHeight = GetObjectValue(options, 'cellHeight', cellWidth);
|
||||
var position = GetObjectValue(options, 'position', CONST.TOP_LEFT);
|
||||
var x = GetObjectValue(options, 'x', 0);
|
||||
var y = GetObjectValue(options, 'y', 0);
|
||||
// var centerX = GetObjectValue(options, 'centerX', null);
|
||||
// var centerY = GetObjectValue(options, 'centerY', null);
|
||||
var width = GetValue(options, 'width', -1);
|
||||
var height = GetValue(options, 'height', -1);
|
||||
var cellWidth = GetValue(options, 'cellWidth', 1);
|
||||
var cellHeight = GetValue(options, 'cellHeight', cellWidth);
|
||||
var position = GetValue(options, 'position', CONST.TOP_LEFT);
|
||||
var x = GetValue(options, 'x', 0);
|
||||
var y = GetValue(options, 'y', 0);
|
||||
// var centerX = GetValue(options, 'centerX', null);
|
||||
// var centerY = GetValue(options, 'centerY', null);
|
||||
|
||||
var cx = 0;
|
||||
var cy = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var GetObjectValue = require('../../utils/object/GetObjectValue');
|
||||
var GetValue = require('../../utils/object/GetValue');
|
||||
var GetFrames = require('./GetFrames');
|
||||
|
||||
var Animation = function (manager, key, config)
|
||||
|
@ -11,14 +11,14 @@ var Animation = function (manager, key, config)
|
|||
this.type = 'frame';
|
||||
|
||||
// Extract all the frame data into the frames array
|
||||
this.frames = GetFrames(manager.textureManager, GetObjectValue(config, 'frames', []));
|
||||
this.frames = GetFrames(manager.textureManager, GetValue(config, 'frames', []));
|
||||
|
||||
// The frame rate of playback in frames per second (default 24 if duration is null)
|
||||
this.frameRate = GetObjectValue(config, 'framerate', null);
|
||||
this.frameRate = GetValue(config, 'framerate', null);
|
||||
|
||||
// How long the animation should play for. If frameRate is set it overrides this value
|
||||
// otherwise frameRate is derived from duration
|
||||
this.duration = GetObjectValue(config, 'duration', null);
|
||||
this.duration = GetValue(config, 'duration', null);
|
||||
|
||||
if (this.duration === null && this.frameRate === null)
|
||||
{
|
||||
|
@ -45,42 +45,42 @@ var Animation = function (manager, key, config)
|
|||
this.msPerFrame = 1000 / this.frameRate;
|
||||
|
||||
// Skip frames if the time lags, or always advanced anyway?
|
||||
this.skipMissedFrames = GetObjectValue(config, 'skipMissedFrames', true);
|
||||
this.skipMissedFrames = GetValue(config, 'skipMissedFrames', true);
|
||||
|
||||
// Delay before starting playback (in seconds)
|
||||
this.delay = GetObjectValue(config, 'delay', 0);
|
||||
this.delay = GetValue(config, 'delay', 0);
|
||||
|
||||
// Number of times to repeat the animation (-1 for infinity)
|
||||
this.repeat = GetObjectValue(config, 'repeat', 0);
|
||||
this.repeat = GetValue(config, 'repeat', 0);
|
||||
|
||||
// Delay before the repeat starts (in seconds)
|
||||
this.repeatDelay = GetObjectValue(config, 'repeatDelay', 0);
|
||||
this.repeatDelay = GetValue(config, 'repeatDelay', 0);
|
||||
|
||||
// Should the animation yoyo? (reverse back down to the start) before repeating?
|
||||
this.yoyo = GetObjectValue(config, 'yoyo', false);
|
||||
this.yoyo = GetValue(config, 'yoyo', false);
|
||||
|
||||
// Should sprite.visible = true when the animation starts to play?
|
||||
this.showOnStart = GetObjectValue(config, 'showOnStart', false);
|
||||
this.showOnStart = GetValue(config, 'showOnStart', false);
|
||||
|
||||
// Should sprite.visible = false when the animation finishes?
|
||||
this.hideOnComplete = GetObjectValue(config, 'hideOnComplete', false);
|
||||
this.hideOnComplete = GetValue(config, 'hideOnComplete', false);
|
||||
|
||||
// Callbacks
|
||||
this.callbackScope = GetObjectValue(config, 'callbackScope', this);
|
||||
this.callbackScope = GetValue(config, 'callbackScope', this);
|
||||
|
||||
this.onStart = GetObjectValue(config, 'onStart', false);
|
||||
this.onStartParams = GetObjectValue(config, 'onStartParams', []);
|
||||
this.onStart = GetValue(config, 'onStart', false);
|
||||
this.onStartParams = GetValue(config, 'onStartParams', []);
|
||||
|
||||
this.onRepeat = GetObjectValue(config, 'onRepeat', false);
|
||||
this.onRepeatParams = GetObjectValue(config, 'onRepeatParams', []);
|
||||
this.onRepeat = GetValue(config, 'onRepeat', false);
|
||||
this.onRepeatParams = GetValue(config, 'onRepeatParams', []);
|
||||
|
||||
// Called for EVERY frame of the animation.
|
||||
// See AnimationFrame.onUpdate for a frame specific callback.
|
||||
this.onUpdate = GetObjectValue(config, 'onUpdate', false);
|
||||
this.onUpdateParams = GetObjectValue(config, 'onUpdateParams', []);
|
||||
this.onUpdate = GetValue(config, 'onUpdate', false);
|
||||
this.onUpdateParams = GetValue(config, 'onUpdateParams', []);
|
||||
|
||||
this.onComplete = GetObjectValue(config, 'onComplete', false);
|
||||
this.onCompleteParams = GetObjectValue(config, 'onCompleteParams', []);
|
||||
this.onComplete = GetValue(config, 'onComplete', false);
|
||||
this.onCompleteParams = GetValue(config, 'onCompleteParams', []);
|
||||
};
|
||||
|
||||
Animation.prototype.constructor = Animation;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var Frame = require('./Frame');
|
||||
var GetObjectValue = require('../../utils/object/GetObjectValue');
|
||||
var GetValue = require('../../utils/object/GetValue');
|
||||
|
||||
var GetFrames = function (textureManager, frames)
|
||||
{
|
||||
|
@ -22,23 +22,23 @@ var GetFrames = function (textureManager, frames)
|
|||
{
|
||||
var item = frames[i];
|
||||
|
||||
var key = GetObjectValue(item, 'key', null);
|
||||
var key = GetValue(item, 'key', null);
|
||||
|
||||
if (!key)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var frame = GetObjectValue(item, 'frame', 0);
|
||||
var frame = GetValue(item, 'frame', 0);
|
||||
|
||||
var textureFrame = textureManager.getFrame(key, frame);
|
||||
|
||||
animationFrame = new Frame(key, frame, index, textureFrame);
|
||||
|
||||
animationFrame.duration = GetObjectValue(item, 'duration', 0);
|
||||
animationFrame.onUpdate = GetObjectValue(item, 'onUpdate', null);
|
||||
animationFrame.duration = GetValue(item, 'duration', 0);
|
||||
animationFrame.onUpdate = GetValue(item, 'onUpdate', null);
|
||||
|
||||
var visible = GetObjectValue(item, 'visible', null);
|
||||
var visible = GetValue(item, 'visible', null);
|
||||
|
||||
if (visible !== null)
|
||||
{
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
var GetObjectValue = require('../../../utils/object/GetObjectValue');
|
||||
var GetValue = require('../../../utils/object/GetValue');
|
||||
var Pad = require('../../../utils/string/Pad');
|
||||
|
||||
var GenerateFrameNames = function (key, config)
|
||||
{
|
||||
var prefix = GetObjectValue(config, 'prefix', '');
|
||||
var start = GetObjectValue(config, 'start', 0);
|
||||
var end = GetObjectValue(config, 'end', 0);
|
||||
var suffix = GetObjectValue(config, 'suffix', '');
|
||||
var zeroPad = GetObjectValue(config, 'zeroPad', 0);
|
||||
var out = GetObjectValue(config, 'framesArray', []);
|
||||
var prefix = GetValue(config, 'prefix', '');
|
||||
var start = GetValue(config, 'start', 0);
|
||||
var end = GetValue(config, 'end', 0);
|
||||
var suffix = GetValue(config, 'suffix', '');
|
||||
var zeroPad = GetValue(config, 'zeroPad', 0);
|
||||
var out = GetValue(config, 'framesArray', []);
|
||||
|
||||
var diff = (start < end) ? 1 : -1;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
var GetObjectValue = require('../../../utils/object/GetObjectValue');
|
||||
var GetValue = require('../../../utils/object/GetValue');
|
||||
|
||||
var GenerateFrameNumbers = function (key, config)
|
||||
{
|
||||
var startFrame = GetObjectValue(config, 'start', 0);
|
||||
var endFrame = GetObjectValue(config, 'end', -1);
|
||||
var firstFrame = GetObjectValue(config, 'first', false);
|
||||
var out = GetObjectValue(config, 'framesArray', []);
|
||||
var startFrame = GetValue(config, 'start', 0);
|
||||
var endFrame = GetValue(config, 'end', -1);
|
||||
var firstFrame = GetValue(config, 'first', false);
|
||||
var out = GetValue(config, 'framesArray', []);
|
||||
|
||||
var texture = this.textureManager.get(key);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
var MATH = require('../math');
|
||||
var CONST = require('../const');
|
||||
var NOOP = require('../utils/NOOP');
|
||||
var GetObjectValue = require('../utils/object/GetObjectValue');
|
||||
var GetValue = require('../utils/object/GetValue');
|
||||
var ValueToColor = require('../graphics/color/ValueToColor');
|
||||
|
||||
var defaultBannerColor = [
|
||||
|
@ -24,57 +24,57 @@ var Config = function (config)
|
|||
{
|
||||
if (config === undefined) { config = {}; }
|
||||
|
||||
this.width = GetObjectValue(config, 'width', 1024);
|
||||
this.height = GetObjectValue(config, 'height', 768);
|
||||
this.zoom = GetObjectValue(config, 'zoom', 1);
|
||||
this.width = GetValue(config, 'width', 1024);
|
||||
this.height = GetValue(config, 'height', 768);
|
||||
this.zoom = GetValue(config, 'zoom', 1);
|
||||
|
||||
this.resolution = GetObjectValue(config, 'resolution', 1);
|
||||
this.resolution = GetValue(config, 'resolution', 1);
|
||||
|
||||
this.renderType = GetObjectValue(config, 'type', CONST.AUTO);
|
||||
this.renderType = GetValue(config, 'type', CONST.AUTO);
|
||||
|
||||
this.parent = GetObjectValue(config, 'parent', null);
|
||||
this.canvas = GetObjectValue(config, 'canvas', null);
|
||||
this.canvasStyle = GetObjectValue(config, 'canvasStyle', null);
|
||||
this.parent = GetValue(config, 'parent', null);
|
||||
this.canvas = GetValue(config, 'canvas', null);
|
||||
this.canvasStyle = GetValue(config, 'canvasStyle', null);
|
||||
|
||||
this.stateConfig = GetObjectValue(config, 'state', null);
|
||||
this.stateConfig = GetValue(config, 'state', null);
|
||||
|
||||
this.seed = GetObjectValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]);
|
||||
this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]);
|
||||
|
||||
MATH.RND.init(this.seed);
|
||||
|
||||
this.gameTitle = GetObjectValue(config, 'title', '');
|
||||
this.gameURL = GetObjectValue(config, 'url', 'http://phaser.io');
|
||||
this.gameVersion = GetObjectValue(config, 'version', '');
|
||||
this.gameTitle = GetValue(config, 'title', '');
|
||||
this.gameURL = GetValue(config, 'url', 'http://phaser.io');
|
||||
this.gameVersion = GetValue(config, 'version', '');
|
||||
|
||||
// Input
|
||||
this.inputKeyboard = GetObjectValue(config, 'input.keyboard', true);
|
||||
this.inputKeyboardEventTarget = GetObjectValue(config, 'input.keyboard.target', window);
|
||||
this.inputKeyboard = GetValue(config, 'input.keyboard', true);
|
||||
this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window);
|
||||
|
||||
// If you do: { banner: false } it won't display any banner at all
|
||||
this.hideBanner = (GetObjectValue(config, 'banner', null) === false);
|
||||
this.hideBanner = (GetValue(config, 'banner', null) === false);
|
||||
|
||||
this.hidePhaser = GetObjectValue(config, 'banner.hidePhaser', false);
|
||||
this.bannerTextColor = GetObjectValue(config, 'banner.text', defaultBannerTextColor);
|
||||
this.bannerBackgroundColor = GetObjectValue(config, 'banner.background', defaultBannerColor);
|
||||
this.hidePhaser = GetValue(config, 'banner.hidePhaser', false);
|
||||
this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor);
|
||||
this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor);
|
||||
|
||||
this.fps = GetObjectValue(config, 'fps', 60);
|
||||
this.forceSetTimeOut = GetObjectValue(config, 'forceSetTimeOut', false);
|
||||
this.fps = GetValue(config, 'fps', 60);
|
||||
this.forceSetTimeOut = GetValue(config, 'forceSetTimeOut', false);
|
||||
|
||||
this.pixelArt = GetObjectValue(config, 'pixelArt', false);
|
||||
this.transparent = GetObjectValue(config, 'transparent', false);
|
||||
this.clearBeforeRender = GetObjectValue(config, 'clearBeforeRender', true);
|
||||
this.backgroundColor = ValueToColor(GetObjectValue(config, 'backgroundColor', 0));
|
||||
this.preserveDrawingBuffer = ValueToColor(GetObjectValue(config, 'preserveDrawingBuffer', false));
|
||||
this.pixelArt = GetValue(config, 'pixelArt', false);
|
||||
this.transparent = GetValue(config, 'transparent', false);
|
||||
this.clearBeforeRender = GetValue(config, 'clearBeforeRender', true);
|
||||
this.backgroundColor = ValueToColor(GetValue(config, 'backgroundColor', 0));
|
||||
this.preserveDrawingBuffer = ValueToColor(GetValue(config, 'preserveDrawingBuffer', false));
|
||||
|
||||
// Callbacks
|
||||
this.preBoot = GetObjectValue(config, 'callbacks.preBoot', NOOP);
|
||||
this.postBoot = GetObjectValue(config, 'callbacks.postBoot', NOOP);
|
||||
this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP);
|
||||
this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP);
|
||||
|
||||
// Default / Missing Images
|
||||
var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg';
|
||||
|
||||
this.defaultImage = GetObjectValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==');
|
||||
this.missingImage = GetObjectValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg==');
|
||||
this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==');
|
||||
this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg==');
|
||||
};
|
||||
|
||||
Config.prototype.constructor = Config;
|
||||
|
|
|
@ -4,7 +4,7 @@ var Components = require('../../components');
|
|||
var Render = require('./GraphicsRender');
|
||||
var Commands = require('./Commands');
|
||||
var MATH_CONST = require('../../math/const');
|
||||
var GetObjectValue = require('../../utils/object/GetObjectValue');
|
||||
var GetValue = require('../../utils/object/GetValue');
|
||||
|
||||
var Graphics = new Class({
|
||||
|
||||
|
@ -23,8 +23,8 @@ var Graphics = new Class({
|
|||
|
||||
function Graphics (state, options)
|
||||
{
|
||||
var x = GetObjectValue(options, 'x', 0);
|
||||
var y = GetObjectValue(options, 'y', 0);
|
||||
var x = GetValue(options, 'x', 0);
|
||||
var y = GetValue(options, 'y', 0);
|
||||
|
||||
GameObject.call(this, state, 'Graphics');
|
||||
|
||||
|
@ -46,19 +46,19 @@ var Graphics = new Class({
|
|||
|
||||
setDefaultStyles: function (options)
|
||||
{
|
||||
if (GetObjectValue(options, 'lineStyle', null))
|
||||
if (GetValue(options, 'lineStyle', null))
|
||||
{
|
||||
this.defaultStrokeWidth = GetObjectValue(options, 'lineStyle.width', 1);
|
||||
this.defaultStrokeColor = GetObjectValue(options, 'lineStyle.color', 0xffffff);
|
||||
this.defaultStrokeAlpha = GetObjectValue(options, 'lineStyle.alpha', 1);
|
||||
this.defaultStrokeWidth = GetValue(options, 'lineStyle.width', 1);
|
||||
this.defaultStrokeColor = GetValue(options, 'lineStyle.color', 0xffffff);
|
||||
this.defaultStrokeAlpha = GetValue(options, 'lineStyle.alpha', 1);
|
||||
|
||||
this.lineStyle(this.defaultStrokeWidth, this.defaultStrokeColor, this.defaultStrokeAlpha);
|
||||
}
|
||||
|
||||
if (GetObjectValue(options, 'fillStyle', null))
|
||||
if (GetValue(options, 'fillStyle', null))
|
||||
{
|
||||
this.defaultFillColor = GetObjectValue(options, 'fillStyle.color', 0xffffff);
|
||||
this.defaultFillAlpha = GetObjectValue(options, 'fillStyle.alpha', 1);
|
||||
this.defaultFillColor = GetValue(options, 'fillStyle.color', 0xffffff);
|
||||
this.defaultFillAlpha = GetValue(options, 'fillStyle.alpha', 1);
|
||||
|
||||
this.fillStyle(this.defaultFillColor, this.defaultFillAlpha);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
var Class = require('../../utils/Class');
|
||||
var Set = require('../../structs/Set');
|
||||
var GetObjectValue = require('../../utils/object/GetObjectValue');
|
||||
var GetValue = require('../../utils/object/GetValue');
|
||||
var Range = require('../../utils/array/Range');
|
||||
var Actions = require('../../actions/');
|
||||
var Sprite = require('../sprite/Sprite');
|
||||
|
@ -56,9 +56,9 @@ var Layer = new Class({
|
|||
|
||||
createFromConfig: function (options)
|
||||
{
|
||||
var key = GetObjectValue(options, 'key', undefined);
|
||||
var frame = GetObjectValue(options, 'frame', null);
|
||||
var visible = GetObjectValue(options, 'visible', true);
|
||||
var key = GetValue(options, 'key', undefined);
|
||||
var frame = GetValue(options, 'frame', null);
|
||||
var visible = GetValue(options, 'visible', true);
|
||||
|
||||
var entries = [];
|
||||
|
||||
|
@ -82,12 +82,12 @@ var Layer = new Class({
|
|||
|
||||
// Build an array of key frame pairs to loop through
|
||||
|
||||
var repeat = GetObjectValue(options, 'repeat', 0);
|
||||
var randomKey = GetObjectValue(options, 'randomKey', false);
|
||||
var randomFrame = GetObjectValue(options, 'randomFrame', false);
|
||||
var yoyo = GetObjectValue(options, 'yoyo', false);
|
||||
var quantity = GetObjectValue(options, 'frameQuantity', 1);
|
||||
var max = GetObjectValue(options, 'max', 0);
|
||||
var repeat = GetValue(options, 'repeat', 0);
|
||||
var randomKey = GetValue(options, 'randomKey', false);
|
||||
var randomFrame = GetValue(options, 'randomFrame', false);
|
||||
var yoyo = GetValue(options, 'yoyo', false);
|
||||
var quantity = GetValue(options, 'frameQuantity', 1);
|
||||
var max = GetValue(options, 'max', 0);
|
||||
|
||||
var range = Range(key, frame, {
|
||||
max: max,
|
||||
|
@ -105,27 +105,27 @@ var Layer = new Class({
|
|||
|
||||
// Post-creation options (applied only to those items created in this call):
|
||||
|
||||
var x = GetObjectValue(options, 'setXY.x', 0);
|
||||
var y = GetObjectValue(options, 'setXY.y', 0);
|
||||
var stepX = GetObjectValue(options, 'setXY.stepX', 0);
|
||||
var stepY = GetObjectValue(options, 'setXY.stepY', 0);
|
||||
var x = GetValue(options, 'setXY.x', 0);
|
||||
var y = GetValue(options, 'setXY.y', 0);
|
||||
var stepX = GetValue(options, 'setXY.stepX', 0);
|
||||
var stepY = GetValue(options, 'setXY.stepY', 0);
|
||||
|
||||
Actions.SetXY(entries, x, y, stepX, stepY);
|
||||
|
||||
var rotation = GetObjectValue(options, 'setRotation.value', 0);
|
||||
var stepRotation = GetObjectValue(options, 'setRotation.step', 0);
|
||||
var rotation = GetValue(options, 'setRotation.value', 0);
|
||||
var stepRotation = GetValue(options, 'setRotation.step', 0);
|
||||
|
||||
Actions.SetRotation(entries, rotation, stepRotation);
|
||||
|
||||
var scaleX = GetObjectValue(options, 'setScale.x', 1);
|
||||
var scaleY = GetObjectValue(options, 'setScale.y', scaleX);
|
||||
var stepScaleX = GetObjectValue(options, 'setScale.stepX', 0);
|
||||
var stepScaleY = GetObjectValue(options, 'setScale.stepY', 0);
|
||||
var scaleX = GetValue(options, 'setScale.x', 1);
|
||||
var scaleY = GetValue(options, 'setScale.y', scaleX);
|
||||
var stepScaleX = GetValue(options, 'setScale.stepX', 0);
|
||||
var stepScaleY = GetValue(options, 'setScale.stepY', 0);
|
||||
|
||||
Actions.SetScale(entries, scaleX, scaleY, stepScaleX, stepScaleY);
|
||||
|
||||
var alpha = GetObjectValue(options, 'setAlpha.value', 1);
|
||||
var stepAlpha = GetObjectValue(options, 'setAlpha.step', 0);
|
||||
var alpha = GetValue(options, 'setAlpha.value', 1);
|
||||
var stepAlpha = GetValue(options, 'setAlpha.step', 0);
|
||||
|
||||
Actions.SetAlpha(entries, alpha, stepAlpha);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var Class = require('../../utils/Class');
|
||||
var GetObjectValue = require('../../utils/object/GetObjectValue');
|
||||
var GetValue = require('../../utils/object/GetValue');
|
||||
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
|
||||
var MeasureText = require('./MeasureText');
|
||||
|
||||
|
@ -60,16 +60,16 @@ var TextStyle = new Class({
|
|||
}
|
||||
}
|
||||
|
||||
var metrics = GetObjectValue(style, 'metrics', false);
|
||||
var metrics = GetValue(style, 'metrics', false);
|
||||
|
||||
// Provide optional TextMetrics in the style object to avoid the canvas look-up / scanning
|
||||
// Doing this is un-done if you then change the font of this TextStyle after creation
|
||||
if (metrics)
|
||||
{
|
||||
this.metrics = {
|
||||
ascent: GetObjectValue(metrics, 'ascent', 0),
|
||||
descent: GetObjectValue(metrics, 'descent', 0),
|
||||
fontSize: GetObjectValue(metrics, 'fontSize', 0)
|
||||
ascent: GetValue(metrics, 'ascent', 0),
|
||||
descent: GetValue(metrics, 'descent', 0),
|
||||
fontSize: GetValue(metrics, 'fontSize', 0)
|
||||
};
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var GetObjectValue = require('../../../utils/object/GetObjectValue');
|
||||
var GetValue = require('../../../utils/object/GetValue');
|
||||
var ResetKeyCombo = require('./ResetKeyCombo');
|
||||
var ProcessKeyCombo = require('./ProcessKeyCombo');
|
||||
var KeyComboMatchEvent = require('./KeyComboMatchEvent');
|
||||
|
@ -66,16 +66,16 @@ var KeyCombo = function (keyboardManager, keys, config)
|
|||
// Custom options ...
|
||||
|
||||
// If they press the wrong key do we reset the combo?
|
||||
this.resetOnWrongKey = GetObjectValue(config, 'resetOnWrongKey', true);
|
||||
this.resetOnWrongKey = GetValue(config, 'resetOnWrongKey', true);
|
||||
|
||||
// The max delay in ms between each key press. Above this the combo is reset. 0 means disabled.
|
||||
this.maxKeyDelay = GetObjectValue(config, 'maxKeyDelay', 0);
|
||||
this.maxKeyDelay = GetValue(config, 'maxKeyDelay', 0);
|
||||
|
||||
// If previously matched and they press Key 1 again, will it reset?
|
||||
this.resetOnMatch = GetObjectValue(config, 'resetOnMatch', false);
|
||||
this.resetOnMatch = GetValue(config, 'resetOnMatch', false);
|
||||
|
||||
// If the combo matches, will it delete itself?
|
||||
this.deleteOnMatch = GetObjectValue(config, 'deleteOnMatch', false);
|
||||
this.deleteOnMatch = GetValue(config, 'deleteOnMatch', false);
|
||||
|
||||
var _this = this;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
var Between = require('../../math/Between');
|
||||
var GetObjectValue = require('../../utils/object/GetObjectValue');
|
||||
var GetValue = require('../../utils/object/GetValue');
|
||||
|
||||
// Phaser.Sound.Dynamic.FX
|
||||
|
||||
|
@ -26,26 +26,26 @@ var FX = function (ctx, config)
|
|||
{
|
||||
this.audioContext = ctx;
|
||||
|
||||
this.frequencyValue = GetObjectValue(config, 'frequency', 200);
|
||||
this.attack = GetObjectValue(config, 'attack', 0);
|
||||
this.decay = GetObjectValue(config, 'decay', 1);
|
||||
this.type = GetObjectValue(config, 'type', 'sine');
|
||||
this.volumeValue = GetObjectValue(config, 'volume', 1);
|
||||
this.panValue = GetObjectValue(config, 'pan', 0);
|
||||
this.wait = GetObjectValue(config, 'wait', 0);
|
||||
this.pitchBendAmount = GetObjectValue(config, 'pitchBend', 0);
|
||||
this.reverse = GetObjectValue(config, 'reverse', false);
|
||||
this.randomValue = GetObjectValue(config, 'random', 0);
|
||||
this.dissonance = GetObjectValue(config, 'dissonance', 0);
|
||||
this.echo = GetObjectValue(config, 'echo', false);
|
||||
this.echoDelay = GetObjectValue(config, 'echo.delay', 0);
|
||||
this.echoFeedback = GetObjectValue(config, 'echo.feedback', 0);
|
||||
this.echoFilter = GetObjectValue(config, 'echo.filter', 0);
|
||||
this.reverb = GetObjectValue(config, 'reverb', false);
|
||||
this.reverbDuration = GetObjectValue(config, 'reverb.duration', 0);
|
||||
this.reverbDecay = GetObjectValue(config, 'reverb.decay', 0);
|
||||
this.reverbReverse = GetObjectValue(config, 'reverb.reverse', false);
|
||||
this.timeout = GetObjectValue(config, 'timeout', false);
|
||||
this.frequencyValue = GetValue(config, 'frequency', 200);
|
||||
this.attack = GetValue(config, 'attack', 0);
|
||||
this.decay = GetValue(config, 'decay', 1);
|
||||
this.type = GetValue(config, 'type', 'sine');
|
||||
this.volumeValue = GetValue(config, 'volume', 1);
|
||||
this.panValue = GetValue(config, 'pan', 0);
|
||||
this.wait = GetValue(config, 'wait', 0);
|
||||
this.pitchBendAmount = GetValue(config, 'pitchBend', 0);
|
||||
this.reverse = GetValue(config, 'reverse', false);
|
||||
this.randomValue = GetValue(config, 'random', 0);
|
||||
this.dissonance = GetValue(config, 'dissonance', 0);
|
||||
this.echo = GetValue(config, 'echo', false);
|
||||
this.echoDelay = GetValue(config, 'echo.delay', 0);
|
||||
this.echoFeedback = GetValue(config, 'echo.feedback', 0);
|
||||
this.echoFilter = GetValue(config, 'echo.filter', 0);
|
||||
this.reverb = GetValue(config, 'reverb', false);
|
||||
this.reverbDuration = GetValue(config, 'reverb.duration', 0);
|
||||
this.reverbDecay = GetValue(config, 'reverb.decay', 0);
|
||||
this.reverbReverse = GetValue(config, 'reverb.reverse', false);
|
||||
this.timeout = GetValue(config, 'timeout', false);
|
||||
|
||||
this.volume = ctx.createGain();
|
||||
this.pan = (!ctx.createStereoPanner) ? ctx.createPanner() : ctx.createStereoPanner();
|
||||
|
|
|
@ -8,7 +8,7 @@ var CONST = require('../const');
|
|||
var NOOP = require('../utils/NOOP');
|
||||
var State = require('./State');
|
||||
var Systems = require('./Systems');
|
||||
var GetObjectValue = require('../utils/object/GetObjectValue');
|
||||
var GetValue = require('../utils/object/GetValue');
|
||||
var EventDispatcher = require('../events/EventDispatcher');
|
||||
var Rectangle = require('../geom/rectangle/Rectangle');
|
||||
var CanvasPool = require('../dom/CanvasPool');
|
||||
|
@ -268,15 +268,15 @@ GlobalStateManager.prototype = {
|
|||
|
||||
// Extract callbacks or set NOOP
|
||||
|
||||
state.init = GetObjectValue(stateConfig, 'init', NOOP);
|
||||
state.preload = GetObjectValue(stateConfig, 'preload', NOOP);
|
||||
state.create = GetObjectValue(stateConfig, 'create', NOOP);
|
||||
state.shutdown = GetObjectValue(stateConfig, 'shutdown', NOOP);
|
||||
state.init = GetValue(stateConfig, 'init', NOOP);
|
||||
state.preload = GetValue(stateConfig, 'preload', NOOP);
|
||||
state.create = GetValue(stateConfig, 'create', NOOP);
|
||||
state.shutdown = GetValue(stateConfig, 'shutdown', NOOP);
|
||||
|
||||
// Game Loop level callbacks
|
||||
|
||||
state.update = GetObjectValue(stateConfig, 'update', NOOP);
|
||||
state.render = GetObjectValue(stateConfig, 'render', NOOP);
|
||||
state.update = GetValue(stateConfig, 'update', NOOP);
|
||||
state.render = GetValue(stateConfig, 'render', NOOP);
|
||||
|
||||
return state;
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
var CONST = require('./const');
|
||||
var ScaleModes = require('../renderer/ScaleModes');
|
||||
var GetObjectValue = require('../utils/object/GetObjectValue');
|
||||
var GetValue = require('../utils/object/GetValue');
|
||||
|
||||
var Settings = {
|
||||
|
||||
|
@ -22,38 +22,38 @@ var Settings = {
|
|||
|
||||
op: CONST.BOOT,
|
||||
|
||||
key: GetObjectValue(config, 'key', ''),
|
||||
active: GetObjectValue(config, 'active', false),
|
||||
visible: GetObjectValue(config, 'visible', true),
|
||||
key: GetValue(config, 'key', ''),
|
||||
active: GetValue(config, 'active', false),
|
||||
visible: GetValue(config, 'visible', true),
|
||||
|
||||
// Loader payload array
|
||||
|
||||
data: {},
|
||||
|
||||
files: GetObjectValue(config, 'files', false),
|
||||
files: GetValue(config, 'files', false),
|
||||
|
||||
// -1 means the State Manager will set it to be the Game dimensions
|
||||
|
||||
x: GetObjectValue(config, 'x', 0),
|
||||
y: GetObjectValue(config, 'y', 0),
|
||||
rotation: GetObjectValue(config, 'rotation', 0),
|
||||
width: GetObjectValue(config, 'width', -1),
|
||||
height: GetObjectValue(config, 'height', -1),
|
||||
x: GetValue(config, 'x', 0),
|
||||
y: GetValue(config, 'y', 0),
|
||||
rotation: GetValue(config, 'rotation', 0),
|
||||
width: GetValue(config, 'width', -1),
|
||||
height: GetValue(config, 'height', -1),
|
||||
|
||||
// State Render Settings (applies only to this State)
|
||||
|
||||
scaleMode: GetObjectValue(config, 'scaleMode', ScaleModes.DEFAULT),
|
||||
roundPixels: GetObjectValue(config, 'roundPixels', false),
|
||||
scaleMode: GetValue(config, 'scaleMode', ScaleModes.DEFAULT),
|
||||
roundPixels: GetValue(config, 'roundPixels', false),
|
||||
|
||||
dirtyRender: GetObjectValue(config, 'dirtyRender', false),
|
||||
renderToTexture: GetObjectValue(config, 'renderToTexture', false),
|
||||
dirtyRender: GetValue(config, 'dirtyRender', false),
|
||||
renderToTexture: GetValue(config, 'renderToTexture', false),
|
||||
|
||||
// The following only apply if renderToTexture is true
|
||||
|
||||
autoResize: GetObjectValue(config, 'autoResize', false),
|
||||
transparent: GetObjectValue(config, 'transparent', false),
|
||||
clearBeforeRender: GetObjectValue(config, 'clearBeforeRender', true),
|
||||
backgroundColor: GetObjectValue(config, 'backgroundColor', false)
|
||||
autoResize: GetValue(config, 'autoResize', false),
|
||||
transparent: GetValue(config, 'transparent', false),
|
||||
clearBeforeRender: GetValue(config, 'clearBeforeRender', true),
|
||||
backgroundColor: GetValue(config, 'backgroundColor', false)
|
||||
|
||||
};
|
||||
},
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
var Parser = require('./parsers');
|
||||
var Texture = require('./Texture');
|
||||
var CanvasPool = require('../dom/CanvasPool');
|
||||
var GetObjectValue = require('../utils/object/GetObjectValue');
|
||||
var GetValue = require('../utils/object/GetValue');
|
||||
|
||||
/**
|
||||
* Textures are managed by the global TextureManager. This is a singleton class that is
|
||||
|
@ -155,8 +155,8 @@ TextureManager.prototype = {
|
|||
|
||||
addSpriteSheetFromAtlas: function (key, config)
|
||||
{
|
||||
var atlasKey = GetObjectValue(config, 'atlas', null);
|
||||
var atlasFrame = GetObjectValue(config, 'frame', null);
|
||||
var atlasKey = GetValue(config, 'atlas', null);
|
||||
var atlasFrame = GetValue(config, 'frame', null);
|
||||
|
||||
if (!atlasKey || !atlasFrame)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var GetObjectValue = require('../../utils/object/GetObjectValue');
|
||||
var GetValue = require('../../utils/object/GetValue');
|
||||
|
||||
/**
|
||||
* Parse a Sprite Sheet and extracts the frame data from it.
|
||||
|
@ -23,8 +23,8 @@ var GetObjectValue = require('../../utils/object/GetObjectValue');
|
|||
*/
|
||||
var SpriteSheet = function (texture, sourceIndex, x, y, width, height, config)
|
||||
{
|
||||
var frameWidth = GetObjectValue(config, 'frameWidth', null);
|
||||
var frameHeight = GetObjectValue(config, 'frameHeight', frameWidth);
|
||||
var frameWidth = GetValue(config, 'frameWidth', null);
|
||||
var frameHeight = GetValue(config, 'frameHeight', frameWidth);
|
||||
|
||||
// If missing we can't proceed
|
||||
if (frameWidth === null)
|
||||
|
@ -37,10 +37,10 @@ var SpriteSheet = function (texture, sourceIndex, x, y, width, height, config)
|
|||
|
||||
texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height);
|
||||
|
||||
var startFrame = GetObjectValue(config, 'startFrame', 0);
|
||||
var endFrame = GetObjectValue(config, 'endFrame', -1);
|
||||
var margin = GetObjectValue(config, 'margin', 0);
|
||||
var spacing = GetObjectValue(config, 'spacing', 0);
|
||||
var startFrame = GetValue(config, 'startFrame', 0);
|
||||
var endFrame = GetValue(config, 'endFrame', -1);
|
||||
var margin = GetValue(config, 'margin', 0);
|
||||
var spacing = GetValue(config, 'spacing', 0);
|
||||
|
||||
var row = Math.floor((width - margin) / (frameWidth + spacing));
|
||||
var column = Math.floor((height - margin) / (frameHeight + spacing));
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var GetObjectValue = require('../../utils/object/GetObjectValue');
|
||||
var GetValue = require('../../utils/object/GetValue');
|
||||
|
||||
/**
|
||||
* Parse a Sprite Sheet and extracts the frame data from it.
|
||||
|
@ -23,8 +23,8 @@ var GetObjectValue = require('../../utils/object/GetObjectValue');
|
|||
*/
|
||||
var SpriteSheetFromAtlas = function (texture, frame, config)
|
||||
{
|
||||
var frameWidth = GetObjectValue(config, 'frameWidth', null);
|
||||
var frameHeight = GetObjectValue(config, 'frameHeight', frameWidth);
|
||||
var frameWidth = GetValue(config, 'frameWidth', null);
|
||||
var frameHeight = GetValue(config, 'frameHeight', frameWidth);
|
||||
|
||||
// If missing we can't proceed
|
||||
if (!frameWidth)
|
||||
|
@ -36,10 +36,10 @@ var SpriteSheetFromAtlas = function (texture, frame, config)
|
|||
// var source = texture.source[0];
|
||||
// texture.add('__BASE', 0, 0, 0, source.width, source.height);
|
||||
|
||||
var startFrame = GetObjectValue(config, 'startFrame', 0);
|
||||
var endFrame = GetObjectValue(config, 'endFrame', -1);
|
||||
var margin = GetObjectValue(config, 'margin', 0);
|
||||
var spacing = GetObjectValue(config, 'spacing', 0);
|
||||
var startFrame = GetValue(config, 'startFrame', 0);
|
||||
var endFrame = GetValue(config, 'endFrame', -1);
|
||||
var margin = GetValue(config, 'margin', 0);
|
||||
var spacing = GetValue(config, 'spacing', 0);
|
||||
|
||||
var x = frame.cutX;
|
||||
var y = frame.cutY;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var Shuffle = require('./Shuffle');
|
||||
var GetObjectValue = require('../object/GetObjectValue');
|
||||
var GetValue = require('../object/GetValue');
|
||||
|
||||
var BuildChunk = function (a, b, qty)
|
||||
{
|
||||
|
@ -51,12 +51,12 @@ var BuildChunk = function (a, b, qty)
|
|||
|
||||
var Range = function (a, b, options)
|
||||
{
|
||||
var max = GetObjectValue(options, 'max', 0);
|
||||
var qty = GetObjectValue(options, 'qty', 1);
|
||||
var random = GetObjectValue(options, 'random', false);
|
||||
var randomB = GetObjectValue(options, 'randomB', false);
|
||||
var repeat = GetObjectValue(options, 'repeat', 0);
|
||||
var yoyo = GetObjectValue(options, 'yoyo', false);
|
||||
var max = GetValue(options, 'max', 0);
|
||||
var qty = GetValue(options, 'qty', 1);
|
||||
var random = GetValue(options, 'random', false);
|
||||
var randomB = GetValue(options, 'randomB', false);
|
||||
var repeat = GetValue(options, 'repeat', 0);
|
||||
var yoyo = GetValue(options, 'yoyo', false);
|
||||
|
||||
var out = [];
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var MATH = require('../../math');
|
||||
var GetObjectValue = require('./GetObjectValue');
|
||||
var GetValue = require('./GetValue');
|
||||
|
||||
// Allowed types:
|
||||
|
||||
|
@ -30,7 +30,7 @@ var GetObjectValue = require('./GetObjectValue');
|
|||
|
||||
var GetAdvancedValue = function (source, key, defaultValue)
|
||||
{
|
||||
var value = GetObjectValue(source, key, null);
|
||||
var value = GetValue(source, key, null);
|
||||
|
||||
if (value === null)
|
||||
{
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
var GetObjectValue = require('./GetObjectValue');
|
||||
var GetValue = require('./GetValue');
|
||||
var Clamp = require('../../math/Clamp');
|
||||
|
||||
var GetMinMaxValue = function (source, key, min, max, defaultValue)
|
||||
{
|
||||
if (defaultValue === undefined) { defaultValue = min; }
|
||||
|
||||
var value = GetObjectValue(source, key, defaultValue);
|
||||
var value = GetValue(source, key, defaultValue);
|
||||
|
||||
return Clamp(value, min, max);
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// The key as a string, or an array of keys, i.e. 'banner', or 'banner.hideBanner'
|
||||
// The default value to use if the key doesn't exist
|
||||
|
||||
var GetObjectValue = function (source, key, defaultValue)
|
||||
var GetValue = function (source, key, defaultValue)
|
||||
{
|
||||
if (!source)
|
||||
{
|
||||
|
@ -40,4 +40,4 @@ var GetObjectValue = function (source, key, defaultValue)
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = GetObjectValue;
|
||||
module.exports = GetValue;
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
Extend: require('./Extend'),
|
||||
GetAdvancedValue: require('./GetAdvancedValue'),
|
||||
GetMinMaxValue: require('./GetMinMaxValue'),
|
||||
GetObjectValue: require('./GetObjectValue'),
|
||||
GetValue: require('./GetValue'),
|
||||
IsPlainObject: require('./IsPlainObject')
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue