GalleryRankByRecommendCountComponent.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Collections.Generic;
  2. namespace ET
  3. {
  4. public class GalleryRankByRecommendCountComponent : Entity, IAwake, IDestroy
  5. {
  6. public Dictionary<long, GalleryRankInfoByRecommendCount> RankInfoDIc = new Dictionary<long, GalleryRankInfoByRecommendCount>();
  7. public SortedList<GalleryRankInfoByRecommendCount, long> RankList = new SortedList<GalleryRankInfoByRecommendCount, long>(new GalleryRankByRecommendCountCompare());
  8. }
  9. public class GalleryRankByRecommendCountCompare : IComparer<GalleryRankInfoByRecommendCount>
  10. {
  11. public int Compare(GalleryRankInfoByRecommendCount a, GalleryRankInfoByRecommendCount b)
  12. {
  13. if (a.IsDisposed || b.IsDisposed)
  14. {
  15. return 0;
  16. }
  17. int result = (int)(a.BeRecommendCount - b.BeRecommendCount);
  18. if (result != 0)
  19. {
  20. return result;
  21. }
  22. if (b.Id > a.Id)
  23. {
  24. return 1;
  25. }
  26. if (b.Id < a.Id)
  27. {
  28. return -1;
  29. }
  30. return 0;
  31. }
  32. }
  33. }