RoleInfoManager.cs 3.0 KB

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