1
0
mirror of synced 2024-11-23 22:41:01 +01:00

Add Challenge/Competition Localization Resources

This commit is contained in:
ptmaster 2024-09-16 23:47:48 +08:00
parent fd899dc648
commit 984361dcbb
12 changed files with 638 additions and 18 deletions

View File

@ -8,4 +8,6 @@ public class SongInfo
public Difficulty Difficulty { get; set; } = new();
public int Level { get; set; } = 0;
}

View File

@ -8,14 +8,17 @@
<CardHeaderContent>
@if (ChallengeCompetition.CompeteMode == CompeteModeType.Chanllenge)
{
@if (ChallengeCompetition?.Baid != Baid)
if (Baid == 0)
{
<MudText Typo="Typo.h6" Style="font-weight:bold;word-break:break-all">@Localizer["From"] @ChallengeCompetition?.Holder?.MyDonName</MudText>
<MudText Typo="Typo.h6" Style="font-weight:bold;word-break:break-all">@formatChallengeTitle(Localizer["FullChallengeTitle"])</MudText>
}
else if (ChallengeCompetition?.Baid != Baid)
{
<MudText Typo="Typo.h6" Style="font-weight:bold;word-break:break-all">@formatChallengeTitle(Localizer["ReceiverChallengeTitle"])</MudText>
}
else
{
var participant = ChallengeCompetition?.Participants?.Find(p => p.Baid != Baid);
<MudText Typo="Typo.h6" Style="font-weight:bold;word-break:break-all">@Localizer["To"] @participant?.UserInfo?.MyDonName</MudText>
<MudText Typo="Typo.h6" Style="font-weight:bold;word-break:break-all">@formatChallengeTitle(Localizer["CreatorChallengeTitle"])</MudText>
}
}
else
@ -86,13 +89,16 @@
{
if (ChallengeCompetition.MaxParticipant <= ChallengeCompetition.Participants.Count)
{
<MudText Typo="Typo.body1" Style="padding: 6px 8px 6px 8px;" Color="Color.Warning">@Localizer["Fullfilled"]</MudText>
<MudText Typo="Typo.body1" Style="padding: 6px 8px 6px 8px;" Color="Color.Warning">@Localizer["Fulfilled"]</MudText>
}
else
{
<MudButton OnClick="AnswerCompete" Color="Color.Success" Variant="Variant.Filled">@Localizer["Participate"]</MudButton>
}
}
} else
{
<MudText Typo="Typo.body1" Style="padding: 6px 8px 6px 8px;" Color="@((ChallengeCompetition.Participants.Count < ChallengeCompetition.MaxParticipant) ? Color.Primary : Color.Warning)">@ChallengeCompetition.Participants.Count / @ChallengeCompetition.MaxParticipant</MudText>
}
}
</MudStack>
@ -125,6 +131,13 @@
return ChallengeCompetition?.CreateTime < DateTime.Now && DateTime.Now < ChallengeCompetition?.ExpireTime && !ParticipatedChallengeCompetition();
}
private string formatChallengeTitle(string template)
{
return template
.Replace("{From}", ChallengeCompetition?.Holder?.MyDonName)
.Replace("{To}", ChallengeCompetition?.Participants?.Find(p => p.Baid != ChallengeCompetition?.Baid)?.UserInfo?.MyDonName);
}
private async Task AnswerChallenge(bool accept)
{
if (ChallengeCompetition == null || ChallengeCompetition.State != CompeteState.Waiting) return;

View File

@ -33,7 +33,7 @@
}
else if (Mode == 3 && Baid == 0)
{
<MudButton Variant="Variant.Filled" Size="Size.Large" StartIcon="@Icons.Material.Filled.Add" Color="Color.Tertiary" OnClick=@(_ => OpenDialogAsync(3, 3)) Style="width: 80px">@Localizer["Add"]</MudButton>
<MudButton Variant="Variant.Filled" Size="Size.Large" StartIcon="@Icons.Material.Filled.Add" Color="Color.Tertiary" OnClick=@(_ => OpenDialogAsync(3, 5, 365, 100)) Style="width: 80px">@Localizer["Add"]</MudButton>
}
</MudStack>
</div>
@ -191,12 +191,14 @@
await Debounce(GetUsersData, 500); // 500 milliseconds delay
}
private async Task OpenDialogAsync(int mode, int maxSongs)
private async Task OpenDialogAsync(int mode, int maxSongs, int maxDays = 30, int maxParticipant = 20)
{
var options = new DialogOptions { CloseOnEscapeKey = true };
var parameters = new DialogParameters();
parameters.Add("Mode", mode);
parameters.Add("MaxSongs", maxSongs);
parameters.Add("MaxDays", maxDays);
parameters.Add("MaxParticipant", maxParticipant);
parameters.Add("Baid", Baid);
var dialogRet = await DialogService.ShowAsync<AddChallengeCompetitionDialog>(Localizer["Create"], parameters, options);

View File

@ -39,7 +39,7 @@
</MudMenuItem>
<MudDivider />
<MudMenuItem Icon="@Icons.Material.Filled.FeaturedPlayList"
Href="@($"Users/{User.Baid}/AccessCode")"
Href="@($"Users/{User?.Baid}/AccessCode")"
IconColor="@Color.Primary">
@Localizer["Access Codes"]
</MudMenuItem>
@ -73,15 +73,15 @@
</MudMenuItem>
<MudDivider />
}
<MudNavLink Href="@($"ChallengeCompe/{User.Baid}/Challenge")" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.People" IconColor="Color.Warning">
<MudNavLink Href="@($"ChallengeCompe/{User?.Baid}/Challenge")" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.People" IconColor="Color.Warning">
<span style="padding-left: 20px;">@Localizer["Challenge"]</span>
</MudNavLink>
<MudDivider />
<MudNavLink Href="@($"ChallengeCompe/{User.Baid}/Competition")" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.WorkspacePremium" IconColor="Color.Warning">
<MudNavLink Href="@($"ChallengeCompe/{User?.Baid}/Competition")" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.WorkspacePremium" IconColor="Color.Warning">
<span style="padding-left: 20px;">@Localizer["Competition"]</span>
</MudNavLink>
<MudDivider />
<MudNavLink Href="@($"ChallengeCompe/{User.Baid}/OfficialCompetition")" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.EmojiEvents" IconColor="Color.Warning">
<MudNavLink Href="@($"ChallengeCompe/{User?.Baid}/OfficialCompetition")" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.EmojiEvents" IconColor="Color.Warning">
<span style="padding-left: 20px;">@Localizer["Official Competition"]</span>
</MudNavLink>
<MudDivider />

