mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
Added bots methods
This commit is contained in:
parent
9399f32de0
commit
80dcb601c7
1 changed files with 36 additions and 0 deletions
|
@ -73,6 +73,7 @@ var FacebookInstantGamesPlugin = new Class({
|
|||
this.playerID = null;
|
||||
this.playerName = null;
|
||||
this.playerPhotoURL = null;
|
||||
this.playerCanSubscribeBot = false;
|
||||
|
||||
this.paymentsReady = false;
|
||||
this.catalog = [];
|
||||
|
@ -336,6 +337,41 @@ var FacebookInstantGamesPlugin = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
canSubscribeBot: function ()
|
||||
{
|
||||
if (this.supportedAPIs.playerCanSubscribeBotAsync)
|
||||
{
|
||||
var _this = this;
|
||||
|
||||
FBInstant.player.canSubscribeBotAsync().then(function ()
|
||||
{
|
||||
_this.playerCanSubscribeBot = true;
|
||||
|
||||
_this.emit('cansubscribebot');
|
||||
});
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
subscribeBot: function ()
|
||||
{
|
||||
if (this.playerCanSubscribeBot)
|
||||
{
|
||||
var _this = this;
|
||||
|
||||
FBInstant.player.subscribeBotAsync().then(function ()
|
||||
{
|
||||
_this.emit('subscribebot');
|
||||
}).catch(function ()
|
||||
{
|
||||
_this.emit('subscribebotfailed');
|
||||
});
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
getData: function (keys)
|
||||
{
|
||||
if (!this.checkAPI('playerGetDataAsync'))
|
||||
|
|
Loading…
Reference in a new issue