Namespace adjustments

This commit is contained in:
Richard Davey 2020-12-17 11:40:03 +00:00
parent 04dd273fb3
commit ba1570089c
2 changed files with 45 additions and 22 deletions

View file

@ -13,17 +13,11 @@ var Extend = require('./utils/object/Extend');
* @namespace Phaser * @namespace Phaser
*/ */
/**
* The root types namespace.
*
* @namespace Phaser.Types
* @since 3.17.0
*/
var Phaser = { var Phaser = {
Actions: require('./actions'), Actions: require('./actions'),
Animations: require('./animations'), Animations: require('./animations'),
BlendModes: require('./renderer/BlendModes'),
Cache: require('./cache'), Cache: require('./cache'),
Cameras: require('./cameras'), Cameras: require('./cameras'),
Core: require('./core'), Core: require('./core'),
@ -44,7 +38,9 @@ var Phaser = {
Arcade: require('./physics/arcade') Arcade: require('./physics/arcade')
}, },
Plugins: require('./plugins'), Plugins: require('./plugins'),
Renderer: require('./renderer'),
Scale: require('./scale'), Scale: require('./scale'),
ScaleModes: require('./renderer/ScaleModes'),
Scene: require('./scene/Scene'), Scene: require('./scene/Scene'),
Scenes: require('./scene'), Scenes: require('./scene'),
Structs: require('./structs'), Structs: require('./structs'),
@ -56,15 +52,37 @@ var Phaser = {
}; };
// Merge in the consts // Merge in the optional plugins and WebGL only features
Phaser = Extend(false, Phaser, CONST);
if (typeof FEATURE_SOUND) if (typeof FEATURE_SOUND)
{ {
Phaser.Sound = require('./sound'); Phaser.Sound = require('./sound');
} }
if (typeof PLUGIN_CAMERA3D)
{
Phaser.Cameras.Sprite3D = require('../plugins/camera3d/src');
Phaser.GameObjects.Sprite3D = require('../plugins/camera3d/src/sprite3d/Sprite3D');
Phaser.GameObjects.Factories.Sprite3D = require('../plugins/camera3d/src/sprite3d/Sprite3DFactory');
Phaser.GameObjects.Creators.Sprite3D = require('../plugins/camera3d/src/sprite3d/Sprite3DCreator');
}
if (typeof PLUGIN_FBINSTANT)
{
Phaser.FacebookInstantGamesPlugin = require('../plugins/fbinstant/src/FacebookInstantGamesPlugin');
}
// Merge in the consts
Phaser = Extend(false, Phaser, CONST);
/**
* The root types namespace.
*
* @namespace Phaser.Types
* @since 3.17.0
*/
// Export it // Export it
module.exports = Phaser; module.exports = Phaser;

View file

@ -13,22 +13,17 @@ var Extend = require('./utils/object/Extend');
* @namespace Phaser * @namespace Phaser
*/ */
/**
* The root types namespace.
*
* @namespace Phaser.Types
* @since 3.17.0
*/
var Phaser = { var Phaser = {
Animations: require('./animations'), Animations: require('./animations'),
BlendModes: require('./renderer/BlendModes'),
Cache: require('./cache'), Cache: require('./cache'),
Cameras: { Scene2D: require('./cameras/2d') }, Cameras: { Scene2D: require('./cameras/2d') },
Core: require('./core'), Core: require('./core'),
Class: require('./utils/Class'), Class: require('./utils/Class'),
Data: require('./data'), Data: require('./data'),
Display: { Masks: require('./display/mask') }, Display: { Masks: require('./display/mask') },
DOM: require('./dom'),
Events: require('./events'), Events: require('./events'),
Game: require('./core/Game'), Game: require('./core/Game'),
GameObjects: { GameObjects: {
@ -96,6 +91,7 @@ var Phaser = {
Plugins: require('./plugins'), Plugins: require('./plugins'),
Renderer: require('./renderer'), Renderer: require('./renderer'),
Scale: require('./scale'), Scale: require('./scale'),
ScaleModes: require('./renderer/ScaleModes'),
Scene: require('./scene/Scene'), Scene: require('./scene/Scene'),
Scenes: require('./scene'), Scenes: require('./scene'),
Structs: require('./structs'), Structs: require('./structs'),
@ -104,17 +100,26 @@ var Phaser = {
Tweens: require('./tweens') Tweens: require('./tweens')
}; };
// Merge in the consts // Merge in the consts// Merge in the optional plugins and WebGL only features
Phaser = Extend(false, Phaser, CONST);
// Export it
if (typeof FEATURE_SOUND) if (typeof FEATURE_SOUND)
{ {
Phaser.Sound = require('./sound'); Phaser.Sound = require('./sound');
} }
// Merge in the consts
Phaser = Extend(false, Phaser, CONST);
/**
* The root types namespace.
*
* @namespace Phaser.Types
* @since 3.17.0
*/
// Export it
module.exports = Phaser; module.exports = Phaser;
global.Phaser = Phaser; global.Phaser = Phaser;