using System.Text; using Core.BattleReport; using GameLogic.Combat.CombatTool.CombatReport; using UnityEngine.UIElements; namespace xy002Editor.CombatEditor { public class CombatPeportMassgeModle { private string sxV = ""; private Label label; private StringBuilder stringBuilder; private CombatReportEntityInfo combatReportEntityInfo; public void Init(VisualElement root, CombatReportEntityInfo combatReportEntityInfo, CombaReportEnditorManager combaReportEnditorManager) { this.combatReportEntityInfo = combatReportEntityInfo; TextField textField = new TextField(); textField.label = "筛选信息"; textField.RegisterValueChangedCallback((e) => { sxV = e.newValue; }); root.Add(textField); ScrollView miaoshu = combaReportEnditorManager.Copy("value_scrollview"); root.Add(miaoshu); label = new Label(); miaoshu.Add(label); stringBuilder = new StringBuilder(); } public void OnGui() { stringBuilder.Clear(); for (int i = 0; i < combatReportEntityInfo.MsgModule.ReportFightMassgeLogDatas.Count; i++) { ReportFightMassgeLogData reportFightMassgeLogData = combatReportEntityInfo.MsgModule.ReportFightMassgeLogDatas[i]; if (!string.IsNullOrEmpty(sxV)) { if (!reportFightMassgeLogData.msg.Contains(sxV)) { continue; } } stringBuilder.Append(reportFightMassgeLogData.time + " " + reportFightMassgeLogData.msg + "\n"); } label.text = stringBuilder.ToString(); } } }