update friend
This commit is contained in:
parent
45b63c2d98
commit
2bae3c0846
1354
assets/resources/prefabs/tips/pb_Invite.prefab
Normal file
1354
assets/resources/prefabs/tips/pb_Invite.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
assets/resources/prefabs/tips/pb_Invite.prefab.meta
Normal file
7
assets/resources/prefabs/tips/pb_Invite.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "7ec5284f-dad5-4c1a-969d-0b75c01c3daa",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "pb_wallet",
|
||||
"_name": "pb_Iogout",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
|
@ -1,4 +1,5 @@
|
||||
var Utils = require('Utils');
|
||||
var playerData = require('playerData');
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
@ -42,6 +43,9 @@ cc.Class({
|
||||
},
|
||||
|
||||
init(data) {
|
||||
//
|
||||
this.canInvite = true;
|
||||
//
|
||||
this.playerAccount = data.account_id;
|
||||
|
||||
if (data.name) {
|
||||
@ -140,14 +144,27 @@ cc.Class({
|
||||
},
|
||||
|
||||
onInviteFriend() {
|
||||
console.log('邀请好友');
|
||||
// 发送自定义消息
|
||||
cc.chatMgr.sendmsg('CMSendCustomMsg', {
|
||||
target_list: this.playerAccount,
|
||||
msg: 'InvitePlay',
|
||||
param1: 0,
|
||||
param2: 0,
|
||||
param3: 0,
|
||||
});
|
||||
if (this.canInvite) {
|
||||
this.canInvite = false;
|
||||
console.log('邀请好友');
|
||||
var data = {
|
||||
msg: 'InvitePlay',
|
||||
player: playerData.name,
|
||||
data: JSON.parse(this.tmpData),
|
||||
};
|
||||
// 发送自定义消息
|
||||
cc.chatMgr.sendmsg('CMSendCustomMsg', {
|
||||
target_list: this.playerAccount,
|
||||
msg: JSON.stringify(data),
|
||||
param1: 0,
|
||||
param2: 0,
|
||||
param3: 0,
|
||||
});
|
||||
} else {
|
||||
cc.uiHelper.showTips('Already invited, try again later');
|
||||
setTimeout(() => {
|
||||
this.canInvite = true;
|
||||
}, 15000);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -10,6 +10,7 @@ const { GuestLoginTip } = require('../tips/GuestLoginTip');
|
||||
const { LogoutTip } = require('../tips/LogoutTip');
|
||||
const { operation, OperationType } = require('../Operation/Operation');
|
||||
const jcgamelog = require('../jcfw/service/jcgamelog');
|
||||
const { InviteTip } = require('../tips/InviteTip');
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
@ -231,7 +232,11 @@ cc.Class({
|
||||
},
|
||||
|
||||
getCustomMsg(msg) {
|
||||
console.log('custom msg:' + msg);
|
||||
// 只有不在游戏中的时候出现
|
||||
console.log('get once ');
|
||||
if (!cc.find('Canvas').getComponentInChildren('GameUI')) {
|
||||
uimanger.showUI(InviteTip.prefabPath, msg);
|
||||
}
|
||||
},
|
||||
|
||||
getwalletEvent() {
|
||||
|
@ -204,6 +204,7 @@ cc.Class({
|
||||
cc.uiMain.callChat();
|
||||
},
|
||||
updateteaminfo(v) {
|
||||
this.inviteTeamInfo = v;
|
||||
if (v.errcode == 0) {
|
||||
var info = v.team_info;
|
||||
this.btn_start.active =
|
||||
@ -269,7 +270,7 @@ cc.Class({
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.friend_list.length; i += 1) {
|
||||
this.initOne(this.friend_list[i].base_data, this.friend_list[i]);
|
||||
this.initOne(this.friend_list[i].base_data, this.inviteTeamInfo);
|
||||
}
|
||||
},
|
||||
|
||||
|
41
assets/scripts/tips/InviteTip.ts
Normal file
41
assets/scripts/tips/InviteTip.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { UIBase } from '../UI/UIBase';
|
||||
var playerData = require('playerData');
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export class InviteTip extends UIBase {
|
||||
public static prefabPath = 'prefabs/tips/pb_Invite';
|
||||
@property(cc.Label) namelabel: cc.Label = null;
|
||||
|
||||
private inviteData = '';
|
||||
private m_roomID = '';
|
||||
|
||||
init(data: any) {
|
||||
this.inviteData = data.msg;
|
||||
var tmp = JSON.parse(this.inviteData);
|
||||
this.namelabel.string = tmp.player.toString();
|
||||
this.m_roomID = tmp.data.team_info.team_uuid;
|
||||
}
|
||||
|
||||
start() {
|
||||
setTimeout(() => {
|
||||
if (this.node) this.node.destroy();
|
||||
}, 15000);
|
||||
}
|
||||
|
||||
onClickOK() {
|
||||
if (playerData.teamuuid) {
|
||||
cc.uiHelper.showTips('Please leave the current team first');
|
||||
return;
|
||||
}
|
||||
if (this.m_roomID) {
|
||||
cc.Notifier.emit('joinTeamRoom', '' + this.m_roomID);
|
||||
}
|
||||
this.node.destroy();
|
||||
// 加入队伍
|
||||
}
|
||||
|
||||
onClose() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
9
assets/scripts/tips/InviteTip.ts.meta
Normal file
9
assets/scripts/tips/InviteTip.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "307017d8-17c4-4371-860e-7e4224758a72",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user