RoleInfoManager.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using FairyGUI;
  2. using ET;
  3. using System.Collections.Generic;
  4. using System;
  5. namespace GFGGame
  6. {
  7. public class RoleInfoManager : SingletonBase<RoleInfoManager>
  8. {
  9. private List<int> _headDatas = new List<int>() { 5000001, 5000002, 5000003 };
  10. public List<int> headDatas
  11. {
  12. get
  13. {
  14. SortHeadDatas();
  15. return _headDatas;
  16. }
  17. }
  18. private List<int> _headBorderDatas = new List<int>() { 5005001, 5005002, 5005003, 5005001, 5005002, 5005003, 5005001, 5005002, 5005003, 5005001, 5005002, 5005003 };
  19. public List<int> headBorderDatas
  20. {
  21. get
  22. {
  23. SortHeadBorderDatas();
  24. return _headBorderDatas;
  25. }
  26. }
  27. public void Clear()
  28. {
  29. _headDatas.Clear();
  30. _headBorderDatas.Clear();
  31. }
  32. public void Add(int itemId)
  33. {
  34. ItemCfg cfg = ItemCfgArray.Instance.GetCfg(itemId);
  35. if (cfg.subType == 0)
  36. {
  37. if (_headDatas.IndexOf(itemId) < 0) _headDatas.Add(itemId);
  38. }
  39. else if (cfg.subType == 1)
  40. {
  41. if (_headBorderDatas.IndexOf(itemId) < 0) _headBorderDatas.Add(itemId);
  42. }
  43. }
  44. public void Remove(int itemId)
  45. {
  46. ItemCfg cfg = ItemCfgArray.Instance.GetCfg(itemId);
  47. if (cfg.subType == 0)
  48. {
  49. if (_headDatas.IndexOf(itemId) >= 0) _headDatas.Remove(itemId);
  50. }
  51. else if (cfg.subType == 1)
  52. {
  53. if (_headBorderDatas.IndexOf(itemId) >= 0) _headBorderDatas.Remove(itemId);
  54. }
  55. }
  56. private void SortHeadDatas()
  57. {
  58. _headDatas.Sort((int a, int b) =>
  59. {
  60. return b - a;
  61. });
  62. }
  63. private void SortHeadBorderDatas()
  64. {
  65. _headBorderDatas.Sort((int a, int b) =>
  66. {
  67. return b - a;
  68. });
  69. }
  70. public decimal GetGuideProgress()
  71. {
  72. int suitHaveCount = 0;
  73. int suitTotalCount = 1;
  74. DressUpMenuSuitDataManager.GetTotalProgress(out suitHaveCount, out suitTotalCount);
  75. int chapterItemHaveCount = 0;
  76. int chapterItemTotalCount = 1;
  77. InstanceZonesDataManager.GetTotalProgress(out chapterItemHaveCount, out chapterItemTotalCount);
  78. int travelHaveCount = 0;
  79. int travelTotalCount = 1;
  80. TravelDataManager.Instance.GetTotalTravelProgress(out travelHaveCount, out travelTotalCount);
  81. int haveCount = suitHaveCount + chapterItemHaveCount + travelHaveCount;
  82. int totalCount = suitTotalCount + chapterItemTotalCount + travelTotalCount;
  83. decimal value = Math.Floor((decimal)100 * haveCount / totalCount);
  84. return value;
  85. }
  86. }
  87. }