HeroEntityCombatReport.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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 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. miaoShuFoldout = combaReportEnditorManager.Copy<Foldout>("foldout_style");
  106. miaoShuFoldout.text = "战斗描述";
  107. miaoShuFoldout.style.unityFontStyleAndWeight = FontStyle.Bold;
  108. miaoShuFoldout.value = false;
  109. visualElement_h.Add(miaoShuFoldout);
  110. VisualElement miaoshuve = combaReportEnditorManager.Copy<VisualElement>("miaoshuve"); //英雄信息
  111. miaoShuFoldout.Add(miaoshuve);
  112. combatPeportMassgeModle = new CombatPeportMassgeModle();
  113. combatPeportMassgeModle.Init(miaoshuve, combatReportEntityInfo, combaReportEnditorManager);
  114. }
  115. public void OnGUI()
  116. {
  117. if (!foldout.value)
  118. {
  119. return;
  120. }
  121. DrwaBattleReportValueDataModule(combatReportEntityInfo.HeroInfoModule, cjShuXing);
  122. DrwaBattleReportValueDataModule(combatReportEntityInfo.zhiLiao, zhiLiaoModle,
  123. combatReportEntityInfo.allZhiLiao);
  124. DrwaBattleReportValueDataModule(combatReportEntityInfo.beiZhiLiao, beiZhiLiaoModel,
  125. combatReportEntityInfo.allBeiZhiLiao);
  126. DrwaBattleReportValueDataModule(combatReportEntityInfo.CombatInfoModule, shangHangXingXi,
  127. combatReportEntityInfo.allHarm);
  128. DrwaBattleReportValueDataModule(combatReportEntityInfo.InjuredInfoModule, shouDaoShangHangXingXi,
  129. combatReportEntityInfo.allChengShang);
  130. if (miaoShuFoldout.value)
  131. {
  132. combatPeportMassgeModle.OnGui();
  133. }
  134. }
  135. private void DrwaBattleReportValueDataModule(BattleReportValueDataModule battleReportValueDataModule,
  136. ProgressBarShowModle progressBarShowModle, float maxValue = -1)
  137. {
  138. foreach (var VARIABLE in battleReportValueDataModule.fightValueData_long.Values)
  139. {
  140. ReportFightValueData<float> reportFightValueData = VARIABLE;
  141. float max = reportFightValueData.maxValue;
  142. if (maxValue > 0)
  143. {
  144. max = maxValue;
  145. }
  146. progressBarShowModle.CrendHarmValue(reportFightValueData.name, reportFightValueData.value,
  147. max);
  148. }
  149. }
  150. public void Dispose()
  151. {
  152. combatReportEntityInfo = null;
  153. root.Remove(foldout);
  154. }
  155. }
  156. }
  157. #endif