BattleReportValueDataModule.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System.Collections.Generic;
  2. namespace Core.BattleReport
  3. {
  4. /// <summary>
  5. /// 战斗value数据模块
  6. /// </summary>
  7. public class BattleReportValueDataModule
  8. {
  9. public string name;
  10. public Dictionary<string, ReportFightValueData<float>> fightValueData_long =
  11. new Dictionary<string, ReportFightValueData<float>>();
  12. public void SetMax(string name, float value, bool isAdd = false)
  13. {
  14. if (!fightValueData_long.ContainsKey(name))
  15. {
  16. fightValueData_long.Add(name, new ReportFightValueData<float>()
  17. {
  18. name = name,
  19. value = 0,
  20. maxValue = value
  21. });
  22. }
  23. else
  24. {
  25. if (isAdd)
  26. {
  27. fightValueData_long[name].maxValue += value;
  28. }
  29. else
  30. {
  31. fightValueData_long[name].maxValue = value;
  32. }
  33. }
  34. }
  35. public void Add(string name, float value, bool isAdd = false)
  36. {
  37. if (!fightValueData_long.ContainsKey(name))
  38. {
  39. fightValueData_long.Add(name, new ReportFightValueData<float>()
  40. {
  41. name = name,
  42. value = value,
  43. maxValue = value
  44. });
  45. }
  46. else
  47. {
  48. if (isAdd)
  49. {
  50. fightValueData_long[name].value += value;
  51. }
  52. else
  53. {
  54. fightValueData_long[name].value = value;
  55. }
  56. }
  57. }
  58. }
  59. }