Swapped ad events placement.

This commit is contained in:
Richard Davey 2018-12-07 01:49:01 +00:00
parent e672592aef
commit 2ed6c649a3
2 changed files with 38 additions and 8 deletions

View file

@ -12,6 +12,10 @@
* You can now pass an object or a string to `setScore` and objects will be automatically stringified.
* The `preloadAds` method will now only create an AdInstance object if the interstitial `loadSync` promise resolves.
* The `preloadVideoAds` method will now only create an AdInstance object if the interstitial `loadSync` promise resolves.
* The `preloadAds` method will now emit the `adsnofill` event, if there are no ads in the inventory to load.
* The `preloadVideoAds` method will now emit the `adsnofill` event, if there are no ads in the inventory to load.
* The `showAd` method will now emit the `adsnotloaded` event, if there are no ads loaded matching the given Placement ID.
* The `showVideo` method will now emit the `adsnotloaded` event, if there are no ads loaded matching the given Placement ID.
### Keyboard Input - New Features

View file

@ -1871,6 +1871,8 @@ var FacebookInstantGamesPlugin = new Class({
*
* If the instance is created successfully then the ad is preloaded ready for display in-game via the method `showAd()`.
*
* If the ad cannot be displayed because there was no inventory to fill it, it will emit the `adsnofill` event.
*
* @method Phaser.FacebookInstantGamesPlugin#preloadAds
* @since 3.13.0
*
@ -1925,8 +1927,19 @@ var FacebookInstantGamesPlugin = new Class({
_this.ads.push(AdInstance(id, data, false));
}).catch(function (e)
{
if (e.code === 'ADS_NO_FILL')
{
_this.emit('adsnofill');
}
else if (e.code === 'ADS_FREQUENT_LOAD')
{
_this.emit('adsfrequentload');
}
else
{
console.warn(e);
}
});
}
@ -1938,6 +1951,8 @@ var FacebookInstantGamesPlugin = new Class({
*
* If the instance is created successfully then the ad is preloaded ready for display in-game via the method `showVideo()`.
*
* If the ad cannot be displayed because there was no inventory to fill it, it will emit the `adsnofill` event.
*
* @method Phaser.FacebookInstantGamesPlugin#preloadVideoAds
* @since 3.13.0
*
@ -1992,8 +2007,19 @@ var FacebookInstantGamesPlugin = new Class({
_this.ads.push(AdInstance(id, data, true));
}).catch(function (e)
{
if (e.code === 'ADS_NO_FILL')
{
_this.emit('adsnofill');
}
else if (e.code === 'ADS_FREQUENT_LOAD')
{
_this.emit('adsfrequentload');
}
else
{
console.warn(e);
}
});
}
@ -2005,7 +2031,7 @@ var FacebookInstantGamesPlugin = new Class({
*
* If the ad is successfully displayed this plugin will emit the `showad` event, with the AdInstance object as its parameter.
*
* If the ad cannot be displayed because there was no inventory to fill it, it will emit the `adsnofill` event.
* If the ad cannot be displayed, it will emit the `adsnotloaded` event.
*
* @method Phaser.FacebookInstantGamesPlugin#showAd
* @since 3.13.0
@ -2032,9 +2058,9 @@ var FacebookInstantGamesPlugin = new Class({
}).catch(function (e)
{
if (e.code === 'ADS_NO_FILL')
if (e.code === 'ADS_NOT_LOADED')
{
_this.emit('adsnofill');
_this.emit('adsnotloaded');
}
else
{
@ -2052,7 +2078,7 @@ var FacebookInstantGamesPlugin = new Class({
*
* If the ad is successfully displayed this plugin will emit the `showad` event, with the AdInstance object as its parameter.
*
* If the ad cannot be displayed because there was no inventory to fill it, it will emit the `adsnofill` event.
* If the ad cannot be displayed, it will emit the `adsnotloaded` event.
*
* @method Phaser.FacebookInstantGamesPlugin#showVideo
* @since 3.13.0
@ -2079,9 +2105,9 @@ var FacebookInstantGamesPlugin = new Class({
}).catch(function (e)
{
if (e.code === 'ADS_NO_FILL')
if (e.code === 'ADS_NOT_LOADED')
{
_this.emit('adsnofill');
_this.emit('adsnotloaded');
}
else
{