Skip to content

Commit

Permalink
276 spec info (#293)
Browse files Browse the repository at this point in the history
Co-authored-by: snixtho <[email protected]>
  • Loading branch information
araszka and snixtho authored Sep 29, 2024
1 parent 1d01057 commit be7b74e
Show file tree
Hide file tree
Showing 48 changed files with 2,428 additions and 630 deletions.
22 changes: 21 additions & 1 deletion EvoSC.sln
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamChatModule", "src/Modul
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamChatModule.Tests", "tests\Modules\TeamChatModule.Tests\TeamChatModule.Tests.csproj", "{7BD60D6E-7B7E-4771-87C0-7F98FC82F990}"
EndProject

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpectatorTargetInfoModule.Tests", "tests\Modules\SpectatorTargetInfoModule.Tests\SpectatorTargetInfoModule.Tests.csproj", "{E4BF17BE-A517-4D3C-8DCA-DA99A100EBFE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpectatorCamModeModule", "src\Modules\SpectatorCamModeModule\SpectatorCamModeModule.csproj", "{E9806703-6E24-4F05-A728-A04F7EB31749}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpectatorCamModeModule.Tests", "tests\Modules\SpectatorCamModeModule.Tests\SpectatorCamModeModule.Tests.csproj", "{09A88256-8008-4085-A8E6-CA6DEFAC63E3}"
EndProject



Expand Down Expand Up @@ -430,6 +435,18 @@ Global
{7BD60D6E-7B7E-4771-87C0-7F98FC82F990}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7BD60D6E-7B7E-4771-87C0-7F98FC82F990}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7BD60D6E-7B7E-4771-87C0-7F98FC82F990}.Release|Any CPU.Build.0 = Release|Any CPU
{E4BF17BE-A517-4D3C-8DCA-DA99A100EBFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4BF17BE-A517-4D3C-8DCA-DA99A100EBFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4BF17BE-A517-4D3C-8DCA-DA99A100EBFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4BF17BE-A517-4D3C-8DCA-DA99A100EBFE}.Release|Any CPU.Build.0 = Release|Any CPU
{E9806703-6E24-4F05-A728-A04F7EB31749}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9806703-6E24-4F05-A728-A04F7EB31749}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9806703-6E24-4F05-A728-A04F7EB31749}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9806703-6E24-4F05-A728-A04F7EB31749}.Release|Any CPU.Build.0 = Release|Any CPU
{09A88256-8008-4085-A8E6-CA6DEFAC63E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{09A88256-8008-4085-A8E6-CA6DEFAC63E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09A88256-8008-4085-A8E6-CA6DEFAC63E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09A88256-8008-4085-A8E6-CA6DEFAC63E3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -497,5 +514,8 @@ Global
{4AA1890A-1423-4831-95B2-E29B9A7A58D1} = {6D75D6A2-6ECD-4DE4-96C5-CAD7D134407A}
{DDB0A249-BD1C-4556-BFE1-362B17EDA874} = {DC47658A-F421-4BA4-B617-090A7DFB3900}
{7BD60D6E-7B7E-4771-87C0-7F98FC82F990} = {6D75D6A2-6ECD-4DE4-96C5-CAD7D134407A}
{E4BF17BE-A517-4D3C-8DCA-DA99A100EBFE} = {6D75D6A2-6ECD-4DE4-96C5-CAD7D134407A}
{E9806703-6E24-4F05-A728-A04F7EB31749} = {DC47658A-F421-4BA4-B617-090A7DFB3900}
{09A88256-8008-4085-A8E6-CA6DEFAC63E3} = {6D75D6A2-6ECD-4DE4-96C5-CAD7D134407A}
EndGlobalSection
EndGlobal
1 change: 1 addition & 0 deletions src/EvoSC/EvoSC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<ProjectReference Include="..\Modules\MatchManagerModule\MatchManagerModule.csproj" />
<ProjectReference Include="..\Modules\ASayModule\ASayModule.csproj" />
<ProjectReference Include="..\Modules\ServerManagementModule\ServerManagementModule.csproj" />
<ProjectReference Include="..\Modules\SpectatorCamModeModule\SpectatorCamModeModule.csproj" />
<ProjectReference Include="..\Modules\SpectatorTargetInfoModule\SpectatorTargetInfoModule.csproj" />
<ProjectReference Include="..\Modules\TeamChatModule\TeamChatModule.csproj" />
<ProjectReference Include="..\Modules\TeamInfoModule\TeamInfoModule.csproj" />
Expand Down
4 changes: 3 additions & 1 deletion src/EvoSC/InternalModules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using EvoSC.Modules.Official.Scoreboard;
using EvoSC.Modules.Official.ServerManagementModule;
using EvoSC.Modules.Official.SetName;
using EvoSC.Modules.Official.SpectatorCamModeModule;
using EvoSC.Modules.Official.SpectatorTargetInfoModule;
using EvoSC.Modules.Official.TeamChatModule;
using EvoSC.Modules.Official.TeamInfoModule;
Expand All @@ -37,6 +38,7 @@ public static class InternalModules
public static readonly Type[] Modules =
[
//typeof(ExampleModule),
typeof(GameModeUiModule),
typeof(PlayerModule),
typeof(MapsModule),
typeof(WorldRecordModule),
Expand All @@ -55,14 +57,14 @@ public static class InternalModules
typeof(MatchRankingModule),
typeof(ASayModule),
typeof(SpectatorTargetInfoModule),
typeof(SpectatorCamModeModule),
typeof(MapQueueModule),
typeof(MapListModule),
typeof(LocalRecordsModule),
typeof(ForceTeamModule),
typeof(TeamSettingsModule),
typeof(ServerManagementModule),
typeof(TeamInfoModule),
typeof(GameModeUiModule),
typeof(TeamChatModule)
];

Expand Down
20 changes: 20 additions & 0 deletions src/Modules/GameModeUiModule/Enums/GameModeUiComponents.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace EvoSC.Modules.Official.GameModeUiModule.Enums;

public static class GameModeUiComponents
{
public static readonly string Chrono = "Race_Chrono";
public static readonly string RespawnHelper = "Race_RespawnHelper";
public static readonly string Checkpoint = "Race_Checkpoint";
public static readonly string LapsCounter = "Race_LapsCounter";
public static readonly string TimeGap = "Race_TimeGap";
public static readonly string ScoresTable = "Race_ScoresTable";
public static readonly string DisplayMessage = "Race_DisplayMessage";
public static readonly string Countdown = "Race_Countdown";
public static readonly string SpectatorBaseName = "Race_SpectatorBase_Name";
public static readonly string SpectatorBaseCommands = "Race_SpectatorBase_Commands";
public static readonly string Record = "Race_Record";
public static readonly string BigMessage = "Race_BigMessage";
public static readonly string BlockHelper = "Race_BlockHelper";
public static readonly string WarmUp = "Race_WarmUp";
public static readonly string BestRaceViewer = "Race_BestRaceViewer";
}
2 changes: 1 addition & 1 deletion src/Modules/GameModeUiModule/GameModeUiModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace EvoSC.Modules.Official.GameModeUiModule;
[Module(IsInternal = true)]
public class GameModeUiModule(IGameModeUiModuleService gameModeUiModuleService) : EvoScModule, IToggleable
{
public Task EnableAsync() => gameModeUiModuleService.ApplyConfigurationAsync();
public Task EnableAsync() => gameModeUiModuleService.ApplyComponentSettingsAsync(gameModeUiModuleService.GetDefaultSettings());

public Task DisableAsync() => Task.CompletedTask;
}
2 changes: 0 additions & 2 deletions src/Modules/GameModeUiModule/GameModeUiModule.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
<ProjectReference Include="..\..\EvoSC.Modules\EvoSC.Modules.csproj"/>
<EmbeddedResource Include="Templates\**\*"/>
<EmbeddedResource Update="Localization.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Localization.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,50 @@
namespace EvoSC.Modules.Official.GameModeUiModule.Interfaces;
using EvoSC.Modules.Official.GameModeUiModule.Models;

namespace EvoSC.Modules.Official.GameModeUiModule.Interfaces;

public interface IGameModeUiModuleService
{
/// <summary>
/// Applies the configured UI modules property values.
/// Applies the given game mode component settings collection.
/// </summary>
/// <param name="componentSettingsList"></param>
/// <returns></returns>
public Task ApplyConfigurationAsync();
public Task ApplyComponentSettingsAsync(IEnumerable<GameModeUiComponentSettings> componentSettingsList);

/// <summary>
/// Returns the configured UI modules properties as JSON string.
/// Applies the given game mode component settings.
/// </summary>
/// <param name="componentSettings"></param>
/// <returns></returns>
public Task<string> GetUiModulesPropertiesJsonAsync();
public Task ApplyComponentSettingsAsync(GameModeUiComponentSettings componentSettings);

/// <summary>
/// Generates a UI properties object for the given values.
/// Applies the given game mode component settings.
/// </summary>
/// <param name="uiModuleName"></param>
/// <param name="name"></param>
/// <param name="visible"></param>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="scale"></param>
/// <returns></returns>
public Task<dynamic> GeneratePropertyObjectAsync(string uiModuleName, bool visible, double x, double y, double scale);
public Task ApplyComponentSettingsAsync(string name, bool visible, double x, double y, double scale);

/// <summary>
/// Returns the configured UI modules properties as JSON string.
/// </summary>
/// <returns></returns>
public string GetUiModulesPropertiesJson(IEnumerable<GameModeUiComponentSettings> componentSettingsList);

/// <summary>
/// Generates a UI properties object for the given values.
/// </summary>
/// <param name="componentSettings"></param>
/// <returns></returns>
public dynamic GeneratePropertyObject(GameModeUiComponentSettings componentSettings);

/// <summary>
/// Gets the default game mode component settings collection.
/// </summary>
/// <returns></returns>
public List<GameModeUiComponentSettings> GetDefaultSettings();
}
44 changes: 44 additions & 0 deletions src/Modules/GameModeUiModule/Models/GameModeUiComponentSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
namespace EvoSC.Modules.Official.GameModeUiModule.Models;

public class GameModeUiComponentSettings(string name, bool visible, double x, double y, double scale)
{
/// <summary>
/// The Name/ID of the game mode UI component.
/// </summary>
public string Name { get; init; } = name;

/// <summary>
/// Sets whether the component should be visible.
/// </summary>
public bool Visible { get; set; } = visible;

/// <summary>
/// Sets the X position of the component.
/// </summary>
public double X { get; set; } = x;

/// <summary>
/// Sets the Y position of the component.
/// </summary>
public double Y { get; set; } = y;

/// <summary>
/// Sets the scale of the component.
/// </summary>
public double Scale { get; set; } = scale;

/// <summary>
/// Sets whether the visibility of the component should be overwritten.
/// </summary>
public bool UpdateVisible { get; set; } = true;

/// <summary>
/// Sets whether the position of the component should be overwritten.
/// </summary>
public bool UpdatePosition { get; set; } = true;

/// <summary>
/// Sets whether the scale of the component should be overwritten.
/// </summary>
public bool UpdateScale { get; set; } = true;
}
Loading

0 comments on commit be7b74e

Please sign in to comment.