Esempio n. 1
0
        public string GetBanner(string siteId)
        {
            int domainId = 0;

            CrossSiteCache.Instance().TryGetDomainId(siteId, out domainId);
            return(CrossCrowdMessage.GetBanner(domainId));
        }
Esempio n. 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);
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        void SavePrizeAfter(CrosscrowdMatchEntity crowdMatch, CrosscrowdManagerEntity homeManager, CrosscrowdManagerEntity awayManager)
        {
            try
            {
                WebServerHandler.AddCoin2(crowdMatch.HomeSiteId, crowdMatch.HomeId, crowdMatch.HomePrizeCoin,
                                          _coinChargeSourceType);
                WebServerHandler.AddCoin2(crowdMatch.AwaySiteId, crowdMatch.AwayId, crowdMatch.AwayPrizeCoin,
                                          _coinChargeSourceType);

                string banner  = "";
                string homePop = "";
                string awayPop = "";

                if (crowdMatch.HomeScore > crowdMatch.AwayScore)
                {
                    homePop += "&" + CrossCrowdMessage.BuildCrowdMatch(EnumWinType.Win, crowdMatch.AwayName, crowdMatch.HomeScore, crowdMatch.AwayScore);
                    awayPop += "&" + CrossCrowdMessage.BuildCrowdMatch(EnumWinType.Lose, crowdMatch.HomeName, crowdMatch.AwayScore, crowdMatch.HomeScore);
                    if (homeManager.WinningCount == 2)
                    {
                        banner += "&" + CrossCrowdMessage.BuildBannerCrowd3Win(crowdMatch.HomeName);
                    }
                    else if (homeManager.WinningCount == 4)
                    {
                        banner += "&" + CrossCrowdMessage.BuildBannerCrowd5Win(crowdMatch.HomeName);
                    }
                }
                else if (crowdMatch.AwayScore > crowdMatch.HomeScore)
                {
                    homePop += "&" + CrossCrowdMessage.BuildCrowdMatch(EnumWinType.Lose, crowdMatch.AwayName, crowdMatch.HomeScore, crowdMatch.AwayScore);
                    awayPop += "&" + CrossCrowdMessage.BuildCrowdMatch(EnumWinType.Win, crowdMatch.HomeName, crowdMatch.AwayScore, crowdMatch.HomeScore);
                    if (awayManager.WinningCount == 2)
                    {
                        banner += "&" + CrossCrowdMessage.BuildBannerCrowd3Win(crowdMatch.AwayName);
                    }
                    else if (awayManager.WinningCount == 4)
                    {
                        banner += "&" + CrossCrowdMessage.BuildBannerCrowd5Win(crowdMatch.AwayName);
                    }
                }
                else
                {
                    homePop += "&" + CrossCrowdMessage.BuildCrowdMatch(EnumWinType.Draw, crowdMatch.AwayName, crowdMatch.HomeScore, crowdMatch.AwayScore);
                    awayPop += "&" + CrossCrowdMessage.BuildCrowdMatch(EnumWinType.Draw, crowdMatch.HomeName, crowdMatch.AwayScore, crowdMatch.HomeScore);
                }
                homePop += "&" + CrossCrowdMessage.BuildCrowdMatchPrize(crowdMatch.HomePrizeScore, crowdMatch.HomePrizeCoin, crowdMatch.HomePrizeHonor);
                awayPop += "&" + CrossCrowdMessage.BuildCrowdMatchPrize(crowdMatch.AwayPrizeScore, crowdMatch.AwayPrizeCoin, crowdMatch.AwayPrizeHonor);

                var scoreDiv = crowdMatch.HomeScore - crowdMatch.AwayScore;
                if (scoreDiv >= 3)
                {
                    banner += "&" + CrossCrowdMessage.BuildBannerCrowdWinOver(crowdMatch.HomeName, crowdMatch.HomeScore, crowdMatch.AwayScore, crowdMatch.AwayName);
                }
                else if (scoreDiv < -2)
                {
                    banner += "&" + CrossCrowdMessage.BuildBannerCrowdWinOver(crowdMatch.AwayName, crowdMatch.AwayScore, crowdMatch.HomeScore, crowdMatch.HomeName);
                }

                if (crowdMatch.HomeMorale <= 0 && crowdMatch.AwayMorale <= 0)
                {
                    homePop          += "&" + CrossCrowdMessage.BuildCrowdKillTogether(crowdMatch.AwayName);
                    awayPop          += "&" + CrossCrowdMessage.BuildCrowdKillTogether(crowdMatch.HomeName);
                    banner           += "&" + CrossCrowdMessage.BuildBannerCrowdKill(crowdMatch.HomeName, crowdMatch.AwayName);
                    banner           += "&" + CrossCrowdMessage.BuildBannerCrowdKill(crowdMatch.AwayName, crowdMatch.HomeName);
                    crowdMatch.IsKill = true;
                }
                else if (crowdMatch.HomeMorale <= 0)
                {
                    awayPop          += "&" + CrossCrowdMessage.BuildCrowdKill(crowdMatch.HomeName);
                    homePop          += "&" + CrossCrowdMessage.BuildCrowdByKill(crowdMatch.AwayName);
                    banner           += "&" + CrossCrowdMessage.BuildBannerCrowdKill(crowdMatch.AwayName, crowdMatch.HomeName);
                    crowdMatch.IsKill = true;
                }
                else if (crowdMatch.AwayMorale <= 0)
                {
                    awayPop          += "&" + CrossCrowdMessage.BuildCrowdByKill(crowdMatch.HomeName);
                    homePop          += "&" + CrossCrowdMessage.BuildCrowdKill(crowdMatch.AwayName);
                    banner           += "&" + CrossCrowdMessage.BuildBannerCrowdKill(crowdMatch.HomeName, crowdMatch.AwayName);
                    crowdMatch.IsKill = true;
                }
                //LogHelper.Insert(string.Format("HomePop:{0},AwayPop:{1}",homePop,awayPop),LogType.Info);
                if (!string.IsNullOrEmpty(homePop))
                {
                    CrossCrowdMessage.SendCrowdPop(crowdMatch.HomeId, homePop.TrimStart('&'));
                }
                if (!string.IsNullOrEmpty(awayPop))
                {
                    CrossCrowdMessage.SendCrowdPop(crowdMatch.AwayId, awayPop.TrimStart('&'));
                }
                if (!string.IsNullOrEmpty(banner))
                {
                    CrossCrowdMessage.SendCrowdBanner(_domainId, banner.TrimStart('&'));
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("CrossCrowdProcess-SavePrizeAfter", ex);
            }
        }