239 lines
7.6 KiB
JavaScript
239 lines
7.6 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '4d439psjgdJ9q6nh/VvEIwW', 'cmp.friend.checkinfo');
|
|
// Scripts/mod/friend/cmp/cmp.friend.checkinfo.js
|
|
|
|
"use strict";
|
|
|
|
var PathTool = require("pathtool");
|
|
var FriendConst = require("friend_const");
|
|
var RoleEvent = require("role_event");
|
|
var RoleController = require("role_controller");
|
|
var HeroVo = require("hero_vo");
|
|
var BattleController = require("battle_controller");
|
|
var FriendController = require("friend_controller");
|
|
var ChatController = require("chat_controller");
|
|
var ChatConst = require("chat_const");
|
|
var ChatEvent = require("chat_event");
|
|
var BridgeWindow = require("bridge.window");
|
|
var _require = require("define"),
|
|
SCENE_TAG = _require.SCENE_TAG;
|
|
|
|
//查看好友
|
|
cc.Class({
|
|
"extends": BridgeWindow,
|
|
properties: {
|
|
friend_btn_label: {
|
|
"default": null,
|
|
type: cc.Label
|
|
},
|
|
black_btn_label: {
|
|
"default": null,
|
|
type: cc.Label
|
|
},
|
|
name_lb: {
|
|
"default": null,
|
|
type: cc.Label
|
|
},
|
|
rank_lb: {
|
|
"default": null,
|
|
type: cc.Label
|
|
},
|
|
guild_lb: {
|
|
"default": null,
|
|
type: cc.Label
|
|
},
|
|
vip_label: {
|
|
"default": null,
|
|
type: cc.Label
|
|
},
|
|
fight_label: {
|
|
"default": null,
|
|
type: cc.Label
|
|
},
|
|
scrollCon_content: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
head: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
fabPlayer: {
|
|
"default": null,
|
|
type: cc.Prefab
|
|
},
|
|
nodUID: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
nodSRV: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// LIFE-CYCLE CALLBACKS:
|
|
onLoad: function onLoad() {
|
|
this.ctrl = FriendController.getInstance();
|
|
this.model = this.ctrl.getModel();
|
|
this.item_list = {};
|
|
|
|
//头像
|
|
if (this.player_head == null) {
|
|
this.player_head = cc.instantiate(this.fabPlayer);
|
|
this.player_head.parent = this.head;
|
|
}
|
|
this.bindGEvent(RoleEvent.DISPATCH_PLAYER_VO_EVENT, this.dispatchPlayer.bind(this));
|
|
},
|
|
dispatchPlayer: function dispatchPlayer(data) {
|
|
if (data.rid == this.rid && data.srv_id == this.srv_id) {
|
|
this.updateData(data);
|
|
}
|
|
},
|
|
start: function start() {},
|
|
onDisable: function onDisable() {
|
|
if (nx.bridge.prompt) {
|
|
nx.bridge.prompt.delPrompt(6);
|
|
}
|
|
},
|
|
onPreClosed: function onPreClosed() {},
|
|
onOpenConfigs: function onOpenConfigs(data) {
|
|
if (data == null) return;
|
|
this.rid = data.rid;
|
|
this.srv_id = data.srv_id;
|
|
this.flag = data.flag;
|
|
this.channel = data.channel; //从聊天窗口打开时需要显示@按钮
|
|
if (data && data.rid != null && data.srv_id != null) {
|
|
RoleController.getInstance().requestRoleInfo(data.rid, data.srv_id);
|
|
}
|
|
},
|
|
updateData: function updateData(data) {
|
|
this.data = data;
|
|
this.name_lb.string = Utils.transformNameByServ(data.name, data.srv_id);
|
|
var cmp = this.player_head.getComponent("cmp.common.header");
|
|
cmp.setData(data);
|
|
nx.gui.setString(this.nodUID, "txt", data.rid);
|
|
var sid = data.srv_id.split("_");
|
|
nx.gui.setString(this.nodSRV, "", data.srv_id == "robot" ? "[" + nx.text.format("Srever", 1) + "]" : "[" + nx.text.format("Srever", sid[1]) + "]");
|
|
// this.player_head.setHeadRes(data.face_id);
|
|
// this.player_head.setLev(data.lev);
|
|
|
|
// let RC = RoleController.getInstance();
|
|
// this.role = RC ? RC.getRoleVo() : null;
|
|
// if( !this.role ) {
|
|
// return;
|
|
// }
|
|
|
|
// // 基本信息
|
|
// // UID
|
|
// nx.gui.setString( this.nodUID, "txt", this.role.rid );
|
|
if (data.gname != "") nx.gui.setString(this.guild_lb, "", data.gname);
|
|
|
|
// //头像框
|
|
// var vo = gdata("avatar_data", "data_avatar", [data.avatar_bid]);
|
|
// if (vo) {
|
|
// var res_id = vo.res_id || 0;
|
|
// var res = PathTool.getHeadcircle(res_id);
|
|
// this.plcheckayer_head.setFrameRes(res);
|
|
// }
|
|
|
|
this.vip_label.string = data.vip_lev;
|
|
this.fight_label.string = data.power;
|
|
if (this.model.isFriend(data.srv_id, data.rid)) this.friend_btn_label.string = nx.text.getKey("friend_str14");else this.friend_btn_label.string = nx.text.getKey("friend_str7");
|
|
if (this.model.isBlack(data.rid, data.srv_id)) this.black_btn_label.string = nx.text.getKey("friend_str15");else this.black_btn_label.string = nx.text.getKey("friend_str16");
|
|
this.createPartnerList(data.partner_list);
|
|
},
|
|
createPartnerList: function createPartnerList(list) {
|
|
var temp = [];
|
|
for (var k in list) {
|
|
var v = list[k];
|
|
var vo = new HeroVo();
|
|
vo.updateHeroVo(v);
|
|
temp.push(vo);
|
|
}
|
|
var p_list_size = temp.length;
|
|
// var total_width = p_list_size * 112 + (p_list_size - 1) * 10;
|
|
// var max_width = Math.max(total_width, 725);
|
|
// this.scrollCon_content.setContentSize(cc.size(max_width, 725));
|
|
nx.gui.gocChildren(this.scrollCon_content, "", temp.length);
|
|
var nodes = this.scrollCon_content.children;
|
|
for (var i = 0; i < nodes.length; i++) {
|
|
var node = nodes[i];
|
|
if (temp[i]) {
|
|
var data = nx.dt.objClone(temp[i]);
|
|
var pfg = game.configs.partner_data.data_partner_base[temp[i].bid];
|
|
data.camp_type = pfg.camp_type;
|
|
data.rrid = nx.dt.objClone(this.data.rid);
|
|
data.srv_idd = nx.dt.objClone(this.data.srv_id);
|
|
if (node) {
|
|
var cmp = nx.gui.getComponent(node, "", "cmp.item.base");
|
|
if (cmp) {
|
|
cmp.setData(data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
touchClose: function touchClose() {
|
|
this.ctrl.openFriendCheckPanel(false);
|
|
},
|
|
touchGlory: function touchGlory() {
|
|
this.ctrl.openFriendGloryWindow(true, this.data);
|
|
},
|
|
touchFriend: function touchFriend() {
|
|
if (this.model.isFriend(this.data.srv_id, this.data.rid)) {
|
|
ChatController.getInstance().openChatPanel(ChatConst.Channel.Friend, "friend", this.data);
|
|
this.ctrl.openFriendCheckPanel(false);
|
|
} else {
|
|
this.ctrl.openFriendCheckPanel(false);
|
|
this.ctrl.addOther(this.data.srv_id, this.data.rid);
|
|
}
|
|
},
|
|
touchPk: function touchPk() {
|
|
if (this.data) {
|
|
if (!BattleController.getInstance().getWatchReplayStatus() && !BattleController.getInstance().getModel().getFightStatus()) {
|
|
this.close();
|
|
nx.bridge.closePanel("WndRank");
|
|
nx.bridge.closePanel("WndRankInfo");
|
|
nx.bridge.closePanel("WndFriend");
|
|
nx.bridge.cleanWindowsByTag(SCENE_TAG.popup);
|
|
BattleController.getInstance().csBattlePk(this.data.rid, this.data.srv_id);
|
|
} else {
|
|
nx.tbox(nx.text.getKey("friend_str13"));
|
|
}
|
|
}
|
|
},
|
|
touchBlack: function touchBlack() {
|
|
if (this.model.isBlack(this.data.rid, this.data.srv_id)) {
|
|
ChatController.getInstance().closeChatPanel();
|
|
this.ctrl.openFriendCheckPanel(false);
|
|
nx.bridge.createPanel("WndFriend", {
|
|
type: FriendConst.Type.BlackList
|
|
});
|
|
} else {
|
|
this.ctrl.addToBlackList(this.data.rid, this.data.srv_id);
|
|
this.ctrl.openFriendCheckPanel(false);
|
|
}
|
|
},
|
|
touchReport: function touchReport() {
|
|
if (!this.data) return;
|
|
var role_lv_cfg = game.configs.role_data.data_role_const.role_reported_lev_limit;
|
|
var role_vo = RoleController.getInstance().getRoleVo() || {};
|
|
var lev = role_vo.lev || 0;
|
|
if (role_lv_cfg && lev < role_lv_cfg.val) {
|
|
nx.tbox(role_lv_cfg.val + nx.text.getKey("friend_str17"));
|
|
return;
|
|
}
|
|
var info = {
|
|
rid: this.data.rid,
|
|
srv_id: this.data.srv_id,
|
|
showname: this.data.name
|
|
};
|
|
nx.bridge.createPanel("FriendCheckReport", info);
|
|
},
|
|
touchAtPeople: function touchAtPeople() {
|
|
if (!this.data) return;
|
|
gcore.GlobalEvent.fire(ChatEvent.CHAT_AT_ONCE_PEOPLE, this.data.name, this.data.srv_id, this.data.rid);
|
|
} // update (dt) {},
|
|
});
|
|
|
|
cc._RF.pop(); |