RoleInfoManager.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. private List<long> _photoDatas = new List<long>() { 0, 0, 0, 0 };
  28. public List<long> photoDatas
  29. {
  30. get
  31. {
  32. return _photoDatas;
  33. }
  34. set
  35. {
  36. _photoDatas = value;
  37. }
  38. }
  39. public void Clear()
  40. {
  41. _headDatas.Clear();
  42. _headBorderDatas.Clear();
  43. }
  44. public void Add(int itemId)
  45. {
  46. ItemCfg cfg = ItemCfgArray.Instance.GetCfg(itemId);
  47. if (cfg.subType == 0)
  48. {
  49. if (_headDatas.IndexOf(itemId) < 0) _headDatas.Add(itemId);
  50. }
  51. else if (cfg.subType == 1)
  52. {
  53. if (_headBorderDatas.IndexOf(itemId) < 0) _headBorderDatas.Add(itemId);
  54. }
  55. }
  56. public void Remove(int itemId)
  57. {
  58. ItemCfg cfg = ItemCfgArray.Instance.GetCfg(itemId);
  59. if (cfg.subType == 0)
  60. {
  61. if (_headDatas.IndexOf(itemId) >= 0) _headDatas.Remove(itemId);
  62. }
  63. else if (cfg.subType == 1)
  64. {
  65. if (_headBorderDatas.IndexOf(itemId) >= 0) _headBorderDatas.Remove(itemId);
  66. }
  67. }
  68. private void SortHeadDatas()
  69. {
  70. _headDatas.Sort((int a, int b) =>
  71. {
  72. return b - a;
  73. });
  74. }
  75. private void SortHeadBorderDatas()
  76. {
  77. _headBorderDatas.Sort((int a, int b) =>
  78. {
  79. return b - a;
  80. });
  81. }
  82. public decimal GetGuideProgress()
  83. {
  84. int suitHaveCount = 0;
  85. int suitTotalCount = 1;
  86. DressUpMenuSuitDataManager.GetTotalProgress(out suitHaveCount, out suitTotalCount);
  87. int chapterItemHaveCount = 0;
  88. int chapterItemTotalCount = 1;
  89. InstanceZonesDataManager.GetTotalProgress(out chapterItemHaveCount, out chapterItemTotalCount);
  90. int travelHaveCount = 0;
  91. int travelTotalCount = 1;
  92. TravelDataManager.Instance.GetTotalTravelProgress(out travelHaveCount, out travelTotalCount);
  93. int haveCount = suitHaveCount + chapterItemHaveCount + travelHaveCount;
  94. int totalCount = suitTotalCount + chapterItemTotalCount + travelTotalCount;
  95. decimal value = Math.Floor((decimal)100 * haveCount / totalCount);
  96. return value;
  97. }
  98. }
  99. }