|
@@ -182,8 +182,8 @@ cc.Class({
|
|
|
|
|
|
let seq = 1;
|
|
let seq = 1;
|
|
|
|
|
|
- if(CC_WECHATGAME) {
|
|
|
|
- if(this.ws.readyState == 'closed') {
|
|
|
|
|
|
+ if (CC_WECHATGAME) {
|
|
|
|
+ if (this.ws.readyState == 'closed') {
|
|
this.ws.reconnect()
|
|
this.ws.reconnect()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -223,9 +223,13 @@ cc.Class({
|
|
let u8Arr = new Uint8Array(data)
|
|
let u8Arr = new Uint8Array(data)
|
|
let decodeMsg = Message.decode(u8Arr);
|
|
let decodeMsg = Message.decode(u8Arr);
|
|
console.log("[Response msg type]: ", decodeMsg.type);
|
|
console.log("[Response msg type]: ", decodeMsg.type);
|
|
-
|
|
|
|
|
|
+
|
|
console.log("[Response text msg]: ", decodeMsg);
|
|
console.log("[Response text msg]: ", decodeMsg);
|
|
|
|
|
|
|
|
+ if (decodeMsg.type == 0) {
|
|
|
|
+ this.toastNotification(decodeMsg.msg);//成为我的老板,我的艺人,我的好友主界面toast提醒。
|
|
|
|
+ }
|
|
|
|
+
|
|
if (decodeMsg.notificationMessage) {
|
|
if (decodeMsg.notificationMessage) {
|
|
switch (decodeMsg.notificationMessage.nType) {
|
|
switch (decodeMsg.notificationMessage.nType) {
|
|
case 1:
|
|
case 1:
|
|
@@ -255,7 +259,7 @@ cc.Class({
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if(decodeMsg.buildingItems) {
|
|
|
|
|
|
+ if (decodeMsg.buildingItems) {
|
|
console.log(decodeMsg.buildingItems);
|
|
console.log(decodeMsg.buildingItems);
|
|
GameEvent.fire(GameNotificationKey.ReceiveLevelHomeItemPropUpdate, decodeMsg.buildingItems);
|
|
GameEvent.fire(GameNotificationKey.ReceiveLevelHomeItemPropUpdate, decodeMsg.buildingItems);
|
|
}
|
|
}
|
|
@@ -784,13 +788,38 @@ cc.Class({
|
|
});
|
|
});
|
|
} else if (Global.shareType == ShareAction.BECOME_ARTIST) {
|
|
} else if (Global.shareType == ShareAction.BECOME_ARTIST) {
|
|
let shareUid = Global.shareUid
|
|
let shareUid = Global.shareUid
|
|
- FriendSystemApi.becomeArtist(shareUid, () => {
|
|
|
|
- GameEvent.fire('refresh_friend_list');
|
|
|
|
|
|
+ // FriendSystemApi.becomeArtist(shareUid, () => {
|
|
|
|
+ // GameEvent.fire('refresh_friend_list');
|
|
|
|
+
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
+ // GameEvent.fire(GameNotificationKey.NoticeRoleOpt, shareUid, 11);
|
|
|
|
+ // }, 2500)
|
|
|
|
+ // });
|
|
|
|
+ FriendSystemApi.becomeArtistPromise(shareUid)
|
|
|
|
+ .then(({ code, data }) => {
|
|
|
|
+ console.log('becomeArtist: ', code);
|
|
|
|
+ switch (code) {
|
|
|
|
+ case 816://成为好友
|
|
|
|
+ GameEvent.fire('refresh_friend_list');
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ GameEvent.fire(GameNotificationKey.NoticeRoleOpt, shareUid, 10);
|
|
|
|
+ }, 2500);
|
|
|
|
+ break;
|
|
|
|
+ case 817: // 成为对方艺人
|
|
|
|
+ GameEvent.fire('refresh_friend_list');
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ GameEvent.fire(GameNotificationKey.NoticeRoleOpt, shareUid, 11);
|
|
|
|
+ }, 2500);
|
|
|
|
+ break;
|
|
|
|
+ case 0: //正常
|
|
|
|
+ break;
|
|
|
|
+ case 4002://异常
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
- GameEvent.fire(GameNotificationKey.NoticeRoleOpt, shareUid, 10);
|
|
|
|
- }, 2500)
|
|
|
|
- });
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
Global.shareUid = -1;
|
|
Global.shareUid = -1;
|
|
Global.shareType = ShareAction.None;
|
|
Global.shareType = ShareAction.None;
|
|
@@ -813,10 +842,14 @@ cc.Class({
|
|
},
|
|
},
|
|
|
|
|
|
toastNotification(message) {
|
|
toastNotification(message) {
|
|
- this.toastScript.show(message);
|
|
|
|
|
|
+ if (this.node.active) {
|
|
|
|
+ this.toastScript.show(message);
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
|
|
showLevelHomeSpeedUpTips(name, type) {
|
|
showLevelHomeSpeedUpTips(name, type) {
|
|
- this.levelHomeSpeedUpTips.show(name, type);
|
|
|
|
|
|
+ if (this.node.active) {
|
|
|
|
+ this.levelHomeSpeedUpTips.show(name, type);
|
|
|
|
+ }
|
|
},
|
|
},
|
|
});
|
|
});
|