fix bell, init new state on start and stop

This commit is contained in:
beo3000 2025-11-10 17:51:40 +01:00
parent 0d7a4d9ba5
commit a48ca83ffd
5 changed files with 26 additions and 25 deletions

View File

@ -9,7 +9,7 @@
<MudButton OnClick="ToggleClick" Disabled="false">
<MudIcon Class="ma-2" Icon="@Icons.Material.Filled.AddAlert"
Color="@(State.Value.BellValue ? Color.Primary : Color.Warning)"
Color="@(State.Value.BellValue ? Color.Warning : Color.Primary)"
Style="font-size: 3rem;"/>
</MudButton>

View File

@ -25,7 +25,7 @@
<MudItem xs="4">
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0" Style="height: 76px;">
<MudStack Spacing="0" Wrap="Wrap.Wrap">
<MudChip T="string" Color="Color.Dark" Size="Size.Small">in die Vollen</MudChip>
<MudChip T="string" Color="Color.Dark" Size="Size.Small">@(GetThrowModeName(ThrowPanelState.Value.ThrowMode))</MudChip>
<MudChip T="string" Color="Color.Dark" Size="Size.Small">Wurf 1 von 1</MudChip>
</MudStack>
</MudPaper>
@ -153,4 +153,18 @@
{
Dispatcher.Dispatch(new UpdatePinStateByNumberAction(number));
}
private string GetThrowModeName(ThrowMode value)
{
switch (value)
{
case ThrowMode.Reposition:
return "Abräumen";
case ThrowMode.Decrease:
return "in die Vollen";
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}
}

View File

@ -38,10 +38,10 @@
}
}
[CascadingParameter]
private IMudDialogInstance MudDialog { get; set; }
// [Parameter]
private Tuple<string, ThrowMode> _valueThrowMode;
[Parameter]
@ -57,18 +57,4 @@
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);
}
}
}

View File

@ -43,13 +43,14 @@ namespace KoogleApp.Store.Game.ThrowPanel
[ReducerMethod]
public static ThrowPanelState OnStartStop(ThrowPanelState state, StartStopAction startStopAction)
{
var newState = new ThrowPanelState();
if (state.IsStated)
{
return state with { IsStated = false };
return newState with { IsStated = false };
}
if (startStopAction.StartParams != null)
return state with
return newState with
{
IsStated = !state.IsStated,
ThrowMode = startStopAction.StartParams.ThrowMode,

View File

@ -2,14 +2,14 @@
"IsStated": true,
"BellValue": false,
"Pin1Value": true,
"Pin2Value": true,
"Pin2Value": false,
"Pin3Value": true,
"Pin4Value": true,
"Pin4Value": false,
"Pin5Value": true,
"Pin6Value": true,
"Pin7Value": true,
"Pin8Value": true,
"Pin9Value": true,
"Pin7Value": false,
"Pin8Value": false,
"Pin9Value": false,
"Pin1Disabled": false,
"Pin2Disabled": false,
"Pin3Disabled": false,
@ -21,5 +21,5 @@
"Pin9Disabled": false,
"ThrowsPerRound": 3,
"ThrowCounter": 0,
"ThrowMode": 0
"ThrowMode": 1
}