using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Sog; using ProtoCSStruct; namespace World { public static class RankUtils { public static bool IsLoadRankDataFromDbSuccess() { WorldRankData rankData = WorldServerUtils.GetWorldRankData(); return rankData.IsLoadDbDataSuccess; } public static bool CheckLoadAllRankDataFromDbSuccess() { WorldRankData rankData = WorldServerUtils.GetWorldRankData(); foreach (var rankDesc in RankConfigDescMgr.Instance.ItemTable.Values) { WorldRankDataOne rankOne = GetWorldRankDataOne(rankDesc.rankId); if (rankOne == null) { return false; } if(rankOne.CurRecord == null || rankOne.LastRecord == null) { return false; } } return true; } public static WorldRankDataOne GetCreateWorldRankDataOne(int rankId) { WorldRankData rankData = WorldServerUtils.GetWorldRankData(); WorldRankDataOne oneRank = null; if (!rankData.AllRank.ContainsKey(rankId)) { oneRank = new WorldRankDataOne(); rankData.AllRank.Add(rankId, oneRank); } else { oneRank = rankData.AllRank[rankId]; } return oneRank; } public static WorldRankDataOne GetWorldRankDataOne(int rankId) { WorldRankData rankData = WorldServerUtils.GetWorldRankData(); if (!rankData.AllRank.ContainsKey(rankId)) { return null; } else { return rankData.AllRank[rankId]; } } public static bool IsAllDataSave() { //没加载成功,可以退出 if(IsLoadRankDataFromDbSuccess() == false) { return true; } WorldRankData rankData = WorldServerUtils.GetWorldRankData(); foreach (var rankItem in rankData.AllRank.Values) { } return true; } public static long GetRoleTotalStatData(DBRoleData roleData, int id) { for(int i =0;i