1
0
mirror of synced 2024-11-15 02:47:35 +01:00
TaikoLocalServer/TaikoWebUI/Pages/Profile.razor

177 lines
7.3 KiB
Plaintext
Raw Normal View History

@page "/Cards/{baid:int}/Profile"
@using SharedProject.Enums
@using SharedProject.Models
@inject HttpClient Client
2022-09-05 06:52:29 +02:00
2022-09-06 16:32:36 +02:00
<MudBreadcrumbs Items="breadcrumbs" Class="px-0"></MudBreadcrumbs>
2022-09-05 23:42:13 +02:00
<h1>Profile</h1>
<MudText Typo="Typo.caption">Card: @Baid</MudText>
2022-09-05 06:52:29 +02:00
@if (response is not null)
{
2022-09-05 22:44:19 +02:00
<MudGrid>
<MudItem xs="12" md="8">
2022-09-05 23:00:41 +02:00
<MudPaper Class="py-8 px-8 my-8" Outlined="true">
2022-09-07 04:38:42 +02:00
<MudStack Spacing="4">
2022-09-05 23:00:41 +02:00
<h2>Profile Options</h2>
2022-09-05 22:44:19 +02:00
2022-09-07 04:38:42 +02:00
<MudTextField @bind-Value="@response.MyDonName" Label="Name"></MudTextField>
<MudGrid>
2022-09-07 04:38:42 +02:00
<MudItem xs="12" md="8">
<MudTextField @bind-Value="@response.Title" Label="Title"></MudTextField>
</MudItem>
2022-09-07 04:38:42 +02:00
<MudItem xs="12" md="4">
<MudSelect @bind-Value="@response.TitlePlateId" Label="Title Plate">
@for (uint i = 0; i < 8; i++)
2022-09-07 18:42:10 +02:00
{
var index = i;
<MudSelectItem Value="@i">@titlePlateStrings[index]</MudSelectItem>
}
2022-09-07 04:38:42 +02:00
</MudSelect>
</MudItem>
</MudGrid>
2022-09-07 18:42:10 +02:00
2022-09-07 04:38:42 +02:00
<MudSelect @bind-Value="@response.AchievementDisplayDifficulty"
2022-09-07 18:42:10 +02:00
Label="Achievement Panel Difficulty">
2022-09-07 04:38:42 +02:00
@foreach (var item in Enum.GetValues<Difficulty>())
{
2022-09-07 18:42:10 +02:00
<MudSelectItem Value="@item"/>
2022-09-07 04:38:42 +02:00
}
</MudSelect>
2022-09-07 18:42:10 +02:00
<MudSwitch @bind-Checked="@response.IsDisplayAchievement" Label="Display Achievement Panel" Color="Color.Primary"/>
<MudSwitch @bind-Checked="@response.IsDisplayDanOnNamePlate" Label="Display Dan Rank on Name Plate" Color="Color.Primary"/>
2022-09-05 22:44:19 +02:00
</MudStack>
</MudPaper>
2022-09-05 23:00:41 +02:00
<MudPaper Class="py-8 px-8 my-8" Outlined="true">
2022-09-07 04:38:42 +02:00
<MudStack Spacing="4">
2022-09-05 23:00:41 +02:00
<h2>Song Options</h2>
<MudGrid>
<MudItem xs="12" md="4">
2022-09-07 04:38:42 +02:00
<MudStack Spacing="4">
2022-09-06 16:32:36 +02:00
<MudSwitch @bind-Checked="@response.PlaySetting.IsVanishOn" Label="Vanish" Color="Color.Primary"/>
<MudSwitch @bind-Checked="@response.PlaySetting.IsInverseOn" Label="Inverse" Color="Color.Primary"/>
<MudSwitch @bind-Checked="@response.IsSkipOn" Label="Give Up" Color="Color.Primary"/>
<MudSwitch @bind-Checked="@response.IsVoiceOn" Label="Voice" Color="Color.Primary"/>
2022-09-05 23:00:41 +02:00
</MudStack>
</MudItem>
<MudItem xs="12" md="8">
2022-09-07 04:38:42 +02:00
<MudStack Spacing="4">
2022-09-05 23:00:41 +02:00
<MudSelect @bind-Value="@response.PlaySetting.Speed" Label="Speed">
@for (uint i = 0; i < 15; i++)
{
var index = i;
<MudSelectItem Value="@i">@speedStrings[index]</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.PlaySetting.RandomType"
2022-09-06 16:32:36 +02:00
Label="Random">
2022-09-05 23:00:41 +02:00
@foreach (var item in Enum.GetValues<RandomType>())
{
2022-09-06 16:32:36 +02:00
<MudSelectItem Value="@item"/>
2022-09-05 23:00:41 +02:00
}
</MudSelect>
2022-09-07 00:44:06 +02:00
<MudSelect @bind-Value="@response.ToneId" Label="Tone">
@for (uint i = 0; i < 19; i++)
{
var index = i;
<MudSelectItem Value="@i">@toneStrings[index]</MudSelectItem>
}
</MudSelect>
2022-09-05 23:00:41 +02:00
<MudSlider Class="mb-8" @bind-Value="@response.NotesPosition" Size="Size.Medium" Min="-5" Max="5" Step="1" TickMarks="true" TickMarkLabels="@notePositionStrings">
<MudText Typo="Typo.caption">Notes Position</MudText>
</MudSlider>
</MudStack>
</MudItem>
</MudGrid>
</MudStack>
</MudPaper>
2022-09-05 22:44:19 +02:00
</MudItem>
<MudItem md="4" xs="12" Class="py-8 px-8 my-4 pt-8">
2022-09-07 04:38:42 +02:00
<MudStack Spacing="4" Style="top:100px" Class="sticky">
2022-09-05 22:44:19 +02:00
<MudButton Disabled="@isSavingOptions"
2022-09-06 16:32:36 +02:00
OnClick="SaveOptions"
Variant="Variant.Filled"
Color="Color.Primary">
2022-09-05 22:44:19 +02:00
@if (isSavingOptions)
{
2022-09-06 16:32:36 +02:00
<MudProgressCircular Class="ms-n1" Size="Size.Small" Indeterminate="true"/>
2022-09-05 22:44:19 +02:00
<MudText Class="ms-2">Saving...</MudText>
}
else
{
2022-09-05 23:00:41 +02:00
<MudIcon Icon="@Icons.Filled.Save" Class="mx-2"></MudIcon>
2022-09-05 22:44:19 +02:00
<MudText>Save</MudText>
}
</MudButton>
</MudStack>
</MudItem>
</MudGrid>
2022-09-05 23:42:13 +02:00
<MudScrollToTop>
2022-09-06 16:32:36 +02:00
<MudFab Color="Color.Secondary" Icon="@Icons.Filled.ArrowCircleUp"/>
2022-09-05 23:42:13 +02:00
</MudScrollToTop>
}
2022-09-05 06:52:29 +02:00
@code {
2022-09-05 06:52:29 +02:00
[Parameter]
public int Baid { get; set; }
private UserSetting? response;
private bool isSavingOptions;
2022-09-05 23:00:41 +02:00
2022-09-06 16:32:36 +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"
};
2022-09-06 16:32:36 +02:00
private readonly string[] notePositionStrings = { "-5", "-4", "-3", "-2", "-1", "0", "+1", "+2", "+3", "+4", "+5" };
2022-09-05 22:44:19 +02:00
2022-09-07 18:42:10 +02:00
private readonly string[] toneStrings =
{
2022-09-07 00:44:06 +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-07 18:42:10 +02:00
private readonly string[] titlePlateStrings =
{
2022-09-07 04:38:42 +02:00
"Wood", "Rainbow", "Gold", "Purple",
"AI 1", "AI 2", "AI 3", "AI 4"
};
2022-09-06 16:32:36 +02:00
private List<BreadcrumbItem> breadcrumbs = new()
2022-09-05 23:42:13 +02:00
{
new BreadcrumbItem("Cards", href: "/Cards"),
2022-09-05 23:42:13 +02:00
};
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
isSavingOptions = false;
response = await Client.GetFromJsonAsync<UserSetting>($"api/UserSettings/{Baid}");
2022-09-05 23:42:13 +02:00
2022-09-06 16:32:36 +02:00
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-06 16:32:36 +02:00
}
2022-09-05 06:52:29 +02:00
}