1
0
mirror of synced 2024-11-28 00:20:53 +01:00
TaikoLocalServer/TaikoWebUI/Pages/Profile.razor.cs

96 lines
3.2 KiB
C#
Raw Normal View History

2022-09-15 11:47:46 +02:00
using TaikoWebUI.Pages.Dialogs;
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-15 07:18:50 +02:00
private static readonly 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-15 07:18:50 +02:00
private static readonly string[] SpeedStrings =
2022-09-11 18:28:12 +02:00
{
"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"
};
2022-09-15 07:18:50 +02:00
private static readonly string[] NotePositionStrings = { "-5", "-4", "-3", "-2", "-1", "0", "+1", "+2", "+3", "+4", "+5" };
2022-09-11 18:28:12 +02:00
2022-09-15 07:18:50 +02:00
private static readonly string[] ToneStrings =
2022-09-11 18:28:12 +02:00
{
"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"
};
2022-09-15 07:18:50 +02:00
private static readonly string[] TitlePlateStrings =
2022-09-11 18:28:12 +02:00
{
"Wood", "Rainbow", "Gold", "Purple",
"AI 1", "AI 2", "AI 3", "AI 4"
};
2022-09-15 07:18:50 +02:00
private readonly List<BreadcrumbItem> breadcrumbs = new()
2022-09-11 18:28:12 +02:00
{
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
2022-09-15 11:47:46 +02:00
private async Task OpenChooseTitleDialog()
{
var options = new DialogOptions
{
2022-09-15 13:05:36 +02:00
//CloseButton = false,
2022-09-15 11:47:46 +02:00
CloseOnEscapeKey = false,
DisableBackdropClick = true,
2022-09-15 13:05:36 +02:00
MaxWidth = MaxWidth.Medium,
FullWidth = true
2022-09-15 11:47:46 +02:00
};
var parameters = new DialogParameters
{
["UserSetting"] = response
};
var dialog = DialogService.Show<ChooseTitleDialog>("Player Titles", parameters, options);
2022-09-15 11:47:46 +02:00
var result = await dialog.Result;
if (!result.Cancelled)
{
StateHasChanged();
}
2022-09-14 23:20:55 +02:00
}
2022-09-11 18:28:12 +02:00
}