无法在 Facebook 小游戏中提交排行榜分数
failed to submit Leaderboard score in facebook instant games
我无法在排行榜上提交分数。另外,我是 javascript 的新手,所以我不知道如何捕获 setScoreAsync
抛出的错误
FBInstant.getLeaderboardAsync('global')
.then(function(leaderboard) {
return leaderboard.setScoreAsync(gameManager.highscore);
})
.then(function(entry) {
console.log(entry.getScore()); // 42
console.log(entry.getPlayer().getName());
}
});
请帮助我。
您需要在开发人员仪表板中配置 'global' 排行榜(将 "Make leaderboard contextual" 选项设置为 'NO')。
使用:
.catch(function (err)
{
console.log(err);
});
用于捕获错误,方法与 .then()
相同
我无法在排行榜上提交分数。另外,我是 javascript 的新手,所以我不知道如何捕获 setScoreAsync
抛出的错误FBInstant.getLeaderboardAsync('global') .then(function(leaderboard) { return leaderboard.setScoreAsync(gameManager.highscore); }) .then(function(entry) { console.log(entry.getScore()); // 42 console.log(entry.getPlayer().getName()); } });
请帮助我。
您需要在开发人员仪表板中配置 'global' 排行榜(将 "Make leaderboard contextual" 选项设置为 'NO')。 使用:
.catch(function (err)
{
console.log(err);
});
用于捕获错误,方法与 .then()
相同