internal void HandleClientToGamePhaseTransition(ILeagueSession session, LeagueSessionPhaseChangedArgs e)
        {
            logger.Info("Handling Client to Game Phase Transition!");

            var modifications         = modificationLoader.EnumerateModifications();
            int compilationsRemaining = modifications.Count;

            foreach (var modification in modifications)
            {
                var resolutionChain = resolutionChainsByModificationName.GetOrAdd(
                    modification.RepositoryName,
                    add => new CompletionChain(cancellationToken => leagueBuildUtilities.ResolveModification(modification, cancellationToken))
                    );
                var compilationChain = compilationChainsByModificationName.GetOrAdd(
                    modification.RepositoryName,
                    add => new CompletionChain(cancellationToken => leagueBuildUtilities.CompileModification(modification, cancellationToken))
                    );
                var resolutionLink  = resolutionChain.CreateLink("resolution_" + DateTime.Now.ToFileTimeUtc());
                var compilationLink = compilationChain.CreateLink("compilation_" + DateTime.Now.ToFileTimeUtc());
                resolutionLink.Tail(compilationLink.StartAndWaitForChain);
                compilationLink.Tail(() => {
                    logger.Info("Compilation counter at " + compilationsRemaining);
                    if (Interlocked.Decrement(ref compilationsRemaining) == 0)
                    {
                        var gameModifications = leagueBuildUtilities.LinkGameModifications(modifications);
                        trinketSpawner.SpawnTrinket(
                            session.GetProcessOrNull(LeagueProcessType.GameClient),
                            leagueTrinketSpawnConfigurationFactory.GetGameConfiguration(gameModifications)
                            );
                    }
                });
                resolutionChain.StartNext(resolutionLink);
            }
        }
Beispiel #2
0
        private void OnPhaseChanged(LeagueSessionPhaseChangedArgs e)
        {
            LeagueSessionPhaseChangedHandler handler = PhaseChanged;

            if (handler != null)
            {
                handler(session, e);
            }
        }
        internal void HandleSessionPhaseChanged(ILeagueSession session, LeagueSessionPhaseChangedArgs e)
        {
            logger.Info("Phase Change from " + e.Previous + " to " + e.Current);
            PhaseChangeHandler handler;

            if (phaseChangeHandlers.TryGetValue(new PhaseChange(e.Previous, e.Current), out handler))
            {
                handler(session, e);
            }
        }
        internal void HandleUninitializedToPreclientPhaseTransition(ILeagueSession session, LeagueSessionPhaseChangedArgs e)
        {
            logger.Info("Handling Uninitialized to Preclient Phase Transition!");
            var modifications = modificationLoader.EnumerateModifications();

            foreach (var modification in modifications)
            {
                var resolutionChain = resolutionChainsByModificationName.GetOrAdd(
                    modification.RepositoryName,
                    add => new CompletionChain(cancellationToken => leagueBuildUtilities.ResolveModification(modification, cancellationToken))
                    );
                var compilationChain = compilationChainsByModificationName.GetOrAdd(
                    modification.RepositoryName,
                    add => new CompletionChain(cancellationToken => leagueBuildUtilities.CompileModification(modification, cancellationToken))
                    );

                var resolutionLink  = resolutionChain.CreateLink("resolution_" + DateTime.Now.ToFileTimeUtc());
                var compilationLink = compilationChain.CreateLink("compilation_" + DateTime.Now.ToFileTimeUtc());
                resolutionLink.Tail(compilationLink.StartAndWaitForChain);
                resolutionChain.StartNext(resolutionLink);
            }
            radsService.Suspend();
        }
 private void OnPhaseChanged(LeagueSessionPhaseChangedArgs e)
 {
     LeagueSessionPhaseChangedHandler handler = PhaseChanged;
      if (handler != null)
     handler(session, e);
 }