예제 #1
0
        public static UnitSpotlight GetRandom()
        {
            var spotlights = MemCache.GetCached("spotlight", LoadSpotlights, 60 * 60 * 24);

            if (spotlights.Count > 0)
            {
                return(spotlights[new Random().Next(spotlights.Count)]);
            }
            else
            {
                return(new UnitSpotlight());
            }
        }
예제 #2
0
        public PublicCommunityInfo GetPublicCommunityInfo()
        {
            var info = new PublicCommunityInfo();

            info.NewsItems   = Global.Server.NewsListManager.GetCurrentNewsList().NewsItems;
            info.LadderItems = Global.Server.LadderListManager.GetCurrentLadderList().LadderItems;
            info.ForumItems  = Global.Server.ForumListManager.GetCurrentForumList(null).ForumItems;
            info.MapItems    = MemCache.GetCached <List <MapItem> >("featuredMapItems",
                                                                    () =>
            {
                using (var db = new ZkDataContext())
                {
                    return(db.Resources.Where(x => x.TypeID == ResourceType.Map && x.MapSupportLevel >= MapSupportLevel.Featured).ToList()
                           .Select(x => x.ToMapItem()).ToList());
                }
            }, 3542);

            return(info);
        }