BattleReportValueDataModule.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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)
  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. fightValueData_long[name].maxValue = value;
  26. }
  27. }
  28. public void Add(string name, float value, bool isAdd = false)
  29. {
  30. if (!fightValueData_long.ContainsKey(name))
  31. {
  32. fightValueData_long.Add(name, new ReportFightValueData<float>()
  33. {
  34. name = name,
  35. value = value,
  36. maxValue = value
  37. });
  38. }
  39. else
  40. {
  41. if (isAdd)
  42. {
  43. fightValueData_long[name].value += value;
  44. }
  45. else
  46. {
  47. fightValueData_long[name].value = value;
  48. }
  49. }
  50. }
  51. }
  52. }