112 lines
3.1 KiB
JavaScript
112 lines
3.1 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '303b50nAvxNNppYR7WADGzP', 'cmp.arena.loopc.worship.item');
|
||
|
|
// Scripts/mod/pvp/arena/cmp/cmp.arena.loopc.worship.item.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var SVCItem = require("nx.fx.sv.expand.item");
|
||
|
|
var NxSpine = require("nx.fx.spine");
|
||
|
|
var RoleController = require("role_controller");
|
||
|
|
var ChatController = require("chat_controller");
|
||
|
|
cc.Class({
|
||
|
|
"extends": SVCItem,
|
||
|
|
properties: {
|
||
|
|
nodRole: {
|
||
|
|
"default": null,
|
||
|
|
type: NxSpine
|
||
|
|
},
|
||
|
|
nodWorship: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodName: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodPower: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 数据重置
|
||
|
|
rebind: function rebind(_idx, _data, _key) {
|
||
|
|
this._super(_idx, _data, _key);
|
||
|
|
// 刷新
|
||
|
|
this.setData(_data);
|
||
|
|
},
|
||
|
|
setData: function setData(_data) {
|
||
|
|
this.mdata = _data;
|
||
|
|
if (nx.dt.objEmpty(this.mdata) || !this.mdata) {
|
||
|
|
this.setEmpty();
|
||
|
|
} else {
|
||
|
|
this.freshInfo();
|
||
|
|
}
|
||
|
|
},
|
||
|
|
setEmpty: function setEmpty() {
|
||
|
|
nx.gui.setString(this.nodName, "", nx.text.getKey("NoRankInfo"));
|
||
|
|
nx.gui.setActive(this.nodWorship.parent, "", false);
|
||
|
|
nx.gui.setActive(this.nodPower, "", false);
|
||
|
|
},
|
||
|
|
freshInfo: function freshInfo() {
|
||
|
|
var _this = this;
|
||
|
|
var self = this;
|
||
|
|
nx.gui.setString(this.nodName, "", this.mdata.name);
|
||
|
|
nx.gui.setString(this.nodWorship, "", this.mdata.worship);
|
||
|
|
nx.gui.setString(this.nodPower, "txt", nx.text.format("TotalPowerShow", this.mdata.score));
|
||
|
|
nx.gui.setActive(this.nodPower, "", true);
|
||
|
|
var btn = nx.gui.getComponent(this, "worship", cc.Button);
|
||
|
|
if (btn) {
|
||
|
|
btn.interactable = this.mdata.worship_status <= 0;
|
||
|
|
}
|
||
|
|
var ufg = game.configs.looks_data.data_data[this.mdata.lookid];
|
||
|
|
var model = "";
|
||
|
|
if (ufg) {
|
||
|
|
model = PathTool.getSpinePath(ufg.model, ufg.model, false);
|
||
|
|
}
|
||
|
|
nx.gui.setActive(this.nodWorship.parent, "", true);
|
||
|
|
if (this.nodRole) {
|
||
|
|
// 战斗迷你
|
||
|
|
this.nodRole.load(model, function (_e) {
|
||
|
|
if (!_e) {
|
||
|
|
_this.nodRole.action("stand2", true);
|
||
|
|
} else {
|
||
|
|
_this.nodRole.stop();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onTouchWorship: function onTouchWorship() {
|
||
|
|
if (this.mdata.worship_status > 0) {
|
||
|
|
nx.tbox(nx.text.getKey("lab_arena_loop_rank_worshiped"));
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
var RC = RoleController.getInstance();
|
||
|
|
if (RC) {
|
||
|
|
RC.sender10316(this.mdata.rid, this.mdata.srv_id, this.mdata.rank);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onTouchInfo: function onTouchInfo() {
|
||
|
|
//打开玩家信息
|
||
|
|
var roleVo = RoleController.getInstance().getRoleVo();
|
||
|
|
var rid = this.mdata.rid || this.mdata.r_rid;
|
||
|
|
var srv_id = this.mdata.srv_id || this.mdata.r_srvid;
|
||
|
|
if (rid && srv_id && roleVo.rid == rid && roleVo.srv_id == srv_id) {
|
||
|
|
nx.tbox(nx.text.getKey("lab_rank_item_tip_1"));
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
// if( this.mdata.is_robot && this.mdata.is_robot == 1 ) {
|
||
|
|
// nx.tbox( nx.text.getKey( "lab_rank_item_tip_2" ) );
|
||
|
|
// return
|
||
|
|
// }
|
||
|
|
if (this.mdata) {
|
||
|
|
var model = ChatController.getInstance();
|
||
|
|
var vo = {
|
||
|
|
rid: rid,
|
||
|
|
srv_id: srv_id
|
||
|
|
};
|
||
|
|
model.openFriendInfo(vo);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|