Beispiel #1
0
        private async Task InitializeTimers(bool allShardsLoggedIn)
        {
            if (!allShardsLoggedIn)
            {
                return;
            }

            // We need to load the cache on program start.
            await MemoryCache.Initialize();

            await ConsoleLogger.LogAsync("Memory Cache timer initialized", LogLvl.INFO);

            await KaguyaStatsFactory.Initialize();

            await ConsoleLogger.LogAsync("Kaguya stats updater initialized", LogLvl.INFO);

            await AntiRaidService.Initialize();

            await ConsoleLogger.LogAsync("Antiraid service initialized", LogLvl.INFO);

            await AutoUnmuteHandler.Initialize();

            await ConsoleLogger.LogAsync("Unmute handler initialized", LogLvl.INFO);

#if !DEBUG
            await OwnerGiveawayMessageUpdaterService.Initialize();

            await ConsoleLogger.LogAsync("Owner giveaway message updater initialized", LogLvl.INFO);

            await KaguyaPremiumRoleHandler.Initialize();

            await ConsoleLogger.LogAsync("Kaguya Premium role handler initialized", LogLvl.INFO);

            await KaguyaPremiumExpirationHandler.Initialize();

            await ConsoleLogger.LogAsync("Kaguya Premium expiration handler initialized", LogLvl.INFO);

            await RateLimitService.Initialize();

            await ConsoleLogger.LogAsync("Ratelimit service initialized", LogLvl.INFO);

            await StatsUpdater.Initialize();

            await ConsoleLogger.LogAsync("Top.gg stats updater initialized", LogLvl.INFO);

            await RemindService.Initialize();

            await ConsoleLogger.LogAsync("Remind service initialized", LogLvl.INFO);

            await UpvoteExpirationNotifier.Initialize();

            await ConsoleLogger.LogAsync("Upvote expiration notification timer initialized", LogLvl.INFO);

            await GameRotationService.Initialize();

            await ConsoleLogger.LogAsync("Game rotation timer initialized", LogLvl.INFO);
#endif
            await ConsoleLogger.LogAsync("All timers initialized.", LogLvl.INFO);
        }
Beispiel #2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         // Player in range to pick up food item (this item)
         inRange = true;
         if (playerStatsUpdater == null)
         {
             playerStatsUpdater = other.GetComponent <StatsUpdater>();
         }
     }
 }
Beispiel #3
0
        public Engine()
        {
            storyStateUpdater             = new StoryStateUpdater();
            storyEventPreparer            = new StoryEventPreparer();
            statsUpdater                  = new StatsUpdater();
            nextStoryEventProcessor       = new NextStoryEventProcessor();
            storyEventUpdaterFromResponse = new StoryEventUpdaterFromResponse();
            referenceUpdater              = new ReferenceUpdater();

            var story = HlData.Story;

            StoryState = new StoryState(story, story.AllEvents[0]);
            Stats      = HlData.Stats;
            Reference  = HlData.Reference;
        }
        public async Task <IDownsizePotential> GetDownsizePotential(Presentation activePresentation, IDownsizePotential potential, StatsUpdater updateStat = null)
        {
            var                 designs                = activePresentation.Designs;
            List <Master>       availableMasters       = new List <Master>();
            List <CustomLayout> availableCustomLayouts = new List <CustomLayout>();

            List <CustomLayout> usedCustomLayouts = await Task.FromResult((from Slide slide in activePresentation.Slides
                                                                           select slide.CustomLayout).ToList()).ConfigureAwait(false);

            foreach (Design design in designs)
            {
                var slideMaster = design.SlideMaster;
                availableMasters.Add(slideMaster);
                List <CustomLayout> designCustomLayouts = await Task.FromResult((from CustomLayout layout in slideMaster.CustomLayouts
                                                                                 select layout).ToList()).ConfigureAwait(false);

                availableCustomLayouts.AddRange(designCustomLayouts);
            }
            potential.UnusedLayouts = availableCustomLayouts.Where(layout => !usedCustomLayouts.Contains(layout)).ToList();
            potential.UnusedMasters = availableMasters.Where(master => !(from CustomLayout layout in master.CustomLayouts select layout).ToList().Except(potential.UnusedLayouts).Any()).ToList();

            updateStat?.Invoke();

            return(await Task.FromResult(potential).ConfigureAwait(false));
        }
        public async Task <IDownsizeResponse> Downsize(IDownsizePotential potential, IDownsizeResponse downsizeResponse, StatsUpdater updateStat = null)
        {
            try
            {
                foreach (CustomLayout layout in potential.UnusedLayouts)
                {
                    layout.Delete();
                    downsizeResponse.CustomLayoutsDeleted++;
                }

                foreach (Master master in potential.UnusedMasters)
                {
                    master.Delete();
                    downsizeResponse.MasterSlidesDeleted++;
                }

                downsizeResponse.IsSuccess     = true;
                downsizeResponse.ResultMessage = Constants.Messages.SlideMasterDonwsizeSuccess;
            }
            catch (Exception e)
            {
                downsizeResponse.Exception     = e;
                downsizeResponse.ResultMessage = Constants.Messages.SlideMasterDonwsizeFailed;
            }

            updateStat?.Invoke(downsizeResponse);

            return(await Task.FromResult(downsizeResponse).ConfigureAwait(false));
        }