You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.3 KiB
72 lines
2.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using ProtoCSStruct;
|
|
|
|
namespace Game
|
|
{
|
|
public class RankLimitInfo
|
|
{
|
|
public readonly bool sortByLess;
|
|
public long limitScore;
|
|
public RankLimitInfo(bool sortByLess)
|
|
{
|
|
this.sortByLess = sortByLess;
|
|
limitScore = 0;
|
|
}
|
|
}
|
|
|
|
public class KVPair : IComparable
|
|
{
|
|
public readonly int Key;
|
|
public readonly long Value;
|
|
public KVPair(int key, long value)
|
|
{
|
|
Key = key;
|
|
Value = value;
|
|
}
|
|
public int CompareTo(Object obj)
|
|
{
|
|
KVPair other = obj as KVPair;
|
|
return Value.CompareTo(other.Value);
|
|
}
|
|
}
|
|
//Game缓存了一些排行榜相关的消息
|
|
public class GameRankInfo
|
|
{
|
|
//静态数据
|
|
public static Dictionary<int, int> MainlandRankMap; //副本id对应的排行榜id
|
|
public static Dictionary<RaceType, List<KeyValuePair<int,long> > > RaceScoreRankMap; //种族积分对应的排行榜id
|
|
|
|
//成员数据
|
|
public Dictionary<int, bool> m_stopUpdateRank; //停止更新的排行榜
|
|
public Dictionary<int, RankLimitInfo> m_rankLimitInfo; //排行榜限制分数
|
|
public Dictionary<int, bool> m_canAwardRank; //能领奖的排行榜
|
|
|
|
public static void InitRankConfig()
|
|
{
|
|
MainlandRankMap = new Dictionary<int, int>();
|
|
RaceScoreRankMap = new Dictionary<RaceType, List<KeyValuePair<int, long>>>();
|
|
RaceScoreRankMap.Add(RaceType.Ren, new List<KeyValuePair<int, long>>());
|
|
RaceScoreRankMap.Add(RaceType.Shen, new List<KeyValuePair<int, long>>());
|
|
RaceScoreRankMap.Add(RaceType.Yao, new List<KeyValuePair<int, long>>());
|
|
//读配置
|
|
|
|
foreach (var item in RaceScoreRankMap)
|
|
{
|
|
item.Value.Sort((t1, t2) =>
|
|
{
|
|
return t1.Value.CompareTo(t2.Value);
|
|
});
|
|
}
|
|
}
|
|
|
|
public GameRankInfo()
|
|
{
|
|
m_stopUpdateRank = new Dictionary<int, bool>();
|
|
m_rankLimitInfo = new Dictionary<int, RankLimitInfo>();
|
|
m_canAwardRank = new Dictionary<int, bool>();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|