1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- // Learn cc.Class:
- // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
- // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
- // Learn Attribute:
- // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
- // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
- // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
- if (CC_WECHATGAME) {
- window.Global = {
- //Urls
- loginUrl: 'https://test-api-pudding.duowan.com/auth/loginByGame.do',//登录
- getUserRecordUrl: 'https://test-api-pudding.duowan.com/user/getUserRecord.do',//获取用户信息
- reportUrl: 'http://test-api-pudding.duowan.com/user/report.do',//上报分数
- getAllRankListUrl: 'https://test-api-pudding.duowan.com/user/getAllRankList.do',//获取全服排行榜
- useReviveUrl: 'https://test-api-pudding.duowan.com/user/useRevive.do',//使用复活
- addReviveUrl: 'https://test-api-pudding.duowan.com/user/addRevive.do',//添加复活
- validateUrl: 'https://test-api-pudding.duowan.com/user/validate.do',//校验分数、复活卡
- //SystemInfo
- ver: 100,
- os: 1,
- channel: "wexin",
- //userInfo
- user: null,
- // user = {
- // token:data.token,
- // uid:user.id,
- // openId:user.openId,
- // nick:userInfo.nickName,
- // avatarUrl:userInfo.avatarUrl,
- // gender:userInfo.gender,
- // gold:user.coin,
- // score:user.score,
- // revivedCount:0
- // };
- showLoginPage: true
- };
- wx.onShow(res => {
- wx.checkSession({
- success: function () {
- //session_key 未过期,并且在本生命周期一直有效
- },
- fail: function () {
- // session_key 已经失效,需要重新执行登录流程
- Global.showLoginPage = true;
- cc.director.loadScene("GameScene");
- }
- })
- });
- }
|