CombatPeportMassgeModle.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System.Text;
  2. using Core.BattleReport;
  3. using GameLogic.Combat.CombatTool.CombatReport;
  4. using UnityEngine.UIElements;
  5. namespace xy002Editor.CombatEditor
  6. {
  7. public class CombatPeportMassgeModle
  8. {
  9. private string sxV = "";
  10. private Label label;
  11. private StringBuilder stringBuilder;
  12. private CombatReportEntityInfo combatReportEntityInfo;
  13. public void Init(VisualElement root, CombatReportEntityInfo combatReportEntityInfo,
  14. CombaReportEnditorManager combaReportEnditorManager)
  15. {
  16. this.combatReportEntityInfo = combatReportEntityInfo;
  17. TextField textField = new TextField();
  18. textField.label = "筛选信息";
  19. textField.RegisterValueChangedCallback((e) => { sxV = e.newValue; });
  20. root.Add(textField);
  21. ScrollView miaoshu = combaReportEnditorManager.Copy<ScrollView>("value_scrollview");
  22. root.Add(miaoshu);
  23. label = new Label();
  24. miaoshu.Add(label);
  25. stringBuilder = new StringBuilder();
  26. }
  27. public void OnGui()
  28. {
  29. stringBuilder.Clear();
  30. for (int i = 0; i < combatReportEntityInfo.MsgModule.ReportFightMassgeLogDatas.Count; i++)
  31. {
  32. ReportFightMassgeLogData reportFightMassgeLogData =
  33. combatReportEntityInfo.MsgModule.ReportFightMassgeLogDatas[i];
  34. if (!string.IsNullOrEmpty(sxV))
  35. {
  36. if (!reportFightMassgeLogData.msg.Contains(sxV))
  37. {
  38. continue;
  39. }
  40. }
  41. stringBuilder.Append(reportFightMassgeLogData.time + " " + reportFightMassgeLogData.msg + "\n");
  42. }
  43. label.text = stringBuilder.ToString();
  44. }
  45. }
  46. }