fix Gutte in Decrease-Mode
This commit is contained in:
parent
62000e1291
commit
f75b08d98d
|
|
@ -280,7 +280,15 @@
|
|||
private async Task HandleGutterClick(bool isLeft)
|
||||
{
|
||||
// Gutter = 0 pins fallen, auto-confirm throw
|
||||
Dispatcher.Dispatch(new ResetPinsAction());
|
||||
// In Decrease mode, preserve disabled pins (already knocked down)
|
||||
if (GameState.Value.ThrowPanelAfter.ThrowMode == ThrowMode.Decrease)
|
||||
{
|
||||
Dispatcher.Dispatch(new ClearFallenPinsAction());
|
||||
}
|
||||
else
|
||||
{
|
||||
Dispatcher.Dispatch(new ResetPinsAction());
|
||||
}
|
||||
_selectedNumber = 0;
|
||||
|
||||
await ConfirmThrow(isGutter: true, isLeftGutter: isLeft);
|
||||
|
|
|
|||
|
|
@ -151,6 +151,12 @@ public record SetPinStatusAction(int PinNumber, PinStatus Status);
|
|||
/// </summary>
|
||||
public record ResetPinsAction;
|
||||
|
||||
/// <summary>
|
||||
/// Action to clear fallen pins (set to standing) while preserving disabled pins.
|
||||
/// Used in Decrease mode for gutter throws.
|
||||
/// </summary>
|
||||
public record ClearFallenPinsAction;
|
||||
|
||||
/// <summary>
|
||||
/// Action to set the bell value.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -309,6 +309,16 @@ public static class GameReducers
|
|||
ThrowPanelAfter = state.ThrowPanelAfter.ResetPins()
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Handles ClearFallenPinsAction - clears fallen pins while preserving disabled.
|
||||
/// </summary>
|
||||
[ReducerMethod(typeof(ClearFallenPinsAction))]
|
||||
public static GameState OnClearFallenPins(GameState state)
|
||||
=> state with
|
||||
{
|
||||
ThrowPanelAfter = state.ThrowPanelAfter.ClearFallenPins()
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Handles SetBellValueAction - sets bell value.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -297,6 +297,23 @@ public record ThrowPanelState
|
|||
Pin9 = Pin9 == PinStatus.Fallen ? PinStatus.Disabled : Pin9
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Clears fallen pins (sets to standing) while preserving disabled pins.
|
||||
/// Used for gutter throws in Decrease mode.
|
||||
/// </summary>
|
||||
public ThrowPanelState ClearFallenPins() => this with
|
||||
{
|
||||
Pin1 = Pin1 == PinStatus.Fallen ? PinStatus.Standing : Pin1,
|
||||
Pin2 = Pin2 == PinStatus.Fallen ? PinStatus.Standing : Pin2,
|
||||
Pin3 = Pin3 == PinStatus.Fallen ? PinStatus.Standing : Pin3,
|
||||
Pin4 = Pin4 == PinStatus.Fallen ? PinStatus.Standing : Pin4,
|
||||
Pin5 = Pin5 == PinStatus.Fallen ? PinStatus.Standing : Pin5,
|
||||
Pin6 = Pin6 == PinStatus.Fallen ? PinStatus.Standing : Pin6,
|
||||
Pin7 = Pin7 == PinStatus.Fallen ? PinStatus.Standing : Pin7,
|
||||
Pin8 = Pin8 == PinStatus.Fallen ? PinStatus.Standing : Pin8,
|
||||
Pin9 = Pin9 == PinStatus.Fallen ? PinStatus.Standing : Pin9
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Checks if all pins are knocked down (fallen or disabled).
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue