@@ -58,6 +58,15 @@ var InputPlugin = new Class({
5858 */
5959 this . systems = scene . sys ;
6060
61+ /**
62+ * [description]
63+ *
64+ * @name Phaser.Input.InputPlugin#settings
65+ * @type {SettingsObject }
66+ * @since 3.4.1
67+ */
68+ this . settings = scene . sys . settings ;
69+
6170 /**
6271 * [description]
6372 *
@@ -67,6 +76,16 @@ var InputPlugin = new Class({
6776 */
6877 this . manager = scene . sys . game . input ;
6978
79+ /**
80+ * [description]
81+ *
82+ * @name Phaser.Input.InputPlugin#enabled
83+ * @type {boolean }
84+ * @default true
85+ * @since 3.4.1
86+ */
87+ this . enabled = true ;
88+
7089 /**
7190 * A reference to this.scene.sys.displayList (set in boot)
7291 *
@@ -280,11 +299,17 @@ var InputPlugin = new Class({
280299 {
281300 var eventEmitter = this . systems . events ;
282301
302+ eventEmitter . on ( 'transitionstart' , this . transitionIn , this ) ;
303+ eventEmitter . on ( 'transitionout' , this . transitionOut , this ) ;
304+ eventEmitter . on ( 'transitioncomplete' , this . transitionComplete , this ) ;
283305 eventEmitter . on ( 'preupdate' , this . preUpdate , this ) ;
284306 eventEmitter . on ( 'update' , this . update , this ) ;
307+
285308 eventEmitter . once ( 'shutdown' , this . shutdown , this ) ;
286309 eventEmitter . once ( 'destroy' , this . destroy , this ) ;
287310
311+ this . enabled = true ;
312+
288313 this . cameras = this . systems . cameras ;
289314
290315 this . displayList = this . systems . displayList ;
@@ -1434,8 +1459,8 @@ var InputPlugin = new Class({
14341459 {
14351460 var manager = this . manager ;
14361461
1437- // Another Scene above this one has already consumed the input events
1438- if ( manager . globalTopOnly && manager . ignoreEvents )
1462+ // Another Scene above this one has already consumed the input events, or we're in transition
1463+ if ( ! this . enabled || ( manager . globalTopOnly && manager . ignoreEvents ) )
14391464 {
14401465 return ;
14411466 }
@@ -1514,6 +1539,45 @@ var InputPlugin = new Class({
15141539 }
15151540 } ,
15161541
1542+ /**
1543+ * The Scene that owns this plugin is transitioning in.
1544+ *
1545+ * @method Phaser.Input.InputPlugin#transitionIn
1546+ * @private
1547+ * @since 3.4.1
1548+ */
1549+ transitionIn : function ( )
1550+ {
1551+ this . enabled = this . settings . transitionAllowInput ;
1552+ } ,
1553+
1554+ /**
1555+ * The Scene that owns this plugin has finished transitioning in.
1556+ *
1557+ * @method Phaser.Input.InputPlugin#transitionComplete
1558+ * @private
1559+ * @since 3.4.1
1560+ */
1561+ transitionComplete : function ( )
1562+ {
1563+ if ( ! this . settings . transitionAllowInput )
1564+ {
1565+ this . enabled = true ;
1566+ }
1567+ } ,
1568+
1569+ /**
1570+ * The Scene that owns this plugin is transitioning out.
1571+ *
1572+ * @method Phaser.Input.InputPlugin#transitionOut
1573+ * @private
1574+ * @since 3.4.1
1575+ */
1576+ transitionOut : function ( )
1577+ {
1578+ this . enabled = this . settings . transitionAllowInput ;
1579+ } ,
1580+
15171581 /**
15181582 * The Scene that owns this plugin is shutting down.
15191583 * We need to kill and reset all internal properties as well as stop listening to Scene events.
@@ -1540,6 +1604,10 @@ var InputPlugin = new Class({
15401604
15411605 var eventEmitter = this . systems . events ;
15421606
1607+ eventEmitter . off ( 'transitionstart' , this . transitionIn , this ) ;
1608+ eventEmitter . off ( 'transitionout' , this . transitionOut , this ) ;
1609+ eventEmitter . off ( 'transitioncomplete' , this . transitionComplete , this ) ;
1610+
15431611 eventEmitter . off ( 'preupdate' , this . preUpdate , this ) ;
15441612 eventEmitter . off ( 'update' , this . update , this ) ;
15451613 eventEmitter . off ( 'shutdown' , this . shutdown , this ) ;
0 commit comments