import NetManage from "../manages/NetManage"; var Utils = require('Utils'); const { UIBase } = require("../UI/UIBase"); cc.Class({ extends: UIBase, properties: { headIcon:{ default:null, type:cc.Sprite }, playName:{ default:null, type:cc.Label }, totalKill:{ default:null, type:cc.Label }, totalGame:{ default:null, type:cc.Label }, totalWin:{ default:null, type:cc.Label }, WinRate:{ default:null, type:cc.Label }, MostKill:{ default:null, type:cc.Label }, AverageKill:{ default:null, type:cc.Label }, MostDMG:{ default:null, type:cc.Label }, AverageDMG:{ default:null, type:cc.Label }, }, init(data){ // data : user account --> get user info according to user account NetManage.getUeserInfo(data,(res)=>{ this.account_id = data; this.playerData = res; this.playName.string = this.playerData.info.name; Utils.setitem(this,this.playerData.info.head_id,this.headIcon); // this.totalKill.string = this.playerData.info.history_seasons[0].total_kills; this.totalGame.string = this.playerData.info.history_seasons[0].game_times; this.totalWin.string = this.playerData.info.history_seasons[0].win_times; this.WinRate.string = `${this.playerData.info.history_seasons[0].win_rate}%`; // this.MostKill.string = this.playerData.info.history_seasons[0].max_kills; this.AverageKill.string = this.playerData.info.history_seasons[0].avg_kills; this.MostDMG.string = this.playerData.info.history_seasons[0].max_damage_out; this.AverageDMG.string = this.playerData.info.history_seasons[0].avg_damage_out; // }) }, start () { }, onClose(){ this.node.destroy() }, onClickAddFriend(){ cc.uiHelper.showTips("Send friend request!"); cc.chatMgr.sendmsg('CMFriendApply', { friend_id: this.account_id, msg: '', }); }, onClickAddBlackList(){ cc.uiHelper.showTips("Add to blacklist"); cc.chatMgr.sendmsg('CMFriendDeleteBlack', { account_id: this.account_id, }); }, }); export var playerInfoUI = "prefabs/tips/playerinfo"