129 lines
3.3 KiB
JavaScript
129 lines
3.3 KiB
JavaScript
var gameConfig = require("gameConfig")
|
||
var playerData = require("playerData")
|
||
var SDKManage = require("SDKManage")
|
||
var NetManage = require("NetManage")
|
||
var Main = require("Main");
|
||
cc.Class({
|
||
extends: cc.Component,
|
||
|
||
properties: {
|
||
|
||
lb_map: {
|
||
default: null,
|
||
type: cc.Label
|
||
},
|
||
|
||
lb_team: {
|
||
default: null,
|
||
type: cc.Label
|
||
},
|
||
|
||
nd_worldgou: {
|
||
default: null,
|
||
type: cc.Node,
|
||
},
|
||
|
||
nd_guildgou: {
|
||
default: null,
|
||
type: cc.Node,
|
||
},
|
||
|
||
nd_guild: {
|
||
default: null,
|
||
type: cc.Node,
|
||
},
|
||
},
|
||
|
||
// LIFE-CYCLE CALLBACKS:
|
||
|
||
// onLoad () {},
|
||
onLoad() {
|
||
|
||
},
|
||
onDestroy() {
|
||
//cc.Notifier.off('getdoublereward', this);
|
||
},
|
||
|
||
start() {
|
||
|
||
},
|
||
|
||
showInviteInfo(map_name, team_length) {
|
||
this.lb_map.string = cc.language.stringformat("ditu")+":" + map_name
|
||
this.lb_team.string = cc.language.stringformat("duiwu") + team_length + '/4'
|
||
this.team_length = team_length
|
||
this.map_name = map_name
|
||
this.nd_worldgou.active = true
|
||
this.nd_guildgou.active = false
|
||
this.nd_guild.active = false
|
||
if (playerData.guild_id != '0') {
|
||
this.nd_guildgou.active = true
|
||
this.nd_guild.active = true
|
||
}
|
||
},
|
||
|
||
onBtnWorld() {
|
||
if (this.nd_worldgou.active) {
|
||
this.nd_worldgou.active = false
|
||
} else {
|
||
this.nd_worldgou.active = true
|
||
}
|
||
},
|
||
|
||
onBtnGuild() {
|
||
if (playerData.guild_id != '0') {
|
||
if (this.nd_guildgou.active) {
|
||
this.nd_guildgou.active = false
|
||
} else {
|
||
this.nd_guildgou.active = true
|
||
}
|
||
}
|
||
},
|
||
|
||
showTipNotSend(time) {
|
||
var tempstr = cc.language.stringformat("shuohuataikuai",[ Math.ceil(time) ])
|
||
cc.uiHelper.showTips(tempstr)
|
||
},
|
||
|
||
onBtnSend() {
|
||
if (!playerData.canTeamInviteMsg) {
|
||
this.showTipNotSend(playerData.chatTeamInvitetime)
|
||
return
|
||
}
|
||
if (!this.nd_guildgou.active && !this.nd_worldgou.active) {
|
||
cc.uiHelper.showTips(cc.language.stringformat("xuanzepindao"))
|
||
return
|
||
}
|
||
var text = cc.language.stringformat("kuaishangche") + this.map_name + '(' + this.team_length + '/4)'
|
||
var battleobj = {
|
||
tp: 1,
|
||
text: text,
|
||
roomid: playerData.teamuuid,
|
||
}
|
||
if (this.nd_worldgou.active) {
|
||
cc.chatMgr.sendmsg('CMSendChatMsg', {
|
||
chat_channel: 1,
|
||
target: '',
|
||
msg_type: 1,
|
||
msg_body: JSON.stringify(battleobj),
|
||
})
|
||
}
|
||
if (this.nd_guildgou.active) {
|
||
cc.chatMgr.sendmsg('CMSendChatMsg', {
|
||
chat_channel: 3,
|
||
target: '',
|
||
msg_type: 1,
|
||
msg_body: JSON.stringify(battleobj),
|
||
})
|
||
}
|
||
playerData.chatTeamInvitetime = 60
|
||
playerData.canTeamInviteMsg = false
|
||
cc.uiHelper.showTips(cc.language.stringformat("sendsuccess"))
|
||
this.close()
|
||
},
|
||
|
||
close() {
|
||
this.node.destroy()
|
||
},
|
||
|
||
}); |