diff --git a/.gitignore b/.gitignore index 1730a86de..86bf4d50c 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,4 @@ EvoSC/ext_plugins/* docker-compose.yml global.json .env +nuget.config \ No newline at end of file diff --git a/README.md b/README.md index 1c0a9d27a..31b4892a7 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ It sets up a TM2020 dedicated server for you as well as all the required other s version: "3.8" services: trackmania: - image: evotm/trackmania + image: evoesports/trackmania ports: - 2350:2350/udp - 2350:2350/tcp diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 647e2f620..46640ee76 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,6 +1,6 @@ services: trackmania: - image: evotm/trackmania + image: evoesports/trackmania restart: always ports: - 2350:2350/udp diff --git a/src/EvoSC.Modules/Util/SortedModuleCollection.cs b/src/EvoSC.Modules/Util/SortedModuleCollection.cs index 162271455..70619f730 100644 --- a/src/EvoSC.Modules/Util/SortedModuleCollection.cs +++ b/src/EvoSC.Modules/Util/SortedModuleCollection.cs @@ -33,53 +33,57 @@ IEnumerator IEnumerable.GetEnumerator() private List GetSortedModules() { - var dependencyGraph = MakeDependencyGraph(); - EnsureDependenciesExists(dependencyGraph); - + var graph = MakeDependencyGraph(); + EnsureDependenciesExists(graph); + var sortedDependencies = new List(); while (true) { - string? selected = null; - - foreach (var dependent in dependencyGraph) + bool found = false; + + foreach (var node in graph) { - if (dependent.Value.Count != 0) + if (node.Value.Count > 0) { continue; } - - sortedDependencies.Add(_modules[dependent.Key]); - RemoveDependent(dependencyGraph, dependent); - - selected = dependent.Key; + + sortedDependencies.Add(_modules[node.Key]); + RemoveNodeReferences(graph, node.Key); + found = true; } - if (selected != null) - { - dependencyGraph.Remove(selected); - } - else + if (!found) { break; } } - - DetectCycle(dependencyGraph); + + if (graph.Count > 0) + { + throw new DependencyCycleException(graph); + } + return sortedDependencies; } - private static void RemoveDependent(DependencyGraph dependencyGraph, KeyValuePair> dependent) + private static void RemoveNodeReferences(DependencyGraph graph, string nodeName) { - foreach (var dependencies in dependencyGraph) + if (graph.ContainsKey(nodeName)) { - if (dependencies.Value.Contains(dependencies.Key)) + graph.Remove(nodeName); + } + + foreach (var node in graph) + { + if (node.Value.Contains(nodeName)) { - dependencies.Value.Remove(dependent.Key); + node.Value.Remove(nodeName); } } } - + private DependencyGraph MakeDependencyGraph() { var adjList = new Dictionary>(); diff --git a/src/Modules/MapsModule/MapsModule.csproj b/src/Modules/MapsModule/MapsModule.csproj index be13ce5e5..1780ec94b 100644 --- a/src/Modules/MapsModule/MapsModule.csproj +++ b/src/Modules/MapsModule/MapsModule.csproj @@ -9,6 +9,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Modules/SpectatorCamModeModule/Controllers/SpectatorCamModeEventController.cs b/src/Modules/SpectatorCamModeModule/Controllers/SpectatorCamModeEventController.cs new file mode 100644 index 000000000..c253972b6 --- /dev/null +++ b/src/Modules/SpectatorCamModeModule/Controllers/SpectatorCamModeEventController.cs @@ -0,0 +1,22 @@ +using EvoSC.Common.Controllers; +using EvoSC.Common.Controllers.Attributes; +using EvoSC.Common.Controllers.Context; +using EvoSC.Common.Events.Attributes; +using EvoSC.Common.Remote; +using EvoSC.Common.Remote.EventArgsModels; +using EvoSC.Modules.Official.SpectatorCamModeModule.Interfaces; + +namespace EvoSC.Modules.Official.SpectatorCamModeModule.Controllers; + +[Controller] +public class SpectatorCamModeEventController(ISpectatorCamModeService camModeService) + : EvoScController +{ + [Subscribe(ModeScriptEvent.EndRoundStart)] + public Task OnEndRoundStartAsync(object sender, RoundEventArgs eventArgs) => + camModeService.HideCamModeWidgetAsync(); + + [Subscribe(ModeScriptEvent.StartRoundStart)] + public Task OnStartRoundStartAsync(object sender, RoundEventArgs eventArgs) => + camModeService.SendPersistentCamModeWidgetAsync(); +} diff --git a/tests/Modules/FastestCp.Tests/FastestCp.Tests.csproj b/tests/Modules/FastestCp.Tests/FastestCp.Tests.csproj index 13a687d91..c172a5166 100644 --- a/tests/Modules/FastestCp.Tests/FastestCp.Tests.csproj +++ b/tests/Modules/FastestCp.Tests/FastestCp.Tests.csproj @@ -35,9 +35,9 @@ - + PreserveNewest - %(RecursiveDir)\%(Filename)%(Extension) + Manialinks\%(Filename)%(Extension)