GalleryRankByCreateTimeComponent.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections.Generic;
  2. namespace ET
  3. {
  4. public class GalleryRankByCreateTimeComponent : Entity, IAwake, IDestroy
  5. {
  6. public Dictionary<long, GalleryRankInfoByCreateTime> RankInfoDIc = new Dictionary<long, GalleryRankInfoByCreateTime>();
  7. public SortedList<GalleryRankInfoByCreateTime, long> RankList = new SortedList<GalleryRankInfoByCreateTime, long>(new GalleryRankByCreateTimeCompare());
  8. }
  9. public class GalleryRankByCreateTimeCompare : IComparer<GalleryRankInfoByCreateTime>
  10. {
  11. public int Compare(GalleryRankInfoByCreateTime a, GalleryRankInfoByCreateTime b)
  12. {
  13. if (a.IsDisposed || b.IsDisposed)
  14. {
  15. return 0;
  16. }
  17. int result = (int)(b.CreateTime - a.CreateTime);
  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. }