dev
This commit is contained in:
parent
6bebafe402
commit
0d7a4d9ba5
|
|
@ -37,7 +37,7 @@
|
|||
</MudItem>
|
||||
|
||||
<MudFlexBreak/>
|
||||
@if (ShowNumbers)
|
||||
@if (ThrowPanelState.Value.ThrowMode == ThrowMode.Reposition)
|
||||
{
|
||||
<MudItem xs="4">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
|
|
@ -136,13 +136,6 @@
|
|||
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public bool ShowNumbers
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public bool CanSelectPlayer
|
||||
|
|
|
|||
|
|
@ -4,46 +4,15 @@
|
|||
|
||||
|
||||
<MudItem xs="12" md="6">
|
||||
<NumberPanel ShowNumbers="ShowNumbers"
|
||||
CanSelectPlayer="CanSelectPlayers"
|
||||
/>
|
||||
<NumberPanel/>
|
||||
</MudItem>
|
||||
|
||||
<MudItem xs="12" md="6">
|
||||
<PinPanel @ref="_pinPanel"
|
||||
|
||||
/>
|
||||
<PinPanel/>
|
||||
</MudItem>
|
||||
|
||||
|
||||
@code {
|
||||
// [Parameter]
|
||||
// public ThrowPanelState? ThrowPanelState { get; set; }
|
||||
|
||||
|
||||
|
||||
PinPanel _pinPanel;
|
||||
NumberPanel _numberPanel;
|
||||
|
||||
[Parameter]
|
||||
public bool ShowNumbers
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public bool CanSelectPlayers
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// public void UpdatePanelState(ThrowPanelState state)
|
||||
// {
|
||||
// _pinPanel.UpdatePanelState(state);
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,7 @@
|
|||
@if (ThrowPanelState.Value.IsStated)
|
||||
{
|
||||
<MudGrid>
|
||||
|
||||
<NumberPinPanel ShowNumbers="true"
|
||||
CanSelectPlayers="true"
|
||||
/>
|
||||
|
||||
<NumberPinPanel />
|
||||
<MudItem xs="4">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<MudButton OnClick="SinkLeftClick">
|
||||
|
|
|
|||
|
|
@ -9,9 +9,12 @@
|
|||
</MudText>
|
||||
</TitleContent>
|
||||
<DialogContent>
|
||||
<MudSelect T="ThrowMode" Label="Modus" @bind-Value="ThrowMode">
|
||||
<MudSelectItem Value="ThrowMode.Reposition">in die Vollen</MudSelectItem>
|
||||
<MudSelectItem Value="ThrowMode.Reposition">Abräumen</MudSelectItem>
|
||||
<MudSelect T="Tuple<string, ThrowMode>" Label="Modus" @bind-Value="_valueThrowMode" HelperText="Wähle zwischen Abräumen und in die Vollen"
|
||||
OpenIcon="@Icons.Material.Filled.Mode" AdornmentColor="Color.Primary">
|
||||
@foreach (var item in _items)
|
||||
{
|
||||
<MudSelectItem T="Tuple<string, ThrowMode>" Value="@(item)">@item.Item1</MudSelectItem>
|
||||
}
|
||||
</MudSelect>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
|
|
@ -21,10 +24,25 @@
|
|||
</MudDialog>
|
||||
|
||||
@code {
|
||||
private List<Tuple<string, ThrowMode>> _items = new List<Tuple<string, ThrowMode>>();
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
_items.Add(new Tuple<string, ThrowMode>("in die Vollen", ThrowMode.Reposition));
|
||||
_items.Add(new Tuple<string, ThrowMode>("Abräumen", ThrowMode.Decrease));
|
||||
|
||||
_valueThrowMode = _items[0];
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[CascadingParameter]
|
||||
private IMudDialogInstance MudDialog { get; set; }
|
||||
|
||||
public ThrowMode ThrowMode { get; set; } = ThrowMode.Reposition;
|
||||
// [Parameter]
|
||||
private Tuple<string, ThrowMode> _valueThrowMode;
|
||||
|
||||
[Parameter]
|
||||
public string Description { get; set; } = "";
|
||||
|
|
@ -36,7 +54,21 @@
|
|||
// if (!string.IsNullOrEmpty(Description))
|
||||
{
|
||||
// Snackbar.Add("Favorite added", Severity.Success);
|
||||
MudDialog.Close(DialogResult.Ok(ThrowMode));
|
||||
MudDialog.Close(DialogResult.Ok(new StartParams(_valueThrowMode.Item2, 3)));
|
||||
}
|
||||
}
|
||||
|
||||
private string ValueToString(ThrowMode item)
|
||||
{
|
||||
switch (item)
|
||||
{
|
||||
case ThrowMode.Reposition:
|
||||
return "Abräumen";
|
||||
case ThrowMode.Decrease:
|
||||
return "in die Vollen";
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(item), item, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@
|
|||
|
||||
// await hubConnection.StartAsync();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// private async Task OnBoardPanelStateChanged(ThrowPanelState state)
|
||||
|
|
@ -239,18 +239,18 @@
|
|||
|
||||
private async Task UndoClick()
|
||||
{
|
||||
// if (hubConnection is not null)
|
||||
// {
|
||||
// await hubConnection.SendAsync("RequestUndo", _userName);
|
||||
// }
|
||||
// if (hubConnection is not null)
|
||||
// {
|
||||
// await hubConnection.SendAsync("RequestUndo", _userName);
|
||||
// }
|
||||
}
|
||||
|
||||
private async Task RedoClick()
|
||||
{
|
||||
// if (hubConnection is not null)
|
||||
// {
|
||||
// await hubConnection.SendAsync("RequestRedo", _userName);
|
||||
// }
|
||||
// if (hubConnection is not null)
|
||||
// {
|
||||
// await hubConnection.SendAsync("RequestRedo", _userName);
|
||||
// }
|
||||
}
|
||||
|
||||
private async Task StartStopClick()
|
||||
|
|
@ -262,16 +262,16 @@
|
|||
|
||||
var options = new DialogOptions
|
||||
{
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
var dialog = await DialogService.ShowAsync<StartGameDialog>("Spiel starten", parameters, options);
|
||||
var result = await dialog.Result;
|
||||
|
||||
var startParams = result.Data as StartParams;
|
||||
if (!result.Canceled)
|
||||
{
|
||||
var action = new StartStopAction(ThrowPanelState.Value, new StartParams());
|
||||
var action = new StartStopAction(ThrowPanelState.Value, startParams);
|
||||
Dispatcher.Dispatch(action);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,9 +41,22 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
|||
}
|
||||
|
||||
[ReducerMethod]
|
||||
public static ThrowPanelState OnStartStop(ThrowPanelState state, StartStopAction stopAction)
|
||||
public static ThrowPanelState OnStartStop(ThrowPanelState state, StartStopAction startStopAction)
|
||||
{
|
||||
return state with { IsStated = !state.IsStated };
|
||||
if (state.IsStated)
|
||||
{
|
||||
return state with { IsStated = false };
|
||||
}
|
||||
|
||||
if (startStopAction.StartParams != null)
|
||||
return state with
|
||||
{
|
||||
IsStated = !state.IsStated,
|
||||
ThrowMode = startStopAction.StartParams.ThrowMode,
|
||||
ThrowsPerRound = startStopAction.StartParams.ThrowsPerRound
|
||||
};
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
[ReducerMethod]
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"IsStated": false,
|
||||
"BellValue": true,
|
||||
"Pin1Value": false,
|
||||
"Pin2Value": false,
|
||||
"Pin3Value": false,
|
||||
"Pin4Value": false,
|
||||
"Pin5Value": false,
|
||||
"Pin6Value": false,
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1Value": true,
|
||||
"Pin2Value": true,
|
||||
"Pin3Value": true,
|
||||
"Pin4Value": true,
|
||||
"Pin5Value": true,
|
||||
"Pin6Value": true,
|
||||
"Pin7Value": true,
|
||||
"Pin8Value": true,
|
||||
"Pin9Value": true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue