41 lines
882 B
TypeScript
41 lines
882 B
TypeScript
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.teaminfo.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();
|
|
}
|
|
}
|