using System.Collections.Generic;
using MongoDB.Bson.Serialization.Attributes;
namespace ET
{
///
/// 关卡排行榜组件
///
public class LevelRankInfo : Entity, IAwake, IDestroy
{
//关卡id
public int LevelId;
///
/// 关卡排行榜
///
[BsonIgnore] public SortedList SortedLevelRankInfoList;
}
public class LevelRankInfoCompare : IComparer
{
private int _levelId;
public LevelRankInfoCompare(int levelId)
{
_levelId = levelId;
}
public int Compare(LevelRankRoleInfo a, LevelRankRoleInfo b)
{
if (a.IsDisposed || b.IsDisposed)
{
return 0;
}
a.LevelScoreDic.TryGetValue(_levelId, out long aVal);
b.LevelScoreDic.TryGetValue(_levelId, out long bVal);
if (bVal > aVal)
{
return 1;
}
if (bVal < aVal)
{
return -1;
}
if (b.Id > a.Id)
{
return -1;
}
if (b.Id < a.Id)
{
return 1;
}
return 0;
}
}
}