Last active
October 12, 2017 11:10
-
-
Save willian12345/29eb393f4ab6b02438f70eaadb7ed270 to your computer and use it in GitHub Desktop.
Revisions
-
willian12345 revised this gist
Oct 12, 2017 . 1 changed file with 24 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ 引用路径src的网址后加上Tiki官方提供的`openId`参数,并引用下面的SDK地址 ``` <script src="http://biu-assets1.oss-cn-hangzhou.aliyuncs.com/tikigame/utils/js/tiki-game.min.js?openId=58cb58b2e6ec6b1b9b16a855"></script> ``` @@ -41,7 +41,7 @@ code: 1 代表认证过程异常,msg内会有错误信息提示 ``` ## 三、显示游戏 资源加载完后需要主动调用showGameView,用于把Native的loading去掉,一般可以在getRoomInfo获取到信息后再调用 ``` TikiGame.showGameView(); ``` @@ -87,6 +87,7 @@ param1: 获取游戏房间信息回调 resp.uid // 用户自身uid resp.type // resp.to // 房间对手信息对象 resp.pid // 如果有这个字段,则表示是在party内打开了游戏,需要显示游戏的得分与排行信息 // 'to' 房间对手信息对象包含以下属性 { @@ -96,7 +97,7 @@ param1: 获取游戏房间信息回调 uid: '', } }); ``` ### 4、是否为owner (已废弃) param1: 判断是否为owner回调 @@ -113,50 +114,50 @@ param2: 分享标题 param3: 分享完成回调 ``` TikiGame.shareSocialNet('图片base64编码', '分享标题', function(){ console.log('分享成功'); }) ``` ### 6、获取用户分数及排行 ##### 注意:从getRoomInfo内获取的信息中如果pid字段不为空,则需要显示排行榜与得分信息 param: 获取分数后的回调 ``` TikiGame.getUserScore(function(resp){ resp.score;// 在pa内的得分 resp.rank; //在pa内的排行 }); ``` ### 7、增加得分 ##### 注意:从getRoomInfo内获取的信息中如果pid字段不为空,则需要显示排行榜与得分信息 param1: 正整数,分数只有正数,没有负数 param2: 改动分数后的回调 ``` TikiGame.increaseScore(10, function(resp){ resp.score; // 修改后的得分 resp.rank; // 修改分数后的排行 }); ``` ### 8、侦听麦克风音量 param: 实时响应麦克风音量的回调 ``` TikiGame.startRecording(10, function(resp){ resp; // 分贝信息 }); ``` ### 9、显示游戏webview Native在游戏被唤起时,会先显示Loading,直到游戏主动调用此接口将Loading移除掉 ``` TikiGame.showGameView(); ``` -
willian12345 revised this gist
Oct 12, 2017 . 1 changed file with 10 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -39,7 +39,13 @@ code: 1 代表认证过程异常,msg内会有错误信息提示 msg: '' } ``` ## 三、显示游戏 资源加载完后需要主动调用showGameView,用于把Native的loading去掉 ``` TikiGame.showGameView(); ``` ## 四、SDK 列表 ### 1、退出游戏(webview) 调用方式1、直接调用 @@ -111,6 +117,7 @@ TikiGame.shareSocialNet('图片base64编码', '分享标题', function(){ console.log('分享成功'); }) ```` ### 6、获取用户分数及排行 param: 获取分数后的回调 @@ -121,6 +128,7 @@ TikiGame.getUserScore(function(resp){ resp.rank; //在pa内的排行 }); ``` ### 7、增加或减少得分 param1: 正整数为增加分数,负整数为减少分数 @@ -143,6 +151,7 @@ TikiGame.startRecording(10, function(resp){ resp; // 分贝信息 }); ``` ### 9、显示游戏webview Native在游戏被唤起时,会先显示Loading,直到游戏主动调用此接口将Loading移除掉 -
willian12345 revised this gist
Aug 29, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -91,7 +91,7 @@ param1: 获取游戏房间信息回调 } }); ``` ### 4、是否为owner (已废弃) param1: 判断是否为owner回调 ``` -
willian12345 revised this gist
Aug 25, 2017 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,10 +10,10 @@ ## 二、调用TikGame提供的函数 1、所有SDK必须在此方法内调用,这个方法 ``` TikiGame.$(function(resp){ // 所有sdk函数在此内部调用 // resp.code // 回调内参数 resp.data 内包含了当前用户自己的信息 { uid: 'xxx' ,nick: 'xxx' 昵称 @@ -27,7 +27,7 @@ }); ``` resp对象内会返回以下数据结构 code: 0 代表成功获取信息 -
willian12345 revised this gist
Aug 17, 2017 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -143,4 +143,11 @@ TikiGame.startRecording(10, function(resp){ resp; // 分贝信息 }); ``` ### 9、显示游戏webview Native在游戏被唤起时,会先显示Loading,直到游戏主动调用此接口将Loading移除掉 ``` TikiGame.showGameView(); ``` -
willian12345 revised this gist
Aug 8, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,7 +27,7 @@ }); ``` auth完成后回调函数内会返回以下数据结构 code: 0 代表成功获取信息 -
willian12345 revised this gist
Aug 8, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -129,7 +129,7 @@ param2: 改动分数后的回调 ``` TikiGame.increaseScore(10, function(resp){ resp.score; // 修改后的得分 resp.rank; // 修改分数后的排行 }); ``` -
willian12345 revised this gist
Aug 8, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -123,7 +123,9 @@ TikiGame.getUserScore(function(resp){ ``` ### 7、增加或减少得分 param1: 正整数为增加分数,负整数为减少分数 param2: 改动分数后的回调 ``` TikiGame.increaseScore(10, function(resp){ -
willian12345 created this gist
Aug 8, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,144 @@ ## 一、HTML文件引入 引用路径src的网址后加上Tiki官方提供的`openId`参数,并引用下面的SDK地址 ``` <script src="https://17.api.tikiapp.im/games/utils/js/tiki-game.js?openId=58cb58b2e6ec6b1b9b16a855"></script> ``` ## 二、调用TikGame提供的函数 1、所有SDK必须在此方法内调用,这个方法 ``` TikiGame.$(function(auth){ // 所有sdk函数在此内部调用 // 回调内参数 auth.data 内包含了当前用户自己的信息 { uid: 'xxx' ,nick: 'xxx' 昵称 ,avatar: 'xxx' 头像 ,oper: 'xxx' ,relation: 'xx' ,areaName: 'xxx' ,tid: 'xx' ,gender: 'xx' 性别 } }); ``` 如果函数完成后回调函数内会返回以下数据结构 code: 0 代表成功获取信息 code: 1 代表认证过程异常,msg内会有错误信息提示 ``` { code: 0, data: {}, msg: '' } ``` ## 三、SDK 列表 ### 1、退出游戏(webview) 调用方式1、直接调用 ``` TikiGame.exitView(); ``` 调用方式2、需要弹出native confirm框时传递 true ``` TikiGame.exitView(true); ``` ### 2、支付钻石 param1: 从服务端获取的订单信息 param2: 支付完成回调, 回调信息中code为0时代表支付成功,否则msg中会有错误信息提示 ``` TikiGame.payDiamond({ "sign":"d6f67db123524bc1120e93c40b6bbfa4", "desc":"购买3个炸弹", "gameId":"xxx", "notifyurl":"http://airplane.tikiapp.im/pay/callback", "diamonds":"10", "gameId":"58b7c6f9a8a5b6252cadfdbb", "extras":"{\"timestamp\":\"1488790604191\"}", "outOrderId":"12342324234234", }, function(resp){ resp.code; // 0为正常,1为异常 resp.msg; // }); ``` ### 3、获取房间信息 param1: 获取游戏房间信息回调 ``` TikiGame.getRoomInfo(function(resp){ resp.sio // socket链接地址 resp.roomid // resp.uid // 用户自身uid resp.type // resp.to // 房间对手信息对象 // 'to' 房间对手信息对象包含以下属性 { avatar: '' gender: '', nick: '', uid: '', } }); ``` ### 4、是否为owner param1: 判断是否为owner回调 ``` TikiGame.isOwner(function(resp){ console.log('用户是不是owner:', resp); }); ``` ### 5、分享朋友圈 param1: 分享图片的base64编码 param2: 分享标题 param3: 分享完成回调 ``` TikiGame.shareSocialNet('图片base64编码', '分享标题', function(){ console.log('分享成功'); }) ```` ### 6、获取用户分数及排行 param: 获取分数后的回调 ``` TikiGame.getUserScore(function(resp){ resp.score;// 在pa内的得分 resp.rank; //在pa内的排行 }); ``` ### 7、增加或减少得分 param: 改动分数后的回调 ``` TikiGame.increaseScore(10, function(resp){ resp.score; //个性后的得分 resp.rank; // 修改分数后的排行 }); ``` ### 8、侦听麦克风音量 param: 实时响应麦克风音量的回调 ``` TikiGame.startRecording(10, function(resp){ resp; // 分贝信息 }); ```