1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #if UNITY_EDITOR
- 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;
- private int index = 0;
- 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);
-
- Button button = new Button();
- button.text = "上一页";
- button.clicked+= () =>
- {
- index--;
- if (index < 0)
- {
- index = 0;
- }
- };
-
- root.Add(button);
- button = new Button();
- button.text = "下一页";
- button.clicked += () =>
- {
- index++;
- if (index > combatReportEntityInfo.MsgModule.ReportFightMassgeLogDatas.Count / 20)
- {
- index = combatReportEntityInfo.MsgModule.ReportFightMassgeLogDatas.Count / 20 + 1;
- }
- };
- root.Add(button);
- ScrollView miaoshu = combaReportEnditorManager.Copy<ScrollView>("value_scrollview");
- root.Add(miaoshu);
- label = new Label();
- miaoshu.Add(label);
- stringBuilder = new StringBuilder();
- }
- public void OnGui()
- {
- stringBuilder.Clear();
- for (int i = index*20; i < index*20+20; i++)
- {
- if (combatReportEntityInfo.MsgModule.ReportFightMassgeLogDatas.Count <= i)
- {
- break;
- }
- 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();
- }
- }
- }
- #endif
|