没有合适的资源?快使用搜索试试~ 我知道了~
Egret Facebook分享.txt
需积分: 13 5 下载量 92 浏览量
2019-10-17
10:51:38
上传
评论
收藏 4KB TXT 举报
温馨提示
试读
3页
Egret 白鹭Facebook分享demo,多种分享方式,通过图文方式分享给facebook好友
资源推荐
资源详情
资源评论
public static chooseAsync() {//选择游戏环境,可以拉取分享给好友,这样才会有好友的排行榜
FBInstant.context.chooseAsync().then(function () {
MyDebug.log('FBInstant.context.chooseAsync() context.getID()=' + FBInstant.context.getID());
FB.AgentData.updateAsync_CustomUpdate("share_jpg");
});
}
public static switchGameAsync(appID: string) {//请求客户端切换到另一个小游戏
FBInstant.switchGameAsync(appID).catch(function (e) {
// Handle game change failure
MyDebug.log('FBInstant.switchGameAsync() appID=' + appID);
});
}
public static shareAsync(textureName: string): void {//此函数会调用一个对话框,让用户以下列方式分享指定内容:在 Messenger 中发送消息,或在用户时间线上发布帖子。可以在分享内容中附加数据块,通过此次分享启动的每个游戏会话都可以通过 FBInstant.getEntryPointData() 访问此数据块。
MyDebug.log('FBInstant.shareAsync()');
var img: egret.Bitmap = BitmapHelper.createBitmap(textureName, 0, 0);
if (img == null) {
MyDebug.error('FBInstant.shareAsync() img=null');
return;
}
let promise = FBInstant.shareAsync({
intent: 'REQUEST',
image: this.toBase64Picture(img),//必须有图片信息参数
text: FBInstant.player.getName() + ' is asking for your help!',
data: { myReplayData: '' + UserData.userId },
}).then(function () {
MyDebug.log('FBInstant.shareAsync(1) then');
}).catch(function (err) {
FBInstant.context.chooseAsync().then(function () {
MyDebug.log('FBInstant.context.chooseAsync() context.getID()=' + FBInstant.context.getID());
FB.AgentData.updateAsync_CustomUpdate("share_jpg");
});
}
public static switchGameAsync(appID: string) {//请求客户端切换到另一个小游戏
FBInstant.switchGameAsync(appID).catch(function (e) {
// Handle game change failure
MyDebug.log('FBInstant.switchGameAsync() appID=' + appID);
});
}
public static shareAsync(textureName: string): void {//此函数会调用一个对话框,让用户以下列方式分享指定内容:在 Messenger 中发送消息,或在用户时间线上发布帖子。可以在分享内容中附加数据块,通过此次分享启动的每个游戏会话都可以通过 FBInstant.getEntryPointData() 访问此数据块。
MyDebug.log('FBInstant.shareAsync()');
var img: egret.Bitmap = BitmapHelper.createBitmap(textureName, 0, 0);
if (img == null) {
MyDebug.error('FBInstant.shareAsync() img=null');
return;
}
let promise = FBInstant.shareAsync({
intent: 'REQUEST',
image: this.toBase64Picture(img),//必须有图片信息参数
text: FBInstant.player.getName() + ' is asking for your help!',
data: { myReplayData: '' + UserData.userId },
}).then(function () {
MyDebug.log('FBInstant.shareAsync(1) then');
}).catch(function (err) {
资源评论
qq_36722760
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功