|
@@ -75,8 +75,6 @@ namespace ET.Server
|
|
|
list.Sort((r1, r2) => r2.TotalDamage.CompareTo(r1.TotalDamage));
|
|
|
}
|
|
|
|
|
|
- self.ViewRankList.Clear();
|
|
|
-
|
|
|
int ranking = 1;
|
|
|
|
|
|
List<RankInfo> infoListProto = new List<RankInfo>();
|
|
@@ -86,25 +84,44 @@ namespace ET.Server
|
|
|
// 客户端消息
|
|
|
RankInfo info = new RankInfo();
|
|
|
info.Name = battleReports.Name;
|
|
|
- info.Value = battleReports.TotalDamage;
|
|
|
info.Ranking = ranking;
|
|
|
infoListProto.Add(info);
|
|
|
|
|
|
- self.ViewRankList.Add(ranking, battleReports);
|
|
|
-
|
|
|
ranking += 1;
|
|
|
}
|
|
|
|
|
|
- bool isEqual = self.ViewRankList.Values.SequenceEqual(list);
|
|
|
+ bool isEqual = self.IsEqual(infoListProto);
|
|
|
if (isEqual)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ self.LastInfoListProto = infoListProto;
|
|
|
+
|
|
|
foreach (WNPlayer player in map.Players.Values)
|
|
|
{
|
|
|
MessageHelper.SendToClient(player, new G2C_RankNotify() { InfoList = infoListProto });
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private static bool IsEqual(this MapRankComponent self, List<RankInfo> infoList)
|
|
|
+ {
|
|
|
+ if (self.LastInfoListProto.Count != infoList.Count)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < infoList.Count; i++)
|
|
|
+ {
|
|
|
+ RankInfo info1 = infoList[i];
|
|
|
+ RankInfo info2 = self.LastInfoListProto[i];
|
|
|
+ if (info1 != null && info2 != null && (!info1.Name.Trim().Equals(info2.Name.Trim()) || info1.Ranking != info2.Ranking))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|