panda_game_center
v1.0.10
Published
熊猫招财游戏盒子 jssdk
Downloads
5
Readme
安装
npm install xiebinbin/panda_game_center
// es6
import pandaGameCenter from "panda_game_center";
// 直接引用
<script src="./lib/panda.js"></script>
<script>
pandaGameCenter.echo();
</script>
使用
获取用户信息
pandaGameCenter.authInfo().then(function(user){
// your code
}).error(function(err){
// your code
});
用户信息
{
"openid": "oxajF6BBb3Vsx4Btc98DOBRhiw7s",
"nickname": "喵呜",
"sex": 0,
"language": "zh_CN",
"city": "",
"province": "",
"country": "",
"headimgurl": "https:\/\/thirdwx.qlogo.cn\/mmopen\/vi_32\/2d6iciaMbNdbF3Ahca04mWy1QuVOD7pEnKKQHY2Pk67asyeV7X1tW7icHWvw9NQsRqDu0ylF03PmzG6Rc3ORKTwQg\/132",
"privilege": [],
"unionid": "oO90K08BOGbDfVsOA9vyBtb5I9-8"
}
打开红包
/**
params {
"游戏类型 LEVEL"
type: "LEVEL",
}
*/
pandaGameCenter.openRedPack(params, callback);
打开广告
/**
params {
"类型 FULL_SCREEN全屏 TABLE_SCREEN插屏"
type: "FULL_SCREEN"
}
*/
/**
options = {
onError: (msg) => {
// 异常回调
},
onLoad: () => {
// 广告展现回调
},
onClose: () => {
// 广告关闭回调
// 广告关闭为界面关闭的回调
},
onSkip: () => {
// 广告跳过回调
},
onFinish: () => {
// 广告播放完成回调
}
}
*/
pandaGameCenter.openAd(params,options)
上传游戏数据
/**
params {
"当前完成关卡"
level: 1
}
*/
pandaGameCenter.uploadGameData(params);