-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: snixtho <[email protected]>
- Loading branch information
Showing
33 changed files
with
1,064 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
namespace EvoSC.Manialinks.Attributes; | ||
|
||
/// <summary> | ||
/// Specifies that the annotated class is used as an Form Entry Model. | ||
/// Specifies that the annotated class is used as a Form Entry Model. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Class)] | ||
public class FormEntryModelAttribute : Attribute; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<component> | ||
<template> | ||
<stylesheet> | ||
<style | ||
class="maplistrow-linkbtn-btn-default" | ||
textsize="0.3" | ||
/> | ||
</stylesheet> | ||
</template> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using EvoSC.Common.Interfaces.Themes; | ||
using EvoSC.Common.Themes; | ||
using EvoSC.Common.Themes.Attributes; | ||
using EvoSC.Common.Util; | ||
|
||
namespace EvoSC.Modules.Official.MapListModule.Themes; | ||
|
||
[Theme(Name = "Map List", Description = "Default theme for the Map List.")] | ||
public class DefaultMapListTheme(IThemeManager theme) : Theme<DefaultMapListTheme> | ||
{ | ||
private readonly dynamic _theme = theme.Theme; | ||
|
||
public override Task ConfigureAsync() | ||
{ | ||
|
||
return Task.CompletedTask; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/Modules/TeamSettingsModule/Controllers/TeamSettingsCommandsController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using EvoSC.Commands.Attributes; | ||
using EvoSC.Commands.Interfaces; | ||
using EvoSC.Common.Controllers; | ||
using EvoSC.Common.Controllers.Attributes; | ||
using EvoSC.Modules.Official.TeamSettingsModule.Interfaces; | ||
|
||
namespace EvoSC.Modules.Official.TeamSettingsModule.Controllers; | ||
|
||
[Controller] | ||
public class TeamSettingsCommandsController(ITeamSettingsService teamSettingsService) : EvoScController<ICommandInteractionContext> | ||
{ | ||
[ChatCommand("teams", "[Command.TeamSettings]")] | ||
public async Task EditTeamSettingsAsync() | ||
{ | ||
await teamSettingsService.ShowTeamSettingsAsync(Context.Player, await teamSettingsService.GetCurrentTeamSettingsModel()); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/Modules/TeamSettingsModule/Controllers/TeamSettingsManialinkController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using EvoSC.Common.Controllers.Attributes; | ||
using EvoSC.Common.Interfaces.Localization; | ||
using EvoSC.Manialinks; | ||
using EvoSC.Modules.Official.TeamSettingsModule.Interfaces; | ||
using EvoSC.Modules.Official.TeamSettingsModule.Models; | ||
|
||
namespace EvoSC.Modules.Official.TeamSettingsModule.Controllers; | ||
|
||
[Controller] | ||
public class TeamSettingsManialinkController(ITeamSettingsService teamSettingsService, Locale locale) : ManialinkController | ||
{ | ||
public async Task SaveTeamSettingsAsync(TeamSettingsModel input) | ||
{ | ||
if (!IsModelValid) | ||
{ | ||
await ShowAsync(Context.Player, "TeamSettingsModule.EditTeamSettings", | ||
new { Settings = input, Locale = locale } | ||
); | ||
return; | ||
} | ||
|
||
await teamSettingsService.SetTeamSettingsAsync(input); | ||
await teamSettingsService.HideTeamSettingsAsync(Context.Player); | ||
|
||
Context.AuditEvent | ||
.Success() | ||
.WithEventName("EditTeamSettings") | ||
.HavingProperties(new { TeamSettings = input }); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Modules/TeamSettingsModule/DataAnnotations/ColorCode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace EvoSC.Modules.Official.TeamSettingsModule.DataAnnotations; | ||
|
||
public partial class ColorCode : ValidationAttribute | ||
{ | ||
public override bool IsValid(object? value) | ||
{ | ||
var colorCode = value?.ToString() ?? ""; | ||
|
||
return ValidColorCodeRegex().IsMatch(colorCode); | ||
} | ||
|
||
[GeneratedRegex("^(?:[0-9a-fA-F]{3}){1,2}$")] | ||
private static partial Regex ValidColorCodeRegex(); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/Modules/TeamSettingsModule/DataAnnotations/NullableColorCode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace EvoSC.Modules.Official.TeamSettingsModule.DataAnnotations; | ||
|
||
public class NullableColorCode : ColorCode | ||
{ | ||
public override bool IsValid(object? value) | ||
{ | ||
return value?.ToString()?.Length == 0 || base.IsValid(value); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Modules/TeamSettingsModule/DataAnnotations/NullableUrl.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace EvoSC.Modules.Official.TeamSettingsModule.DataAnnotations; | ||
|
||
public class NullableUrl : ValidationAttribute | ||
{ | ||
public override bool IsValid(object? value) | ||
{ | ||
string url = value?.ToString()?.Trim() ?? ""; | ||
|
||
return url.Length == 0 || Uri.IsWellFormedUriString(url, UriKind.Absolute); | ||
} | ||
} |
Oops, something went wrong.