玩家死亡时,我们会触发此代码,但不会在受挑战的朋友的信使箱中张贴消息。
try{
var playerName = FBInstant.player.getName();
FBInstant.updateAsync({
action: 'CUSTOM',
cta: 'Play',
image: base64Picture,
text: {
default: playerName + ' ate ' + gameScore + ' fish in SeaFrenzy!',
localizations: {
en_US: playerName + ' ate ' + gameScore + ' fish in SeaFrenzy!',
pt_BR: playerName + ' ate ' + gameScore + ' fish in SeaFrenzy!',
}
},
template: 'SeaFrenzy Eats',
data: { myReplayData: '...' },
strategy: 'IMMEDIATE',
notification: 'NO_PUSH',
}).then(function() {
console.log('Message was sent successfully');
});
}
catch(err) {
console.log('FBInstant Games Error: Player Death and score: Internet Not Connected.');
}