mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 21:53:59 +00:00
Calling gameStarted
in a game that doesn't load any assets would cause the error {code: "INVALID_OPERATION", message: "Can not perform this operation before game start."}
. The plugin will now has a new internal method gameStartedHandler
and will redirect the flow accordingly based on asset loading. Fix #4550
This commit is contained in:
parent
163ab4fc19
commit
82401fc74f
2 changed files with 23 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
||||||
### Facebook Instant Games Plugin
|
### Facebook Instant Games Plugin
|
||||||
|
|
||||||
* Calling `showAd` or `showVideoAd` will now check to see if the ad has already been displayed, and skip it when iterating the ads array, allowing you to display an ad with the same Placement ID without preloading it again. Fix #4728 (thanks @NokFrt)
|
* Calling `showAd` or `showVideoAd` will now check to see if the ad has already been displayed, and skip it when iterating the ads array, allowing you to display an ad with the same Placement ID without preloading it again. Fix #4728 (thanks @NokFrt)
|
||||||
|
* Calling `gameStarted` in a game that doesn't load any assets would cause the error `{code: "INVALID_OPERATION", message: "Can not perform this operation before game start."}`. The plugin will now has a new internal method `gameStartedHandler` and will redirect the flow accordingly based on asset loading. Fix #4550 (thanks @bchee)
|
||||||
|
|
||||||
### New Features
|
### New Features
|
||||||
|
|
||||||
|
|
|
@ -387,7 +387,7 @@ var FacebookInstantGamesPlugin = new Class({
|
||||||
{
|
{
|
||||||
this.hasLoaded = true;
|
this.hasLoaded = true;
|
||||||
|
|
||||||
FBInstant.startGameAsync().then(this.gameStarted.bind(this));
|
FBInstant.startGameAsync().then(this.gameStartedHandler.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
|
@ -408,6 +408,27 @@ var FacebookInstantGamesPlugin = new Class({
|
||||||
* @since 3.13.0
|
* @since 3.13.0
|
||||||
*/
|
*/
|
||||||
gameStarted: function ()
|
gameStarted: function ()
|
||||||
|
{
|
||||||
|
if (!this.hasLoaded)
|
||||||
|
{
|
||||||
|
this.hasLoaded = true;
|
||||||
|
|
||||||
|
FBInstant.startGameAsync().then(this.gameStartedHandler.bind(this));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.gameStartedHandler();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The internal gameStarted handler.
|
||||||
|
*
|
||||||
|
* @method Phaser.FacebookInstantGamesPlugin#gameStartedHandler
|
||||||
|
* @private
|
||||||
|
* @since 3.20.0
|
||||||
|
*/
|
||||||
|
gameStartedHandler: function ()
|
||||||
{
|
{
|
||||||
var APIs = FBInstant.getSupportedAPIs();
|
var APIs = FBInstant.getSupportedAPIs();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue