1
0
mirror of synced 2024-11-24 06:50:15 +01:00
TaikoLocalServer/TaikoWebUI/Pages/Profile.razor.cs

87 lines
2.9 KiB
C#
Raw Normal View History

2022-09-14 20:17:46 +02:00
using MudBlazor.Utilities;
2022-09-14 23:20:55 +02:00
using static MudBlazor.Colors;
2022-09-14 20:17:46 +02:00
namespace TaikoWebUI.Pages;
2022-09-11 18:28:12 +02:00
public partial class Profile
{
[Parameter]
public int Baid { get; set; }
private UserSetting? response;
private bool isSavingOptions;
2022-09-14 20:17:46 +02:00
public string[] costumeColors =
2022-09-14 16:26:06 +02:00
{
2022-09-14 20:17:46 +02:00
"#F84828", "#68C0C0", "#DC1500", "#F8F0E0", "#009687", "#00BF87",
"#00FF9A", "#66FFC2", "#FFFFFF", "#690000", "#FF0000", "#FF6666",
"#FFB3B3", "#00BCC2", "#00F7FF", "#66FAFF", "#B3FDFF", "#E4E4E4",
"#993800", "#FF5E00", "#FF9E78", "#FFCFB3", "#005199", "#0088FF",
"#66B8FF", "#B3DBFF", "#B9B9B9", "#B37700", "#FFAA00", "#FFCC66",
"#FFE2B3", "#000C80", "#0019FF", "#6675FF", "#B3BAFF", "#858585",
2022-09-14 22:13:06 +02:00
"#B39B00", "#FFDD00", "#FFFF00", "#FFFF71", "#2B0080", "#5500FF",
"#9966FF", "#CCB3FF", "#505050", "#38A100", "#78C900", "#B3FF00",
"#DCFF8A", "#610080", "#C400FF", "#DC66FF", "#EDB3FF", "#232323",
"#006600", "#00B800", "#00FF00", "#8AFF9E", "#990059", "#FF0095",
"#FF66BF", "#FFB3DF", "#000000"
2022-09-14 16:26:06 +02:00
};
2022-09-11 18:28:12 +02:00
private readonly string[] speedStrings =
{
"1.0", "1.1", "1.2", "1.3", "1.4",
"1.5", "1.6", "1.7", "1.8", "1.9",
"2.0", "2.5", "3.0", "3.5", "4.0"
};
private readonly string[] notePositionStrings = { "-5", "-4", "-3", "-2", "-1", "0", "+1", "+2", "+3", "+4", "+5" };
private readonly string[] toneStrings =
{
"Taiko", "Festival", "Dogs & Cats", "Deluxe",
"Drumset", "Tambourine", "Don Wada", "Clapping",
"Conga", "8-Bit", "Heave-ho", "Mecha",
"Bujain", "Rap", "Hosogai", "Akemi",
"Synth Drum", "Shuriken", "Bubble Pop", "Electric Guitar"
};
private readonly string[] titlePlateStrings =
{
"Wood", "Rainbow", "Gold", "Purple",
"AI 1", "AI 2", "AI 3", "AI 4"
};
private List<BreadcrumbItem> breadcrumbs = new()
{
new BreadcrumbItem("Cards", href: "/Cards"),
};
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
isSavingOptions = false;
response = await Client.GetFromJsonAsync<UserSetting>($"api/UserSettings/{Baid}");
breadcrumbs.Add(new BreadcrumbItem($"Card: {Baid}", href: null, disabled: true));
breadcrumbs.Add(new BreadcrumbItem("Profile", href: $"/Cards/{Baid}/Profile", disabled: false));
}
private async Task SaveOptions()
{
isSavingOptions = true;
await Client.PostAsJsonAsync($"api/UserSettings/{Baid}", response);
isSavingOptions = false;
}
2022-09-14 23:20:55 +02:00
private async Task<IEnumerable<string>> SearchForTitle(string value)
{
var titles = GameDataService.titleMap;
if (string.IsNullOrWhiteSpace(value))
{
return titles.Values;
}
return titles.Values.Where(x => x.Contains(value, StringComparison.OrdinalIgnoreCase));
}
2022-09-11 18:28:12 +02:00
}