mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 14:08:28 +00:00
Modified how ad placement loading works.
This commit is contained in:
parent
da0d9802de
commit
e672592aef
3 changed files with 24 additions and 16 deletions
|
@ -10,6 +10,8 @@
|
|||
* `Leaderboard.getPlayerScore` now only populates the `playerScore` property if the entry isn't `null`.
|
||||
* If the `setScore` or `getPlayerScore` calls fail, it will return `null` as the score instance, instead of causing a run-time error.
|
||||
* 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.
|
||||
|
||||
### Keyboard Input - New Features
|
||||
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
* @property {boolean} video - Is this a video ad?
|
||||
*/
|
||||
|
||||
var AdInstance = function (instance, video)
|
||||
var AdInstance = function (placementID, instance, video)
|
||||
{
|
||||
return {
|
||||
instance: instance,
|
||||
placementID: instance.getPlacementID(),
|
||||
placementID: placementID,
|
||||
shown: false,
|
||||
video: video
|
||||
};
|
||||
|
|
|
@ -1912,15 +1912,18 @@ var FacebookInstantGamesPlugin = new Class({
|
|||
for (i = 0; i < placementID.length; i++)
|
||||
{
|
||||
var id = placementID[i];
|
||||
var data;
|
||||
|
||||
FBInstant.getInterstitialAdAsync(id).then(function (data)
|
||||
FBInstant.getInterstitialAdAsync(id).then(function (interstitial)
|
||||
{
|
||||
var ad = AdInstance(data, true);
|
||||
|
||||
_this.ads.push(ad);
|
||||
|
||||
return ad.loadAsync();
|
||||
|
||||
data = interstitial;
|
||||
|
||||
return interstitial.loadAsync();
|
||||
|
||||
}).then(function ()
|
||||
{
|
||||
_this.ads.push(AdInstance(id, data, false));
|
||||
|
||||
}).catch(function (e)
|
||||
{
|
||||
console.warn(e);
|
||||
|
@ -1976,15 +1979,18 @@ var FacebookInstantGamesPlugin = new Class({
|
|||
for (i = 0; i < placementID.length; i++)
|
||||
{
|
||||
var id = placementID[i];
|
||||
var data;
|
||||
|
||||
FBInstant.getRewardedVideoAsync(id).then(function (data)
|
||||
FBInstant.getRewardedVideoAsync(id).then(function (reward)
|
||||
{
|
||||
var ad = AdInstance(data, true);
|
||||
|
||||
_this.ads.push(ad);
|
||||
|
||||
return ad.loadAsync();
|
||||
|
||||
data = reward;
|
||||
|
||||
return reward.loadAsync();
|
||||
|
||||
}).then(function ()
|
||||
{
|
||||
_this.ads.push(AdInstance(id, data, true));
|
||||
|
||||
}).catch(function (e)
|
||||
{
|
||||
console.warn(e);
|
||||
|
|
Loading…
Add table
Reference in a new issue