"use strict"; cc._RF.push(module, '8ab34xEyJdKrbTyILESKPZh', 'cmp.servers.role.item'); // Scripts/mod/login/cmp/cmp.servers.role.item.js "use strict"; /****************************************************************** * * 服务器角色项 * ******************************************************************/ var SvcItem = require("nx.fx.sv.expand.item"); var LoginMod = require("login.mod"); cc.Class({ "extends": SvcItem, properties: { nodServer: { "default": null, type: cc.Node }, nodAvatar: { "default": null, type: cc.Node } }, // 数据重置 rebind: function rebind(_idx, _data, _key) { this._super(_idx, _data, _key); // 刷新 this.fresh(); }, // 刷新 fresh: function fresh() { var data = this.mdata || {}; if (nx.dt.objEmpty(data)) { return; } // 服务器 if (this.nodServer) { // 状态图标 var st = "state_3"; var infos = LoginMod.getInstance().queryServer(data.srv_id); if (infos && !infos.is_close) { st = infos.is_new ? "state_0" : "state_1"; } var icon = cc.path.join("prefab/login/images", st); nx.gui.setSpriteFrame(this.nodServer, "status", icon); // 名字 var sname = ""; if (infos) { sname = nx.text.format("Zoom", infos.zone_id) + nx.text.getKey(infos.srv_name); } nx.gui.setString(this.nodServer, "name", sname); } // 角色信息 if (this.nodAvatar) { nx.bridge.setIcon(this.nodAvatar, "img", data.face_id); nx.gui.setString(this.nodAvatar, "level", "Lv." + data.lev); nx.gui.setString(this, "name", data.name); } } }); cc._RF.pop();