HeroEntityCombatReport.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. using System;
  2. using System.Collections.Generic;
  3. using Core.BattleReport;
  4. using GameLogic.Combat.CombatTool.CombatReport;
  5. using UnityEngine;
  6. using UnityEngine.UIElements;
  7. using static System.Drawing.FontStyle;
  8. namespace xy002Editor.CombatEditor
  9. {
  10. public class HeroEntityCombatReport : IDisposable
  11. {
  12. // public CombaReportEnditorManager manager;
  13. private CombatReportEntityInfo combatReportEntityInfo;
  14. private Foldout foldout;
  15. private CombaReportEnditorManager combaReportEnditorManager;
  16. public Foldout root;
  17. private ProgressBarShowModle cjShuXing;
  18. private ProgressBarShowModle shangHangXingXi;
  19. private ProgressBarShowModle zhiLiaoModle;
  20. private ProgressBarShowModle beiZhiLiaoModel;
  21. private ProgressBarShowModle shouDaoShangHangXingXi;
  22. private CombatPeportMassgeModle combatPeportMassgeModle;
  23. public Foldout miaoShuFoldout;
  24. public void Init(CombatReportEntityInfo combatReportEntityInfo,
  25. CombaReportEnditorManager combaReportEnditorManager)
  26. {
  27. this.combaReportEnditorManager = combaReportEnditorManager;
  28. this.combatReportEntityInfo = combatReportEntityInfo;
  29. InitUI();
  30. }
  31. private void InitUI()
  32. {
  33. this.foldout = new Foldout();
  34. foldout.text =
  35. $"ID:{combatReportEntityInfo.CombatHeroEntity.CurrCombatHeroInfo.modelID}";
  36. // foldout.style.display = combatNewEditorWindow.heroData.style.display;
  37. // foldout.style.marginLeft;
  38. foldout.style.fontSize = 12;
  39. // foldout.style.unityFontStyleAndWeight = Bold;
  40. foldout.value = false;
  41. if (combatReportEntityInfo.CombatHeroEntity.IsEnemy)
  42. {
  43. root = combaReportEnditorManager.enemyHeroRoot;
  44. }
  45. else
  46. {
  47. root = combaReportEnditorManager.myHeroRoot;
  48. }
  49. root.Add(foldout);
  50. VisualElement visualElement_h = new VisualElement();
  51. // VisualElement visualElement_h =combaReportEnditorManager.Copy<VisualElement>("hengxiang");
  52. foldout.Add(visualElement_h);
  53. VisualElement visualElement_v =
  54. combaReportEnditorManager.Copy<VisualElement>("value_data_entity_style"); //英雄信息
  55. visualElement_h.Add(visualElement_v);
  56. Label label = new Label();
  57. label.text = "玩家名" + combatReportEntityInfo.CombatHeroEntity.CurrCombatHeroInfo.heroName;
  58. visualElement_v.Add(label);
  59. label = new Label();
  60. label.text = "等级" + combatReportEntityInfo.CombatHeroEntity.CurrCombatHeroInfo.level;
  61. visualElement_v.Add(label);
  62. ScrollView ScrollView = combaReportEnditorManager.Copy<ScrollView>("value_scrollview");
  63. foldout.Add(ScrollView);
  64. Foldout foldout1 = combaReportEnditorManager.Copy<Foldout>("foldout_style2");
  65. foldout1.text = "英雄属性";
  66. foldout1.style.unityFontStyleAndWeight = FontStyle.Bold;
  67. foldout1.value = false;
  68. visualElement_h.Add(foldout1);
  69. VisualElement progressVe = combaReportEnditorManager.Copy<VisualElement>("value_data_style2");
  70. foldout1.Add(progressVe);
  71. cjShuXing = new ProgressBarShowModle(progressVe, combaReportEnditorManager);
  72. foldout1 = combaReportEnditorManager.Copy<Foldout>("foldout_style");
  73. foldout1.text = "照成伤害信息";
  74. foldout1.style.unityFontStyleAndWeight = FontStyle.Bold;
  75. foldout1.value = false;
  76. visualElement_h.Add(foldout1);
  77. progressVe = combaReportEnditorManager.Copy<VisualElement>("value_data_style");
  78. foldout1.Add(progressVe);
  79. shangHangXingXi = new ProgressBarShowModle(progressVe, combaReportEnditorManager);
  80. foldout1 = combaReportEnditorManager.Copy<Foldout>("foldout_style");
  81. foldout1.text = "治疗信息";
  82. foldout1.style.unityFontStyleAndWeight = FontStyle.Bold;
  83. foldout1.value = false;
  84. visualElement_h.Add(foldout1);
  85. progressVe = combaReportEnditorManager.Copy<VisualElement>("value_data_style");
  86. foldout1.Add(progressVe);
  87. zhiLiaoModle = new ProgressBarShowModle(progressVe, combaReportEnditorManager);
  88. foldout1 = combaReportEnditorManager.Copy<Foldout>("foldout_style");
  89. foldout1.text = "被治疗信息";
  90. foldout1.style.unityFontStyleAndWeight = FontStyle.Bold;
  91. foldout1.value = false;
  92. visualElement_h.Add(foldout1);
  93. progressVe = combaReportEnditorManager.Copy<VisualElement>("value_data_style");
  94. foldout1.Add(progressVe);
  95. beiZhiLiaoModel = new ProgressBarShowModle(progressVe, combaReportEnditorManager);
  96. foldout1 = combaReportEnditorManager.Copy<Foldout>("foldout_style");
  97. foldout1.text = "受到伤害信息";
  98. foldout1.style.unityFontStyleAndWeight = FontStyle.Bold;
  99. foldout1.value = false;
  100. visualElement_h.Add(foldout1);
  101. progressVe = combaReportEnditorManager.Copy<VisualElement>("value_data_style");
  102. foldout1.Add(progressVe);
  103. shouDaoShangHangXingXi = new ProgressBarShowModle(progressVe, combaReportEnditorManager);
  104. miaoShuFoldout = combaReportEnditorManager.Copy<Foldout>("foldout_style");
  105. miaoShuFoldout.text = "战斗描述";
  106. miaoShuFoldout.style.unityFontStyleAndWeight = FontStyle.Bold;
  107. miaoShuFoldout.value = false;
  108. visualElement_h.Add(miaoShuFoldout);
  109. VisualElement miaoshuve = combaReportEnditorManager.Copy<VisualElement>("miaoshuve"); //英雄信息
  110. miaoShuFoldout.Add(miaoshuve);
  111. combatPeportMassgeModle = new CombatPeportMassgeModle();
  112. combatPeportMassgeModle.Init(miaoshuve, combatReportEntityInfo, combaReportEnditorManager);
  113. }
  114. public void OnGUI()
  115. {
  116. if (!foldout.value)
  117. {
  118. return;
  119. }
  120. DrwaBattleReportValueDataModule(combatReportEntityInfo.HeroInfoModule, cjShuXing);
  121. DrwaBattleReportValueDataModule(combatReportEntityInfo.zhiLiao, zhiLiaoModle,
  122. combatReportEntityInfo.allZhiLiao);
  123. DrwaBattleReportValueDataModule(combatReportEntityInfo.beiZhiLiao, beiZhiLiaoModel,
  124. combatReportEntityInfo.allBeiZhiLiao);
  125. DrwaBattleReportValueDataModule(combatReportEntityInfo.CombatInfoModule, shangHangXingXi,
  126. combatReportEntityInfo.allHarm);
  127. DrwaBattleReportValueDataModule(combatReportEntityInfo.InjuredInfoModule, shouDaoShangHangXingXi,
  128. combatReportEntityInfo.allChengShang);
  129. if (miaoShuFoldout.value)
  130. {
  131. combatPeportMassgeModle.OnGui();
  132. }
  133. }
  134. private void DrwaBattleReportValueDataModule(BattleReportValueDataModule battleReportValueDataModule,
  135. ProgressBarShowModle progressBarShowModle, float maxValue = -1)
  136. {
  137. foreach (var VARIABLE in battleReportValueDataModule.fightValueData_long.Values)
  138. {
  139. ReportFightValueData<long> reportFightValueData = VARIABLE;
  140. float max = reportFightValueData.maxValue;
  141. if (maxValue > 0)
  142. {
  143. max = maxValue;
  144. }
  145. progressBarShowModle.CrendHarmValue(reportFightValueData.name, reportFightValueData.value,
  146. max);
  147. }
  148. }
  149. public void Dispose()
  150. {
  151. combatReportEntityInfo = null;
  152. root.Remove(foldout);
  153. }
  154. }
  155. }