public ZhanDuiZhengBaSyncData LoadZhengBaSyncData(DateTime now, int selectRoleIfNewCreate) { ZhanDuiZhengBaSyncData syncData = new ZhanDuiZhengBaSyncData(); syncData.Month = ZhengBaUtils.MakeMonth(now); syncData.IsThisMonthInActivity = false; List <ZhanDuiZhengBaZhanDuiData> rankList = new List <ZhanDuiZhengBaZhanDuiData>(); List <ZhanDuiZhengBaZhanDuiData> zhanDuiList = new List <ZhanDuiZhengBaZhanDuiData>(); List <ZhanDuiZhengBaPkLogData> pkLogList = new List <ZhanDuiZhengBaPkLogData>(); if (KuaFuServerManager.IsGongNengOpened(113)) { TianTi5v5RankData rankData = TianTi5v5Service.ZhanDuiGetRankingData(DateTime.MinValue); bool bMonthFirst = this.CheckZhengBaRank(selectRoleIfNewCreate, syncData.Month); if (bMonthFirst) { syncData.IsThisMonthInActivity = true; } else if (syncData.Month == ZhengBaUtils.MakeMonth(rankData.ModifyTime) && rankData.MonthPaiHangList.Count > ZhanDuiZhengBaConsts.MinZhanDuiNum) { syncData.IsThisMonthInActivity = true; int[] groupArray = MathEx.MatchGroupBinary(64); int i = 0; while (i < 64 && i < rankData.MonthPaiHangList.Count) { int group = Array.IndexOf <int>(groupArray, i + 1) + 1; TianTi5v5ZhanDuiData data = rankData.MonthPaiHangList[i]; ZhanDuiZhengBaZhanDuiData zhandui = new ZhanDuiZhengBaZhanDuiData { ZhanDuiName = data.ZhanDuiName, ZhanDuiID = data.ZhanDuiID, ZhanLi = (long)((int)data.ZhanDouLi), DuanWeiId = data.DuanWeiId, DuanWeiRank = data.DuanWeiRank, ZoneId = data.ZoneID, MemberList = new List <RoleOccuNameZhanLi>(), Group = group }; foreach (TianTi5v5ZhanDuiRoleData a in data.teamerList) { if (a.RoleID == data.LeaderRoleID) { zhandui.MemberList.Insert(0, new RoleOccuNameZhanLi { RoleName = a.RoleName, Occupation = a.RoleOcc, ZhanLi = a.ZhanLi }); } else { zhandui.MemberList.Add(new RoleOccuNameZhanLi { RoleName = a.RoleName, Occupation = a.RoleOcc, ZhanLi = a.ZhanLi }); } } rankList.Add(zhandui); i++; } if (!this.BuildZhengBaRank(syncData.Month, rankList)) { LogManager.WriteLog(LogTypes.Fatal, "生成并写入战队争霸64强数据失败!", null, true); syncData.IsThisMonthInActivity = false; } } if (syncData.IsThisMonthInActivity) { zhanDuiList = this.LoadZhengBaRankData(syncData.Month); pkLogList = this.LoadPkLogList(syncData.Month); } } syncData.ZhanDuiList = zhanDuiList; syncData.PKLogList = pkLogList; syncData.RoleModTime = now; return(syncData); }