HeroEntityCombatReport.cs 8.4 KB

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