private MessageCode Start(DateTime startTime, DateTime endTime) { var crowd = CrosscrowdInfoMgr.GetCurrent(_domainId); DateTime curTime = DateTime.Now; if (crowd != null && crowd.EndTime > curTime) { return(MessageCode.CrowdNotEnding); } if (startTime >= endTime || endTime < curTime) { return(MessageCode.NbParameterError); } crowd = new CrosscrowdInfoEntity(); crowd.DomainId = _domainId; crowd.StartTime = startTime; crowd.EndTime = endTime; crowd.RowTime = DateTime.Now; if (CrosscrowdInfoMgr.Insert(crowd)) { CrowdManagerDic = new ConcurrentDictionary <Guid, int>(); _crowdInfo = crowd; _status = EnumLadderStatus.Running; //CrossChatHelper.SendBannerCrowdOpen(_domainId); RobotCore.Instance.RunHook(EnumMatchType.CrossCrowd, endTime); return(MessageCode.Success); } else { return(MessageCode.NbUpdateFail); } }
private void Initialize() { CrowdManagerDic = new ConcurrentDictionary <Guid, int>(); CompetitorDic = new ConcurrentDictionary <Guid, CrosscrowdManagerEntity>(); ManagerFightDic = new Dictionary <Guid, CrowdHeartEntity>(); _crowdResurrectionCd = CacheFactory.AppsettingCache.GetAppSettingToInt(EnumAppsetting.CrowdResurrectionCd); _crowdCd = CacheFactory.AppsettingCache.GetAppSettingToInt(EnumAppsetting.CrowdCd); _crowdMaxPoint = CacheFactory.AppsettingCache.GetAppSettingToInt(EnumAppsetting.CrowdMaxPoint); _crowdMaxLegendCount = CacheFactory.AppsettingCache.GetAppSettingToInt(EnumAppsetting.CrowdMaxLegendCount); _startTime = DateTime.Now; //初始化分组模板 InitGroupTemplate(); #region Init Condition dic string condition = CacheFactory.AppsettingCache.GetAppSetting(EnumAppsetting.CrowdCondition); _conditions = new List <ArenaCondition>(); if (!string.IsNullOrEmpty(condition)) { string[] tempConditions = condition.Split('|'); foreach (var s in tempConditions) { string[] temp = s.Split(','); _conditions.Add(new ArenaCondition(Convert.ToInt32(temp[0]), Convert.ToInt32(temp[1]))); } } #endregion _nbThreadPool = new NBThreadPool(5); _clearTimer = new Timer { Interval = ClearFightdicTime }; _clearTimer.Elapsed += new ElapsedEventHandler(ClearFightDic); _timer = new Timer { Interval = 5000 }; _timer.Elapsed += new ElapsedEventHandler(CheckStatusJob); var crowd = CrosscrowdInfoMgr.GetCurrent(_domainId); DateTime curTime = DateTime.Now; if (crowd != null && crowd.EndTime > curTime) { _crowdInfo = crowd; _status = EnumLadderStatus.Running; RobotCore.Instance.RunHook(EnumMatchType.CrossCrowd, _crowdInfo.EndTime); } else { _status = EnumLadderStatus.End; } }