80 lines
2.3 KiB
Plaintext
80 lines
2.3 KiB
Plaintext
@using KoogleApp.Games
|
|
@using KoogleApp.Model
|
|
@using KoogleApp.Services
|
|
@using KoogleApp.Store.Game.Setup
|
|
@using KoogleApp.Store.Game.ThrowPanel
|
|
|
|
@inject GameTypeService GameTypeService
|
|
@inject IState<SetupState> SetupState
|
|
|
|
<MudDialog Style="height: 800px; width:600px">
|
|
<TitleContent>
|
|
<MudText Typo="Typo.h6">
|
|
<MudIcon Icon="@Icons.Material.Filled.Start" Class="mr-3 mb-n1" />Neues Spiel starten?
|
|
</MudText>
|
|
</TitleContent>
|
|
<DialogContent>
|
|
<MudSelect T="IKnownGame" Label="Spiel" @bind-Value="_selectedGameType" HelperText="Wähle ein Spiel aus"
|
|
OpenIcon="@Icons.Material.Filled.Mode" AdornmentColor="Color.Primary">
|
|
@foreach (var item in _gameTypes)
|
|
{
|
|
<MudSelectItem T="IKnownGame" Value="@(item)">@item.Name</MudSelectItem>
|
|
}
|
|
</MudSelect>
|
|
|
|
<MudGrid>
|
|
@if (_selectedSetupComponentType is not null)
|
|
{
|
|
<MudItem xs="12">
|
|
<h4 class="mt-2">Spieleinstellungen auswählen:</h4>
|
|
</MudItem>
|
|
|
|
<DynamicComponent Type="_selectedSetupComponentType"/>
|
|
}
|
|
</MudGrid>
|
|
|
|
</DialogContent>
|
|
<DialogActions>
|
|
<MudButton OnClick="Cancel">Abbrechen</MudButton>
|
|
<MudButton Color="Color.Primary" OnClick="Start">Start</MudButton>
|
|
</DialogActions>
|
|
</MudDialog>
|
|
|
|
@code {
|
|
|
|
protected override void OnAfterRender(bool firstRender)
|
|
{
|
|
if (firstRender)
|
|
{
|
|
_gameTypes.AddRange(GameTypeService.GetGameTypes());
|
|
|
|
StateHasChanged();
|
|
}
|
|
}
|
|
|
|
Type? _selectedSetupComponentType => _selectedGameType?.SetupComponentType;
|
|
|
|
IKnownGame? _selectedGameType = null;
|
|
|
|
private readonly List<IKnownGame> _gameTypes = [];
|
|
|
|
[CascadingParameter]
|
|
private IMudDialogInstance MudDialog { get; set; }
|
|
|
|
public ThrowMode ThrowMode { get; set; }
|
|
|
|
[Parameter]
|
|
public string Description { get; set; } = "";
|
|
|
|
private void Cancel() => MudDialog.Cancel();
|
|
|
|
private void Start()
|
|
{
|
|
// if (!string.IsNullOrEmpty(Description))
|
|
{
|
|
// Snackbar.Add("Favorite added", Severity.Success);
|
|
MudDialog.Close(DialogResult.Ok(new StartParams(SetupState.Value.ThrowMode, SetupState.Value.ThrowsPerRound)));
|
|
}
|
|
}
|
|
}
|