修正由于流程更改,导致无法联机游戏的bug
This commit is contained in:
parent
a6ca58881e
commit
8e44bd6fe0
@ -29,7 +29,7 @@
|
|||||||
"list": []
|
"list": []
|
||||||
},
|
},
|
||||||
"miniprogram": {
|
"miniprogram": {
|
||||||
"current": -1,
|
"current": 1,
|
||||||
"list": [
|
"list": [
|
||||||
{
|
{
|
||||||
"id": 0,
|
"id": 0,
|
||||||
@ -46,7 +46,7 @@
|
|||||||
"id": 1,
|
"id": 1,
|
||||||
"name": "分享游戏",
|
"name": "分享游戏",
|
||||||
"pathName": "pages/index",
|
"pathName": "pages/index",
|
||||||
"query": "roomId=5566743627830405120010001&gid=7002058&togame=1",
|
"query": "isShare=1&inviter_id=6001_8004_o5FrX5Xn9xs8wZftyRaWxdEnCar0&roomId=5647651560394598400010002&gid=7002595&togame=1&t=1553770519934",
|
||||||
"scene": 1044,
|
"scene": 1044,
|
||||||
"shareInfo": {
|
"shareInfo": {
|
||||||
"groupName": "测试模拟群0",
|
"groupName": "测试模拟群0",
|
||||||
@ -58,7 +58,7 @@
|
|||||||
"id": 2,
|
"id": 2,
|
||||||
"name": "成就分享",
|
"name": "成就分享",
|
||||||
"pathName": "pages/index",
|
"pathName": "pages/index",
|
||||||
"query": "isShare=1&inviter_id=6001_8004_o5FrX5a3VI5aE7kwgn7Qe7hriJ8Y&shareType=achivement",
|
"query": "isShare=1&inviter_id=6001_8004_o5FrX5Xn9xs8wZftyRaWxdEnCar0&shareType=achivement",
|
||||||
"scene": null
|
"scene": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -50,7 +50,8 @@ export default class extends wepy.app {
|
|||||||
globalData = {
|
globalData = {
|
||||||
userInfo: null,
|
userInfo: null,
|
||||||
gameToken: null,
|
gameToken: null,
|
||||||
vip: false
|
vip: false,
|
||||||
|
jcfwLogined: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
@ -109,11 +110,14 @@ export default class extends wepy.app {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
onLaunch(options) {
|
onLaunch(options) {
|
||||||
|
console.log('app.onLaunch');
|
||||||
|
console.log(options);
|
||||||
sdkManage.init(options);
|
sdkManage.init(options);
|
||||||
sdkManage.Login(() => {
|
sdkManage.Login(() => {
|
||||||
let account = wepy.getStorageSync('account');
|
let account = wepy.getStorageSync('account');
|
||||||
console.log('finish parse jcfw');
|
console.log('finish parse jcfw');
|
||||||
console.log(account);
|
console.log(account);
|
||||||
|
this.globalData.jcfwLogined = true;
|
||||||
jcEvent.emit(jcEvent.events.NEED_UPDATE_CFG, {});
|
jcEvent.emit(jcEvent.events.NEED_UPDATE_CFG, {});
|
||||||
if (this.checkClientLogin()) {
|
if (this.checkClientLogin()) {
|
||||||
this.login();
|
this.login();
|
||||||
@ -157,6 +161,9 @@ export default class extends wepy.app {
|
|||||||
}
|
}
|
||||||
return needAuthorize;
|
return needAuthorize;
|
||||||
}
|
}
|
||||||
|
checkJcfwLogin() {
|
||||||
|
return this.globalData.jcfwLogined;
|
||||||
|
}
|
||||||
checkClientLogin() {
|
checkClientLogin() {
|
||||||
let self = this;
|
let self = this;
|
||||||
let needLogin = true;
|
let needLogin = true;
|
||||||
|
@ -98,6 +98,7 @@
|
|||||||
shareImg = shareObj.image
|
shareImg = shareObj.image
|
||||||
this.$parent.log('onShareAppMessage', {page: 'game', gid: this.gid, shareUrl: url});
|
this.$parent.log('onShareAppMessage', {page: 'game', gid: this.gid, shareUrl: url});
|
||||||
}
|
}
|
||||||
|
console.log('share url: ' + url);
|
||||||
return {
|
return {
|
||||||
title: shareStr,
|
title: shareStr,
|
||||||
path: url,
|
path: url,
|
||||||
|
@ -192,6 +192,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onLoad(options) {
|
async onLoad(options) {
|
||||||
|
console.log('index.onload, is logined: ' + this.$parent.checkJcfwLogin());
|
||||||
|
console.log(options);
|
||||||
this.myGameTitles = [];
|
this.myGameTitles = [];
|
||||||
this.recommendTitles = ['推荐'];
|
this.recommendTitles = ['推荐'];
|
||||||
this.$apply();
|
this.$apply();
|
||||||
@ -201,6 +203,9 @@
|
|||||||
withShareTicket: true
|
withShareTicket: true
|
||||||
});
|
});
|
||||||
this.payVer = global.env === 'product' ? 'release' : 'develop';
|
this.payVer = global.env === 'product' ? 'release' : 'develop';
|
||||||
|
if (this.$parent.checkJcfwLogin()) {
|
||||||
|
this.joinRoomPlay(options);
|
||||||
|
}
|
||||||
if (!this.$parent.checkClientLogin()) {
|
if (!this.$parent.checkClientLogin()) {
|
||||||
this.getAllData();
|
this.getAllData();
|
||||||
this.vip_params = `token=${this.$parent.getGlobalDate('gameToken')}`;
|
this.vip_params = `token=${this.$parent.getGlobalDate('gameToken')}`;
|
||||||
@ -230,6 +235,7 @@
|
|||||||
this.showAll = this.$showAll();
|
this.showAll = this.$showAll();
|
||||||
this.showBuy = !!this.vip_btn_title && this.$showBuy();
|
this.showBuy = !!this.vip_btn_title && this.$showBuy();
|
||||||
this.$apply();
|
this.$apply();
|
||||||
|
this.joinRoomPlay(options);
|
||||||
})
|
})
|
||||||
jcEvent.on(jcEvent.events.BUY_VIP_RESULT, this, data => {
|
jcEvent.on(jcEvent.events.BUY_VIP_RESULT, this, data => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
@ -244,29 +250,7 @@
|
|||||||
this.$parent.log('buy_vip_fail', data);
|
this.$parent.log('buy_vip_fail', data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
/**
|
|
||||||
* 处理加入多人游戏的逻辑
|
|
||||||
* 如果超时5分钟,则直接提示超时
|
|
||||||
* 否则加入房间
|
|
||||||
* */
|
|
||||||
if (options.togame) {
|
|
||||||
let timestamp = options.t;
|
|
||||||
let now = Date.now();
|
|
||||||
if (now - timestamp > 60*1000*5) {
|
|
||||||
this.showTopTips('加入房间失败')
|
|
||||||
this.$parent.log('join_room_fail', {reason: 'timeout'});
|
|
||||||
} else {
|
|
||||||
let cfg = wepy.getStorageSync('cfg');
|
|
||||||
let fcUrl = cfg.fcurl;
|
|
||||||
let roomId = options.roomId;
|
|
||||||
let gid = options.gid;
|
|
||||||
let link = `${fcUrl}?id=${gid}&roomId=${roomId}`;
|
|
||||||
this.$parent.log('join_room_success', {gid,roomId});
|
|
||||||
wepy.navigateTo({
|
|
||||||
url: '/pages/game?link=' + encodeURIComponent(link) + '&gid=' + gid +'&name=multiplayer'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
getAllData() {
|
getAllData() {
|
||||||
this.getRecords();
|
this.getRecords();
|
||||||
@ -283,7 +267,9 @@
|
|||||||
jcEvent.remove(jcEvent.events.NEED_UPDATE_CFG, this);
|
jcEvent.remove(jcEvent.events.NEED_UPDATE_CFG, this);
|
||||||
jcEvent.remove(jcEvent.events.BUY_VIP_RESULT, this);
|
jcEvent.remove(jcEvent.events.BUY_VIP_RESULT, this);
|
||||||
}
|
}
|
||||||
onShow() {
|
onShow(options) {
|
||||||
|
console.log('onshow');
|
||||||
|
console.log(options);
|
||||||
this.$parent.log('index_onshow', {});
|
this.$parent.log('index_onshow', {});
|
||||||
let cfg = wepy.getStorageSync('cfg');
|
let cfg = wepy.getStorageSync('cfg');
|
||||||
if (!cfg._getrewardtype) {
|
if (!cfg._getrewardtype) {
|
||||||
@ -307,6 +293,31 @@
|
|||||||
this.current = 0;
|
this.current = 0;
|
||||||
this.records = [];
|
this.records = [];
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 处理加入多人游戏的逻辑
|
||||||
|
* 如果超时5分钟,则直接提示超时
|
||||||
|
* 否则加入房间
|
||||||
|
* */
|
||||||
|
joinRoomPlay(options) {
|
||||||
|
if (options.togame) {
|
||||||
|
let timestamp = options.t;
|
||||||
|
let now = Date.now();
|
||||||
|
if (now - timestamp > 60*1000*5) {
|
||||||
|
this.showTopTips('加入房间失败')
|
||||||
|
this.$parent.log('join_room_fail', {reason: 'timeout'});
|
||||||
|
} else {
|
||||||
|
let cfg = wepy.getStorageSync('cfg');
|
||||||
|
let fcUrl = cfg.fcurl;
|
||||||
|
let roomId = options.roomId;
|
||||||
|
let gid = options.gid;
|
||||||
|
let link = `${fcUrl}?id=${gid}&roomId=${roomId}`;
|
||||||
|
this.$parent.log('join_room_success', {gid,roomId});
|
||||||
|
wepy.navigateTo({
|
||||||
|
url: '/pages/game?link=' + encodeURIComponent(link) + '&gid=' + gid +'&name=multiplayer&category=fc'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
prepareTopGameBar() {
|
prepareTopGameBar() {
|
||||||
if (this.my_game_list.length > 0 && !this.vip && this.recent_game_list.length > 0) {
|
if (this.my_game_list.length > 0 && !this.vip && this.recent_game_list.length > 0) {
|
||||||
this.myGameRecords = this.my_game_list;
|
this.myGameRecords = this.my_game_list;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user