| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System.Collections.Generic;
- namespace ET
- {
- public class OpenRoleInfosRankComponent : Entity, IAwake, IDestroy
- {
- //通过角色id存储
- public Dictionary<long, OpenRoleRankInfo> OpenRolesDic = new Dictionary<long, OpenRoleRankInfo>();
- //有序列表
- public SortedList<OpenRoleRankInfo, long> RankList = new SortedList<OpenRoleRankInfo, long>(new OpenRoleRankInfoCompare());
- }
- public class OpenRoleRankInfoCompare : IComparer<OpenRoleRankInfo>
- {
- public int Compare(OpenRoleRankInfo a, OpenRoleRankInfo b)
- {
- if(a.IsDisposed || b.IsDisposed)
- {
- return 0;
- }
- int result = (int)(b.OfflineTimeSec - a.OfflineTimeSec);
- if (result != 0)
- {
- return result;
- }
- result = b.RoleLvl - a.RoleLvl;
- if (result != 0)
- {
- return result;
- }
- if (b.Id > a.Id)
- {
- return -1;
- }
- if (b.Id < a.Id)
- {
- result = 1;
- }
- return 0;
- }
- }
- }
|