import { _decorator, Component, RichText, Label } from 'cc'; const { ccclass, property } = _decorator; import GeneralCommand from "../../general/GeneralCommand"; import { WarReportRound } from "./MapUIProxy"; @ccclass('WarReportDesItemLogic') export default class WarReportDesItemLogic extends Component { private _curData:WarReportRound = null; @property(RichText) warLab1:RichText = null; @property(RichText) warLab2:RichText = null; @property(Label) roundsLabel:Label = null; protected onLoad():void{ } protected updateItem(data:WarReportRound):void{ console.log("updateItem:", data); this._curData = data; this.roundsLabel.string = "第" + this._curData.round + "轮/" + this._curData.turn+"回合"; var att_cfg = GeneralCommand.getInstance().proxy.getGeneralCfg(this._curData.attack.cfgId); var def_cfg = GeneralCommand.getInstance().proxy.getGeneralCfg(this._curData.defense.cfgId); var title1 = "" var title2 = "" if(data.isAttack){ title1 = "攻"; title2 = "防"; }else{ title2 = "攻"; title1 = "防"; } this.warLab1.string = "" + title1 + att_cfg.name + "" + " 对 " + "" + title2 + def_cfg.name + "" + " 发起攻击," + "" + title2 + def_cfg.name + "" + " 损失 " + "" + this._curData.defenseLoss + "" + " 士兵"; this.warLab2.string = "" + title2 + def_cfg.name + "" + " 对 " + "" + title1 + att_cfg.name + "" + " 发起攻击," + "" + title1 + att_cfg.name + "" + " 损失 " + "" + this._curData.attackLoss + "" + " 士兵"; } }