Files
fc/dev/project/library/imports/76/76ef42a6-b19c-4d22-9c4c-1874a7a36e3e.js
2026-05-24 10:21:26 +08:00

100 lines
3.1 KiB
JavaScript

"use strict";
cc._RF.push(module, '76ef4KmsZxNIpxMGHSno24+', 'cmp.arena.loopc.record.item');
// Scripts/mod/pvp/arena/cmp/cmp.arena.loopc.record.item.js
"use strict";
var SVCItem = require("nx.fx.sv.expand.item");
var Header = require("cmp.common.header");
var RoleController = require("role_controller");
var BattleController = require("battle_controller");
/**********
*
* 各不同类型排行列表单个ui数据显示
*/
cc.Class({
"extends": SVCItem,
properties: {
nodOtherHeader: {
"default": null,
type: Header,
displayName: "对战者头像"
},
nodResult: {
"default": null,
type: cc.Node,
displayName: "输赢显示"
},
nodDate: {
"default": null,
type: cc.Node,
displayName: "时间戳"
},
nodResultLog: {
"default": null,
type: cc.Node,
displayName: "输赢标识"
},
nodResultScore: {
"default": null,
type: cc.Node,
displayName: "输赢分数显示"
}
},
// 数据重置
rebind: function rebind(_idx, _data, _key) {
this._super(_idx, _data, _key);
this.freshInfo();
},
// 刷新具体信息
freshInfo: function freshInfo() {
if (!this.mdata) {
return;
}
this.freshHeader();
this.freshContentInfo();
/****{"rid":140,"srv_id":"fx_1","name":"Myuokok","lev":90,"sex":2,
* "face":24406,"avatar_id":0,"power":1107668,"score":0,"type":1,
* "ret":2,"replay_id":2344,"time":1687142042,"face_update_time":0,"face_file":""} */
// console.log( "挑战记录---->>>>" + JSON.stringify( this.mdata ) );
},
freshHeader: function freshHeader() {
var RC = RoleController.getInstance();
if (RC) {
var role = RC.getRoleVo();
nx.gui.setString(this, "my/name", role.name);
}
nx.gui.setString(this.nodOtherHeader, "name", this.mdata.name);
var data = {
face: this.mdata.face
};
this.nodOtherHeader.setData(data);
},
freshContentInfo: function freshContentInfo() {
var path = "";
path = this.mdata.ret == 2 ? cc.path.join("prefab/pvp/ui/lose") : cc.path.join("prefab/pvp/ui/win");
nx.gui.setSpriteFrame(this.nodResult, "", path);
var color = this.mdata.score == 0 ? cc.Color.BLACK : this.mdata.score > 0 ? new cc.Color().fromHEX("#039419") : new cc.Color().fromHEX("#f32f09");
var score = this.mdata.score == 0 ? nx.text.getKey("UnChanged") : this.mdata.score > 0 ? "+" + this.mdata.score : this.mdata.score;
nx.gui.setString(this.nodResultScore, "", score);
nx.gui.setColor(this.nodResultScore, "", color);
var ilog = "";
if (this.mdata.score != 0) {
ilog = this.mdata.score > 0 ? cc.path.join("prefab/pvp/ui/arena_30") : cc.path.join("prefab/pvp/ui/arena_31");
}
nx.gui.setSpriteFrame(this.nodResultLog, "", ilog);
nx.gui.setActive(this.nodResultLog, "", this.mdata.score != 0);
var date = nx.bridge.time.toLocalString(this.mdata.time);
nx.gui.setString(this.nodDate, "", date);
},
onTouchRecord: function onTouchRecord() {
var BC = BattleController.getInstance();
BC.csRecordBattle(this.mdata.replay_id);
nx.bridge.closePanel("WndArenaLoopCWarLog");
}
});
cc._RF.pop();