mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 22:18:29 +00:00
Added disableInteractive and removeInteractive methods. #3621
This commit is contained in:
parent
0441e19f2b
commit
672a535d88
2 changed files with 54 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
# Change Log
|
||||
|
||||
## Version 3.7.0 - Sinon - in development
|
||||
## Version 3.7.0 - Sinon - 8th May 2018
|
||||
|
||||
### New Features
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
|||
* CanvasTexture is a new extension of the Texture object specifically created for when you've got a Canvas element as the backing source of the texture that you wish to draw to programmatically using the Canvas API. This was possible in previous versions, as a Texture object supported having a Canvas as its source, but we've streamlined the process and made it a lot easier for you to refresh the resulting WebGLTexture on the GPU. To create a CanvasTexture just call the `TextureManager.createCanvas` method as before, only this time you'll get a CanvasTexture back which has helper properties and methods. See the complete JSDocs for more details.
|
||||
* RandomDataGenerator has a new method: `shuffle` which allows you to shuffle an array using the current RNG seed (thanks @wtravO)
|
||||
* The Texture Manager now supports normal maps for Atlas JSON (in both hash and array formats), Atlas XML and Atlas Unity.
|
||||
* All Game Objects have a new method `disableInteractive` which will disable the Interactive Object bound to them. You can toggle it back again by calling `setInteractive` with no arguments.
|
||||
* All Game Objects have a new method `removeInteractive` which will destroy the Interactive Object bound to them entirely. Use this if a Game Object no longer needs any input at all but you don't want to destroy the Game Object itself.
|
||||
|
||||
### Loader New Features and Important Updates
|
||||
|
||||
|
|
|
@ -291,6 +291,57 @@ var GameObject = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* If this Game Object has previously been enabled for input, this will disable it.
|
||||
*
|
||||
* An object that is disabled for input stops processing or being considered for
|
||||
* input events, but can be turned back on again at any time by simply calling
|
||||
* `setInteractive()` with no arguments provided.
|
||||
*
|
||||
* If want to completely remove interaction from this Game Object then use `removeInteractive` instead.
|
||||
*
|
||||
* @method Phaser.GameObjects.GameObject#disableInteractive
|
||||
* @since 3.7.0
|
||||
*
|
||||
* @return {Phaser.GameObjects.GameObject} This GameObject.
|
||||
*/
|
||||
disableInteractive: function ()
|
||||
{
|
||||
if (this.input)
|
||||
{
|
||||
this.input.enabled = (this.input.enabled) ? false : true;
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* If this Game Object has previously been enabled for input, this will remove it.
|
||||
*
|
||||
* The Interactive Object that was assigned to this Game Object will be destroyed,
|
||||
* removed from the Input Manager and cleared from this Game Object.
|
||||
*
|
||||
* If you wish to re-enable this Game Object at a later date you will need to
|
||||
* re-create its InteractiveOobject by calling `setInteractive` again.
|
||||
*
|
||||
* If you wish to only temporarily stop an object from receiving input then use
|
||||
* `disableInteractive` instead, as that toggles the interactive state, where-as
|
||||
* this erases it completely.
|
||||
*
|
||||
* @method Phaser.GameObjects.GameObject#removeInteractive
|
||||
* @since 3.7.0
|
||||
*
|
||||
* @return {Phaser.GameObjects.GameObject} This GameObject.
|
||||
*/
|
||||
removeInteractive: function ()
|
||||
{
|
||||
this.scene.sys.input.clear(this);
|
||||
|
||||
this.input = undefined;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* To be overridden by custom GameObjects. Allows base objects to be used in a Pool.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue