From ee8e264d5ec84441aadc93de4a3f40c5fd9acc0c Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Wed, 27 Jun 2018 13:16:01 +0100 Subject: [PATCH] Return removed total --- src/cameras/2d/CameraManager.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cameras/2d/CameraManager.js b/src/cameras/2d/CameraManager.js index 9ac4e84d1..59d02f72a 100644 --- a/src/cameras/2d/CameraManager.js +++ b/src/cameras/2d/CameraManager.js @@ -504,6 +504,8 @@ var CameraManager = new Class({ * @since 3.0.0 * * @param {(Phaser.Cameras.Scene2D.Camera|Phaser.Cameras.Scene2D.Camera[])} camera - The Camera, or an array of Cameras, to be removed from this Camera Manager. + * + * @return {integer} The total number of Cameras removed. */ remove: function (camera) { @@ -512,6 +514,7 @@ var CameraManager = new Class({ camera = [ camera ]; } + var total = 0; var cameras = this.cameras; for (var i = 0; i < camera.length; i++) @@ -521,7 +524,7 @@ var CameraManager = new Class({ if (index !== -1) { cameras.splice(index, 1); - + total++; } } @@ -529,6 +532,8 @@ var CameraManager = new Class({ { this.main = cameras[0]; } + + return total; }, /**