Skip to content

Commit 5ad167a

Browse files
committed
Added jsdocs
1 parent d1f5f8a commit 5ad167a

2 files changed

Lines changed: 361 additions & 42 deletions

File tree

src/scene/SceneManager.js

Lines changed: 85 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,93 @@ var NOOP = require('../utils/NOOP');
1111
var Scene = require('./Scene');
1212
var Systems = require('./Systems');
1313

14+
/**
15+
* @classdesc
16+
* The Scene Systems class.
17+
*
18+
* This class is available from within a Scene under the property `sys`.
19+
* It is responsible for managing all of the plugins a Scene has running, including the display list, and
20+
* handling the update step and renderer. It also contains references to global systems belonging to Game.
21+
*
22+
* @class SceneManager
23+
* @memberOf Phaser.Scenes
24+
* @constructor
25+
* @since 3.0.0
26+
*
27+
* @param {Phaser.Game} game - The Phaser.Game instance this Scene Manager belongs to.
28+
* @param {object} sceneConfig - Scene specific configuration settings.
29+
*/
1430
var SceneManager = new Class({
1531

1632
initialize:
1733

1834
function SceneManager (game, sceneConfig)
1935
{
36+
/**
37+
* [description]
38+
*
39+
* @name Phaser.Scenes.SceneManager#game
40+
* @type {Phaser.Game}
41+
* @since 3.0.0
42+
*/
2043
this.game = game;
2144

22-
// An object that maps the keys to the scene so we can quickly get a scene from a key without iteration
45+
/**
46+
* An object that maps the keys to the scene so we can quickly get a scene from a key without iteration.
47+
*
48+
* @name Phaser.Scenes.SceneManager#keys
49+
* @type {object}
50+
* @since 3.0.0
51+
*/
2352
this.keys = {};
2453

25-
// The array in which all of the scenes are kept
54+
/**
55+
* The array in which all of the scenes are kept.
56+
*
57+
* @name Phaser.Scenes.SceneManager#scenes
58+
* @type {array}
59+
* @since 3.0.0
60+
*/
2661
this.scenes = [];
2762

28-
// Scenes pending to be added are stored in here until the manager has time to add it
63+
/**
64+
* Scenes pending to be added are stored in here until the manager has time to add it.
65+
*
66+
* @name Phaser.Scenes.SceneManager#_pending
67+
* @type {array}
68+
* @private
69+
* @since 3.0.0
70+
*/
2971
this._pending = [];
3072

31-
// An array of scenes waiting to be started once the game has booted
73+
/**
74+
* An array of scenes waiting to be started once the game has booted.
75+
*
76+
* @name Phaser.Scenes.SceneManager#_start
77+
* @type {array}
78+
* @private
79+
* @since 3.0.0
80+
*/
3281
this._start = [];
3382

34-
// An operations queue, because we don't manipulate the scenes array during processing
83+
/**
84+
* An operations queue, because we don't manipulate the scenes array during processing.
85+
*
86+
* @name Phaser.Scenes.SceneManager#_queue
87+
* @type {array}
88+
* @private
89+
* @since 3.0.0
90+
*/
3591
this._queue = [];
3692

93+
/**
94+
* The number of Scenes to process.
95+
*
96+
* @name Phaser.Scenes.SceneManager#_processing
97+
* @type {integer}
98+
* @private
99+
* @since 3.0.0
100+
*/
37101
this._processing = 0;
38102

39103
if (sceneConfig)
@@ -197,9 +261,8 @@ var SceneManager = new Class({
197261
* [description]
198262
*
199263
* @method Phaser.Scenes.SceneManager#bootScene
200-
* @since 3.0.0
201-
*
202264
* @private
265+
* @since 3.0.0
203266
*
204267
* @param {Phaser.Scene} scene - [description]
205268
*/
@@ -249,11 +312,10 @@ var SceneManager = new Class({
249312
* [description]
250313
*
251314
* @method Phaser.Scenes.SceneManager#loadComplete
252-
* @since 3.0.0
253-
*
254315
* @private
316+
* @since 3.0.0
255317
*
256-
* @param {object} event - [description]
318+
* @param {object} loader - [description]
257319
*/
258320
loadComplete: function (loader)
259321
{
@@ -266,11 +328,10 @@ var SceneManager = new Class({
266328
* [description]
267329
*
268330
* @method Phaser.Scenes.SceneManager#payloadComplete
269-
* @since 3.0.0
270-
*
271331
* @private
332+
* @since 3.0.0
272333
*
273-
* @param {object} event - [description]
334+
* @param {object} loader - [description]
274335
*/
275336
payloadComplete: function (loader)
276337
{
@@ -332,9 +393,8 @@ var SceneManager = new Class({
332393
* [description]
333394
*
334395
* @method Phaser.Scenes.SceneManager#create
335-
* @since 3.0.0
336-
*
337396
* @private
397+
* @since 3.0.0
338398
*
339399
* @param {Phaser.Scene} scene - [description]
340400
*/
@@ -354,9 +414,8 @@ var SceneManager = new Class({
354414
* [description]
355415
*
356416
* @method Phaser.Scenes.SceneManager#createSceneFromFunction
357-
* @since 3.0.0
358-
*
359417
* @private
418+
* @since 3.0.0
360419
*
361420
* @param {string} key - [description]
362421
* @param {function} scene - [description]
@@ -404,9 +463,8 @@ var SceneManager = new Class({
404463
* [description]
405464
*
406465
* @method Phaser.Scenes.SceneManager#createSceneFromInstance
407-
* @since 3.0.0
408-
*
409466
* @private
467+
* @since 3.0.0
410468
*
411469
* @param {string} key - [description]
412470
* @param {Phaser.Scene} newScene - [description]
@@ -435,9 +493,8 @@ var SceneManager = new Class({
435493
* [description]
436494
*
437495
* @method Phaser.Scenes.SceneManager#createSceneFromObject
438-
* @since 3.0.0
439-
*
440496
* @private
497+
* @since 3.0.0
441498
*
442499
* @param {string} key - [description]
443500
* @param {object} sceneConfig - [description]
@@ -510,9 +567,8 @@ var SceneManager = new Class({
510567
* [description]
511568
*
512569
* @method Phaser.Scenes.SceneManager#getKey
513-
* @since 3.0.0
514-
*
515570
* @private
571+
* @since 3.0.0
516572
*
517573
* @param {string} key - [description]
518574
* @param {Phaser.Scene|object|function} sceneConfig - [description]
@@ -904,7 +960,7 @@ var SceneManager = new Class({
904960
{
905961
if (this._processing)
906962
{
907-
this._queue.push( { op: 'bringToTop', keyA: key, keyB: null });
963+
this._queue.push({ op: 'bringToTop', keyA: key, keyB: null });
908964
}
909965
else
910966
{
@@ -936,7 +992,7 @@ var SceneManager = new Class({
936992
{
937993
if (this._processing)
938994
{
939-
this._queue.push( { op: 'sendToBack', keyA: key, keyB: null });
995+
this._queue.push({ op: 'sendToBack', keyA: key, keyB: null });
940996
}
941997
else
942998
{
@@ -968,7 +1024,7 @@ var SceneManager = new Class({
9681024
{
9691025
if (this._processing)
9701026
{
971-
this._queue.push( { op: 'moveDown', keyA: key, keyB: null });
1027+
this._queue.push({ op: 'moveDown', keyA: key, keyB: null });
9721028
}
9731029
else
9741030
{
@@ -1002,7 +1058,7 @@ var SceneManager = new Class({
10021058
{
10031059
if (this._processing)
10041060
{
1005-
this._queue.push( { op: 'moveUp', keyA: key, keyB: null });
1061+
this._queue.push({ op: 'moveUp', keyA: key, keyB: null });
10061062
}
10071063
else
10081064
{
@@ -1024,7 +1080,7 @@ var SceneManager = new Class({
10241080

10251081
queueOp: function (op, keyA, keyB)
10261082
{
1027-
this._queue.push( { op: op, keyA: keyA, keyB: keyB });
1083+
this._queue.push({ op: op, keyA: keyA, keyB: keyB });
10281084

10291085
return this;
10301086
},
@@ -1049,7 +1105,7 @@ var SceneManager = new Class({
10491105

10501106
if (this._processing)
10511107
{
1052-
this._queue.push( { op: 'swapPosition', keyA: keyA, keyB: keyB });
1108+
this._queue.push({ op: 'swapPosition', keyA: keyA, keyB: keyB });
10531109
}
10541110
else
10551111
{

0 commit comments

Comments
 (0)