View File

@ -177,6 +177,15 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Accepted {
get {
return ResourceManager.GetString("Accepted", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -348,6 +357,15 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Any {
get {
return ResourceManager.GetString("Any", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -429,6 +447,15 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Challenge_Target {
get {
return ResourceManager.GetString("Challenge Target", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -600,6 +627,51 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Create {
get {
return ResourceManager.GetString("Create", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Create_Challenge {
get {
return ResourceManager.GetString("Create Challenge", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Create_Competition {
get {
return ResourceManager.GetString("Create Competition", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Create_Official_Competition {
get {
return ResourceManager.GetString("Create Official Competition", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string CreatorChallengeTitle {
get {
return ResourceManager.GetString("CreatorChallengeTitle", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -924,6 +996,24 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Fulfilled {
get {
return ResourceManager.GetString("Fulfilled", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string FullChallengeTitle {
get {
return ResourceManager.GetString("FullChallengeTitle", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -1131,6 +1221,15 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Last_For__Days_ {
get {
return ResourceManager.GetString("Last For (Days)", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -1257,6 +1356,15 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Max_Participant {
get {
return ResourceManager.GetString("Max Participant", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -1338,6 +1446,15 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string No_Select {
get {
return ResourceManager.GetString("No Select", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -1410,6 +1527,15 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Off {
get {
return ResourceManager.GetString("Off", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -1437,6 +1563,15 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string On {
get {
return ResourceManager.GetString("On", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -1446,6 +1581,15 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Only_Play_Once {
get {
return ResourceManager.GetString("Only Play Once", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -1464,6 +1608,15 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Participated {
get {
return ResourceManager.GetString("Participated", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -1599,6 +1752,15 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string ReceiverChallengeTitle {
get {
return ResourceManager.GetString("ReceiverChallengeTitle", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -1689,6 +1851,15 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Rejected {
get {
return ResourceManager.GetString("Rejected", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -1842,6 +2013,24 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Select_Song {
get {
return ResourceManager.GetString("Select Song", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Select_User {
get {
return ResourceManager.GetString("Select User", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
@ -1914,6 +2103,15 @@ namespace TaikoWebUI.Localization {
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>
internal static string Song {
get {
return ResourceManager.GetString("Song", resourceCulture);
}
}
/// <summary>
/// 查找类似 的本地化字符串。
/// </summary>

View File

@ -864,4 +864,70 @@
<data name="Challenge Competition Data" xml:space="preserve">
<value>Challenge Competition Data</value>
</data>
<data name="Accepted" xml:space="preserve">
<value>Accepted</value>
</data>
<data name="Rejected" xml:space="preserve">
<value>Rejected</value>
</data>
<data name="Challenge Target" xml:space="preserve">
<value>Challenge User</value>
</data>
<data name="Last For (Days)" xml:space="preserve">
<value>Duration (days)</value>
</data>
<data name="Song" xml:space="preserve">
<value>Song</value>
</data>
<data name="Only Play Once" xml:space="preserve">
<value>Only Play Once</value>
</data>
<data name="Fulfilled" xml:space="preserve">
<value>Limit Reached</value>
</data>
<data name="Participated" xml:space="preserve">
<value>Participated</value>
</data>
<data name="FullChallengeTitle" xml:space="preserve">
<value>Challenge from {From} to {To}</value>
</data>
<data name="ReceiverChallengeTitle" xml:space="preserve">
<value>Challenge from {From}</value>
</data>
<data name="CreatorChallengeTitle" xml:space="preserve">
<value>Challenge to {To}</value>
</data>
<data name="Create Challenge" xml:space="preserve">
<value>Create Challenge</value>
</data>
<data name="Create Competition" xml:space="preserve">
<value>Create Competition</value>
</data>
<data name="Create Official Competition" xml:space="preserve">
<value>Create Official Competition</value>
</data>
<data name="Create" xml:space="preserve">
<value>Create</value>
</data>
<data name="No Select" xml:space="preserve">
<value>No Selected Song</value>
</data>
<data name="Max Participant" xml:space="preserve">
<value>Max Participant</value>
</data>
<data name="Select Song" xml:space="preserve">
<value>Select a Song with Difficulty</value>
</data>
<data name="Select User" xml:space="preserve">
<value>Select Challenge Target User</value>
</data>
<data name="Any" xml:space="preserve">
<value>Any</value>
</data>
<data name="On" xml:space="preserve">
<value>On</value>
</data>
<data name="Off" xml:space="preserve">
<value>Off</value>
</data>
</root>

View File

@ -864,4 +864,70 @@
<data name="Challenge Competition Data" xml:space="preserve">
<value>Données de compétition de défi</value>
</data>
<data name="Accepted" xml:space="preserve">
<value>Accepté</value>
</data>
<data name="Rejected" xml:space="preserve">
<value>Rejeté</value>
</data>
<data name="Challenge Target" xml:space="preserve">
<value>Objet de défi</value>
</data>
<data name="Last For (Days)" xml:space="preserve">
<value>Durée (jours)</value>
</data>
<data name="Song" xml:space="preserve">
<value>Chanson</value>
</data>
<data name="Only Play Once" xml:space="preserve">
<value>Jouer une seule fois</value>
</data>
<data name="Fulfilled" xml:space="preserve">
<value>Limite atteinte</value>
</data>
<data name="Participated" xml:space="preserve">
<value>Déjà participé</value>
</data>
<data name="FullChallengeTitle" xml:space="preserve">
<value>Défi de {From} à {To}</value>
</data>
<data name="ReceiverChallengeTitle" xml:space="preserve">
<value>Défi de {From}</value>
</data>
<data name="CreatorChallengeTitle" xml:space="preserve">
<value>Défi à {To}</value>
</data>
<data name="Create Challenge" xml:space="preserve">
<value>Créer un défi</value>
</data>
<data name="Create Competition" xml:space="preserve">
<value>Créer une compétition</value>
</data>
<data name="Create Official Competition" xml:space="preserve">
<value>Créer une compétition officielle</value>
</data>
<data name="Create" xml:space="preserve">
<value>Créer</value>
</data>
<data name="No Select" xml:space="preserve">
<value>Aucune chanson sélectionnée</value>
</data>
<data name="Max Participant" xml:space="preserve">
<value>Nombre maximal de participants</value>
</data>
<data name="Select Song" xml:space="preserve">
<value>Sélectionnez une chanson avec difficulté</value>
</data>
<data name="Select User" xml:space="preserve">
<value>Sélectionnez l'utilisateur cible du défi</value>
</data>
<data name="Any" xml:space="preserve">
<value>N'importe lequel</value>
</data>
<data name="On" xml:space="preserve">
<value>allumer</value>
</data>
<data name="Off" xml:space="preserve">
<value>fermeture</value>
</data>
</root>

View File

@ -864,4 +864,70 @@
<data name="Challenge Competition Data" xml:space="preserve">
<value>挑戦と大会</value>
</data>
<data name="Accepted" xml:space="preserve">
<value>受け入れられました</value>
</data>
<data name="Rejected" xml:space="preserve">
<value>拒否されました</value>
</data>
<data name="Challenge Target" xml:space="preserve">
<value>挑戦対象</value>
</data>
<data name="Last For (Days)" xml:space="preserve">
<value>期間 (日)</value>
</data>
<data name="Song" xml:space="preserve">
<value>曲</value>
</data>
<data name="Only Play Once" xml:space="preserve">
<value>一度だけプレイ</value>
</data>
<data name="Fulfilled" xml:space="preserve">
<value>すでに満席</value>
</data>
<data name="Participated" xml:space="preserve">
<value>参加済み</value>
</data>
<data name="FullChallengeTitle" xml:space="preserve">
<value>{From} から {To} への挑戦状</value>
</data>
<data name="ReceiverChallengeTitle" xml:space="preserve">
<value>{From} からの挑戦状</value>
</data>
<data name="CreatorChallengeTitle" xml:space="preserve">
<value>{To} への挑戦状</value>
</data>
<data name="Create Challenge" xml:space="preserve">
<value>挑戦状を作成する</value>
</data>
<data name="Create Competition" xml:space="preserve">
<value>大会を作成する</value>
</data>
<data name="Create Official Competition" xml:space="preserve">
<value>公式大会を作成する</value>
</data>
<data name="Create" xml:space="preserve">
<value>作成する</value>
</data>
<data name="No Select" xml:space="preserve">
<value>曲が選択されていません</value>
</data>
<data name="Max Participant" xml:space="preserve">
<value>最大参加者数</value>
</data>
<data name="Select Song" xml:space="preserve">
<value>難しいと曲を選ぶ</value>
</data>
<data name="Select User" xml:space="preserve">
<value>挑戦対象を選択</value>
</data>
<data name="Any" xml:space="preserve">
<value>指定しない</value>
</data>
<data name="On" xml:space="preserve">
<value>オン</value>
</data>
<data name="Off" xml:space="preserve">
<value>オフ</value>
</data>
</root>

View File

@ -864,4 +864,70 @@
<data name="Challenge Competition Data" xml:space="preserve">
<value />
</data>
<data name="Accepted" xml:space="preserve">
<value />
</data>
<data name="Rejected" xml:space="preserve">
<value />
</data>
<data name="Challenge Target" xml:space="preserve">
<value />
</data>
<data name="Last For (Days)" xml:space="preserve">
<value />
</data>
<data name="Song" xml:space="preserve">
<value />
</data>
<data name="Only Play Once" xml:space="preserve">
<value />
</data>
<data name="Fulfilled" xml:space="preserve">
<value />
</data>
<data name="Participated" xml:space="preserve">
<value />
</data>
<data name="FullChallengeTitle" xml:space="preserve">
<value />
</data>
<data name="ReceiverChallengeTitle" xml:space="preserve">
<value />
</data>
<data name="CreatorChallengeTitle" xml:space="preserve">
<value />
</data>
<data name="Create Challenge" xml:space="preserve">
<value />
</data>
<data name="Create Competition" xml:space="preserve">
<value />
</data>
<data name="Create Official Competition" xml:space="preserve">
<value />
</data>
<data name="Create" xml:space="preserve">
<value />
</data>
<data name="No Select" xml:space="preserve">
<value />
</data>
<data name="Max Participant" xml:space="preserve">
<value />
</data>
<data name="Select Song" xml:space="preserve">
<value />
</data>
<data name="Select User" xml:space="preserve">
<value />
</data>
<data name="Any" xml:space="preserve">
<value />
</data>
<data name="On" xml:space="preserve">
<value />
</data>
<data name="Off" xml:space="preserve">
<value />
</data>
</root>

View File

@ -864,4 +864,70 @@
<data name="Challenge Competition Data" xml:space="preserve">
<value>挑战与大赛</value>
</data>
<data name="Accepted" xml:space="preserve">
<value>已接受</value>
</data>
<data name="Rejected" xml:space="preserve">
<value>已拒绝</value>
</data>
<data name="Challenge Target" xml:space="preserve">
<value>挑战对象</value>
</data>
<data name="Last For (Days)" xml:space="preserve">
<value>持续时间(天)</value>
</data>
<data name="Song" xml:space="preserve">
<value>歌曲</value>
</data>
<data name="Only Play Once" xml:space="preserve">
<value>单次挑战</value>
</data>
<data name="Fulfilled" xml:space="preserve">
<value>已满员</value>
</data>
<data name="Participated" xml:space="preserve">
<value>已参加</value>
</data>
<data name="FullChallengeTitle" xml:space="preserve">
<value>{From} 向 {To} 发起的挑战书</value>
</data>
<data name="ReceiverChallengeTitle" xml:space="preserve">
<value>来自 {From} 的挑战书</value>
</data>
<data name="CreatorChallengeTitle" xml:space="preserve">
<value>向 {To} 发起的挑战书</value>
</data>
<data name="Create Challenge" xml:space="preserve">
<value>发起挑战</value>
</data>
<data name="Create Competition" xml:space="preserve">
<value>创建大赛</value>
</data>
<data name="Create Official Competition" xml:space="preserve">
<value>创建官方大赛</value>
</data>
<data name="Create" xml:space="preserve">
<value>创建</value>
</data>
<data name="No Select" xml:space="preserve">
<value>无歌曲</value>
</data>
<data name="Max Participant" xml:space="preserve">
<value>最大参与人数</value>
</data>
<data name="Select Song" xml:space="preserve">
<value>请选择歌曲与难度</value>
</data>
<data name="Select User" xml:space="preserve">
<value>请选择挑战的对象</value>
</data>
<data name="Any" xml:space="preserve">
<value>任意</value>
</data>
<data name="On" xml:space="preserve">
<value>开启</value>
</data>
<data name="Off" xml:space="preserve">
<value>关闭</value>
</data>
</root>

View File

@ -864,4 +864,70 @@
<data name="Challenge Competition Data" xml:space="preserve">
<value>挑戰與大赛</value>
</data>
<data name="Accepted" xml:space="preserve">
<value>已接受</value>
</data>
<data name="Rejected" xml:space="preserve">
<value>已拒絕</value>
</data>
<data name="Challenge Target" xml:space="preserve">
<value>挑戰對象</value>
</data>
<data name="Last For (Days)" xml:space="preserve">
<value>持續時間(天)</value>
</data>
<data name="Song" xml:space="preserve">
<value>歌曲</value>
</data>
<data name="Only Play Once" xml:space="preserve">
<value>單次挑戰</value>
</data>
<data name="Fulfilled" xml:space="preserve">
<value>已滿員</value>
</data>
<data name="Participated" xml:space="preserve">
<value>已參加</value>
</data>
<data name="FullChallengeTitle" xml:space="preserve">
<value>{From} 向 {To} 發起的挑戰書</value>
</data>
<data name="ReceiverChallengeTitle" xml:space="preserve">
<value>來自 {From} 的挑戰書</value>
</data>
<data name="CreatorChallengeTitle" xml:space="preserve">
<value>向 {To} 發起的挑戰書</value>
</data>
<data name="Create Challenge" xml:space="preserve">
<value>發起挑戰</value>
</data>
<data name="Create Competition" xml:space="preserve">
<value>創建大賽</value>
</data>
<data name="Create Official Competition" xml:space="preserve">
<value>創建官方大賽</value>
</data>
<data name="Create" xml:space="preserve">
<value>創建</value>
</data>
<data name="No Select" xml:space="preserve">
<value>未選擇歌曲</value>
</data>
<data name="Max Participant" xml:space="preserve">
<value>最大參與人數</value>
</data>
<data name="Select Song" xml:space="preserve">
<value>請選擇歌曲與難度</value>
</data>
<data name="Select User" xml:space="preserve">
<value>請選擇挑戰的對象</value>
</data>
<data name="Any" xml:space="preserve">
<value>任意</value>
</data>
<data name="On" xml:space="preserve">
<value>開啟</value>
</data>
<data name="Off" xml:space="preserve">
<value>關閉</value>
</data>
</root>

View File

@ -34,13 +34,13 @@
<MudStack>
@if (Mode == 2 || Mode == 3)
{
<MudTextField @bind-Value="Info.Name" Label="@Localizer["Name"]" MaxLength="16"/>
<MudTextField ShrinkLabel @bind-Value="Info.Name" Label="@Localizer["Name"]" Counter="20" MaxLength="20" />
}
<MudTextField @bind-Value="Info.Desc" Label="@((Mode == 1 ? Localizer["Challenge"] : "") + Localizer["Describe"])" />
@if (Mode == 1)
{
<MudStack Row="true">
<MudTextField @bind-Value="TargetUserName" Label="@Localizer["Challenge Target"]"/>
<MudTextField ShrinkLabel @bind-Value="TargetUserName" Label="@Localizer["Challenge Target"]" />
<MudButton StartIcon="@Icons.Material.Filled.EmojiPeople" OnClick="@(_ => SelTarget())">@Localizer["Select"]</MudButton>
</MudStack>
}
@ -60,6 +60,7 @@
<MudImage Src="@ScoreUtils.GetDifficultyIcon(difficulty)" Alt="@ScoreUtils.GetDifficultyTitle(difficulty)" Width="24" Height="48" Style="padding: 12px 0px 12px 0px; margin-right: 8px; vertical-align: middle;" />
}
<span style="vertical-align: middle; font-family: Nijiiro, sans-serif;">@(musicDetails[song_idx].SongId == 0 ? Localizer["No Select"] : musicDetails[song_idx].SongName)</span>
<MudButton StartIcon="@Icons.Material.Filled.Star" OnClick="@(_ => SelSong(song_idx))">@levels[song_idx]</MudButton>
</MudField>
<MudIconButton Icon="@Icons.Material.Filled.Settings" Variant="Variant.Text" Color="Color.Primary" OnClick="(_ => OnExpandCollapseClick(song_idx))" />
@ -107,9 +108,9 @@
}
@if (Mode != 1)
{
<MudNumericField HideSpinButtons="true" @bind-Value="ParticipantCount" Label="@Localizer["Max Participant"]" Variant="Variant.Text" Min="1" Max="MaxParticipant" />
<MudNumericField HideSpinButtons="true" @bind-Value="ParticipantCount" Label="@(Localizer["Max Participant"] + $"[2-{MaxParticipant}]")" Variant="Variant.Text" Min="2" Max="MaxParticipant" />
}
<MudNumericField HideSpinButtons="true" @bind-Value="LastFor" Label="@Localizer["Last For (Days)"]" Variant="Variant.Text" Min="1" Max="MaxDays" />
<MudNumericField HideSpinButtons="true" @bind-Value="LastFor" Label="@(Localizer["Last For (Days)"] + $"[1-{MaxDays}]")" Variant="Variant.Text" Min="1" Max="MaxDays" />
<MudSwitch @bind-Value="OnlyPlayOnce" Color="Color.Primary">@Localizer["Only Play Once"]</MudSwitch>
</MudStack>
</DialogContent>
@ -158,9 +159,11 @@
private Difficulty[] difficulties = new Difficulty[0];
private int LastFor = 1;
private int[] levels = new int[0];
private int ParticipantCount = 1;
private int LastFor = 7;
private int ParticipantCount = 5;
private bool OnlyPlayOnce = false;
@ -170,10 +173,12 @@
_expandeds = new bool[MaxSongs];
musicDetails = new MusicDetail[MaxSongs];
difficulties = new Difficulty[MaxSongs];
levels = new int[MaxSongs];
for (int i = 0; i < MaxSongs; i++)
{
musicDetails[i] = new();
difficulties[i] = Difficulty.None;
levels[i] = 0;
}
Info.challengeCompeteSongs.Add(new());
}
@ -189,7 +194,7 @@
var parameters = new DialogParameters();
parameters.Add("SelectedSong", musicDetails[i]);
var reference = await DialogService.ShowAsync<ChooseSongDialog>(Localizer["Create"], parameters, options);
var reference = await DialogService.ShowAsync<ChooseSongDialog>(Localizer["Select Song"], parameters, options);
if (reference != null)
{
var songInfo = await reference.GetReturnValueAsync<SongInfo>();
@ -198,6 +203,7 @@
{
musicDetails[i] = songInfo.MusicDetail;
difficulties[i] = songInfo.Difficulty;
levels[i] = songInfo.Level;
}
}
}
@ -212,12 +218,14 @@
_expandeds[ex] = _expandeds[ex + 1];
musicDetails[ex] = musicDetails[ex + 1];
difficulties[ex] = difficulties[ex + 1];
levels[ex] = levels[ex + 1];
}
else
{
_expandeds[ex] = false;
musicDetails[ex] = new();
difficulties[ex] = Difficulty.None;
levels[ex] = 0;
}
}
}
@ -262,6 +270,7 @@
if (Mode == 1)
{
Info.MaxParticipant = 2;
if (TargetBaid == 0)
{
await ShowError(Localizer["Must Select Challenge Target Error"]);