HeroEntityCombatReport.cs 8.3 KB

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