@inject IDataService DataService
Title Id
Title Name
Unlock Condition Type
Unlock Requirement (Japanese)
Unlock Requirement (English)
@{
# pragma warning disable CS8602
}
@context.Id
@context.TitleName
@context.UnlockType
@context.UnlockRequirementJp
@context.UnlockRequirementEn
@{
# pragma warning restore CS8602
}
Selected Title: @selectedTitle?.TitleName
Cancel
Ok
@code{
[CascadingParameter]
public required MudDialogInstance MudDialog { get; set; }
[Parameter]
public required PlayOptionData Data { get; set; }
private Title? selectedTitle;
private IReadOnlyList
titles = new List();
private string searchString = string.Empty;
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
selectedTitle = DataService.GetTitleById((uint)Data.OptionPart1.TitleId);
titles = DataService.GetTitlesSortedById();
}
private bool Filter(Title? title)
{
if (title is null)
{
return false;
}
var aggregate = $"{title.TitleName}{title.UnlockRequirementEn}{title.UnlockRequirementJp}";
return string.IsNullOrEmpty(searchString) ||
aggregate.Contains(searchString, StringComparison.OrdinalIgnoreCase);
}
private void Submit()
{
if (selectedTitle is not null)
{
Data.OptionPart1.TitleId = (int)selectedTitle.Id;
}
MudDialog.Close(DialogResult.Ok(true));
}
private void Cancel() => MudDialog.Cancel();
}