GalleryRankInfosComponent.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.Collections.Generic;
  2. namespace ET
  3. {
  4. public class GalleryRankInfosComponent : Entity, IAwake, IDestroy
  5. {
  6. public SortedList<GalleryRankInfo, long> RankList = new SortedList<GalleryRankInfo, long>(new GalleryRankCompare());
  7. public Dictionary<long, GalleryRankInfo> RankInfoDIc = new Dictionary<long, GalleryRankInfo>();
  8. }
  9. public class GalleryRankCompare : IComparer<GalleryRankInfo>
  10. {
  11. public int Compare(GalleryRankInfo a, GalleryRankInfo b)
  12. {
  13. if(a.IsDisposed || b.IsDisposed)
  14. {
  15. return 0;
  16. }
  17. int result = (int)(b.BelikedCount - a.BelikedCount);
  18. if(result != 0)
  19. {
  20. return result;
  21. }
  22. if(b.BeLikedTime < a.BeLikedTime)
  23. {
  24. return 1;
  25. }
  26. if (b.BeLikedTime > a.BeLikedTime)
  27. {
  28. return -1;
  29. }
  30. if (b.Id < a.Id)
  31. {
  32. return 1;
  33. }
  34. if (b.Id > a.Id)
  35. {
  36. return -1;
  37. }
  38. return 0;
  39. }
  40. }
  41. }