예제 #1
0
        public string GetBanner(string siteId)
        {
            int domainId = 0;

            CrossSiteCache.Instance().TryGetDomainId(siteId, out domainId);
            return(CrossCrowdMessage.GetBanner(domainId));
        }
예제 #2
0
        public CrossCrowdManager(int p)
        {
            _crowdThreadDic     = new Dictionary <int, CrossCrowdThread>();
            _siteCrowdThreadDic = new Dictionary <string, CrossCrowdThread>();
            var domainList = CrossSiteCache.Instance().GetDomainList();

            if (domainList != null && domainList.Count > 0)
            {
                foreach (var i in domainList)
                {
                    if (i > 0)
                    {
                        CrossCrowdMessage.InitBanner(i);
                        var thread = new CrossCrowdThread(i);
                        _crowdThreadDic.Add(i, thread);
                        var siteList = CrossSiteCache.Instance().GetSiteListByDomain(i);
                        if (siteList != null && siteList.Count > 0)
                        {
                            foreach (var site in siteList)
                            {
                                if (!_siteCrowdThreadDic.ContainsKey(site))
                                {
                                    _siteCrowdThreadDic.Add(site, thread);
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #3
0
        public CrossLadderManager(int p)
        {
            _ladderThreadDic     = new Dictionary <int, CrossLadderThread>();
            _siteLadderThreadDic = new Dictionary <string, CrossLadderThread>();
            var domainList = CrossSiteCache.Instance().GetDomainList();

            if (domainList != null && domainList.Count > 0)
            {
                foreach (var i in domainList)
                {
                    if (i > 0)
                    {
                        var thread = new CrossLadderThread(i);
                        _ladderThreadDic.Add(i, thread);
                        var siteList = CrossSiteCache.Instance().GetSiteListByDomain(i);
                        if (siteList != null && siteList.Count > 0)
                        {
                            foreach (var site in siteList)
                            {
                                if (!_siteLadderThreadDic.ContainsKey(site))
                                {
                                    _siteLadderThreadDic.Add(site, thread);
                                }
                            }
                        }
                    }
                }
            }
            CreateHook();
        }
예제 #4
0
 public CrossladderManagerResponse GetLadderManager(string siteId, Guid managerId)
 {
     try
     {
         var ladderManager = CrossladderManagerMgr.GetById(managerId);
         if (ladderManager == null)
         {
             if (!ManagerUtil.CheckFunction(siteId, managerId, EnumOpenFunction.CrossLadder))
             {
                 return(ResponseHelper.Create <CrossladderManagerResponse>(MessageCode.NbFunctionNotOpen));
             }
             var nbManager = NbManagerMgr.GetById(managerId, siteId);
             if (nbManager == null)
             {
                 return(ResponseHelper.Create <CrossladderManagerResponse>(MessageCode.MissManager));
             }
             int domainId = 0;
             int honor    = 0;
             CrossladderManagerMgr.GetOldHonor(managerId, ref honor);
             CrossSiteCache.Instance().TryGetDomainId(siteId, out domainId);
             ladderManager                 = new CrossladderManagerEntity();
             ladderManager.DomainId        = domainId;
             ladderManager.SiteId          = siteId;
             ladderManager.SiteName        = CacheFactory.FunctionAppCache.GetCrossZoneName(siteId);
             ladderManager.ManagerId       = managerId;
             ladderManager.Name            = nbManager.Name;
             ladderManager.SiteId          = siteId;
             ladderManager.Logo            = nbManager.Logo;
             ladderManager.Score           = _ladderRegisterScore;
             ladderManager.LastExchageTime = ShareUtil.BaseTime;
             ladderManager.RowTime         = DateTime.Now;
             ladderManager.UpdateTime      = DateTime.Now;
             ladderManager.Honor           = honor;
             ladderManager.MaxScore        = _ladderRegisterScore;
             ladderManager.DailyMaxScore   = _ladderRegisterScore;
             ladderManager.Stamina         = 50;
             CrossladderManagerMgr.Insert(ladderManager);
         }
         if (ladderManager.Stamina < 0)
         {
             ladderManager.Stamina = 0;
         }
         if (ladderManager.StaminaBuy < 0)
         {
             ladderManager.StaminaBuy = 0;
         }
         var response = ResponseHelper.CreateSuccess <CrossladderManagerResponse>();
         response.Data = ladderManager;
         return(response);
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("GetCrossLadderManager", ex);
         return(ResponseHelper.Create <CrossladderManagerResponse>(MessageCode.Exception));
     }
 }
예제 #5
0
        public CrossRankThread(int b)
        {
            _rankRecordDate   = DateTime.Today;
            _rankHandlers     = new Dictionary <int, Dictionary <int, RankHandler> >();
            _siterankHandlers = new Dictionary <string, Dictionary <int, RankHandler> >();
            var domainList = CrossSiteCache.Instance().GetDomainList();

            if (domainList != null && domainList.Count > 0)
            {
                foreach (var i in domainList)
                {
                    if (i > 0)
                    {
                        _rankHandlers.Add(i, new Dictionary <int, RankHandler>());
                        var rankHandler1 = new RankHandler(EnumRankType.CrossCrowdRank, i);
                        var rankHandler2 = new RankHandler(EnumRankType.CrossLadderRank, i);
                        var rankHandler3 = new RankHandler(EnumRankType.CrossLadderDailyRank, i);

                        _rankHandlers[i].Add((int)EnumRankType.CrossCrowdRank, rankHandler1);
                        _rankHandlers[i].Add((int)EnumRankType.CrossLadderRank, rankHandler2);
                        _rankHandlers[i].Add((int)EnumRankType.CrossLadderDailyRank, rankHandler3);

                        var siteList = CrossSiteCache.Instance().GetSiteListByDomain(i);
                        if (siteList != null && siteList.Count > 0)
                        {
                            foreach (var site in siteList)
                            {
                                _siterankHandlers.Add(site, new Dictionary <int, RankHandler>());
                                _siterankHandlers[site].Add((int)EnumRankType.CrossCrowdRank, rankHandler1);
                                _siterankHandlers[site].Add((int)EnumRankType.CrossLadderRank, rankHandler2);
                                _siterankHandlers[site].Add((int)EnumRankType.CrossLadderDailyRank, rankHandler3);
                            }
                        }
                    }
                }
            }
        }
예제 #6
0
        CrosscrowdManagerEntity InnerGetManager(string siteId, Guid managerId, int crowdId, DateTime curTime)
        {
            var crowdManager = CrosscrowdManagerMgr.GetById(managerId);
            int domainId     = 1;

            if (crowdManager == null)
            {
                var manager = NbManagerMgr.GetById(managerId, siteId);
                if (manager == null)
                {
                    return(null);
                }
                //if (!ManagerUtil.CheckFunction(siteId, managerId, EnumOpenFunction.Crowd))
                //    return null;
                CrossSiteCache.Instance().TryGetDomainId(siteId, out domainId);
                crowdManager                  = new CrosscrowdManagerEntity();
                crowdManager.DomainId         = domainId;
                crowdManager.SiteId           = siteId;
                crowdManager.SiteName         = CacheFactory.FunctionAppCache.GetCrossZoneName(siteId);
                crowdManager.Name             = manager.Name;
                crowdManager.Logo             = manager.Logo;
                crowdManager.CrossCrowdId     = crowdId;
                crowdManager.Morale           = _initMorale;
                crowdManager.ManagerId        = managerId;
                crowdManager.RowTime          = curTime;
                crowdManager.UpdateTime       = curTime;
                crowdManager.ScoreUpdateTime  = curTime;
                crowdManager.ResurrectionTime = ShareUtil.BaseTime;
                crowdManager.NextMatchTime    = ShareUtil.BaseTime;
                crowdManager.Kpi              = ManagerUtil.GetKpi(managerId, siteId);
                CrosscrowdManagerMgr.Insert(crowdManager);
            }
            else if (crowdId > 0)
            {
                if (crowdManager.CrossCrowdId != crowdId)
                {
                    CrossSiteCache.Instance().TryGetDomainId(siteId, out domainId);
                    crowdManager.DomainId          = domainId;
                    crowdManager.CrossCrowdId      = crowdId;
                    crowdManager.KillNumber        = 0;
                    crowdManager.ByKillNumber      = 0;
                    crowdManager.Morale            = _initMorale;
                    crowdManager.Score             = 0;
                    crowdManager.ScoreUpdateTime   = curTime;
                    crowdManager.UpdateTime        = curTime;
                    crowdManager.WinningCount      = 0;
                    crowdManager.ResurrectionCount = 0;
                    crowdManager.ResurrectionAuto  = 0;
                    crowdManager.ClearCdCount      = 0;
                    crowdManager.Kpi = ManagerUtil.GetKpi(managerId, siteId);

                    CrosscrowdManagerMgr.Update(crowdManager);
                }
                else if (crowdManager.Morale <= 0)
                {
                    if (curTime >= crowdManager.ResurrectionTime)
                    {
                        crowdManager.Morale     = _initMorale;
                        crowdManager.UpdateTime = curTime;
                        crowdManager.ResurrectionAuto++;
                        CrosscrowdManagerMgr.Update(crowdManager);
                    }
                    else
                    {
                        crowdManager.Morale = 0;
                    }
                }
            }
            return(crowdManager);
        }