diff --git a/KoogleApp/Components/Controls/NumberPanel.razor b/KoogleApp/Components/Controls/NumberPanel.razor index a86e15d..b78c5ee 100644 --- a/KoogleApp/Components/Controls/NumberPanel.razor +++ b/KoogleApp/Components/Controls/NumberPanel.razor @@ -26,7 +26,7 @@ @(GetThrowModeName(ThrowPanelState.Value.ThrowMode)) - Wurf @ThrowPanelState.Value.ThrowCounter von @ThrowPanelState.Value.ThrowsPerRound + Wurf @ThrowPanelState.Value.ThrowCounterPerRound von @ThrowPanelState.Value.ThrowsPerRound diff --git a/KoogleApp/Components/Controls/ThrowPanel.razor b/KoogleApp/Components/Controls/ThrowPanel.razor index dc13897..73a9677 100644 --- a/KoogleApp/Components/Controls/ThrowPanel.razor +++ b/KoogleApp/Components/Controls/ThrowPanel.razor @@ -19,13 +19,15 @@ { - @if (!_canUnlock) + @if (!CanUnlock) { - Wurf @(UndoRedoState.Value.Version - 1) von XX um YY + + Wurf: @(ThrowPanelState.Value.ThrowCounter + 1) von XX um YY } else { - Bild @((UndoRedoState.Value.Version / 2) + 1) + + Bild: @((UndoRedoState.Value.Version / 2) + 1) } @@ -33,11 +35,11 @@ + Disabled="!CanUnlock"> - Korrigieren + @(CanUnlock ? "ab hier Wurf korrigieren" : "nur Bilder sind korrigierbar") @@ -47,9 +49,9 @@ + Disabled="@Disabled"> Gosse @@ -57,9 +59,9 @@ - + Wurf @@ -68,9 +70,9 @@ + Disabled="@Disabled"> Gosse @@ -82,11 +84,12 @@ @code { - private bool _canUnlock => ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.AfterThrow || ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.GameStart; + private bool CanUnlock => ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.AfterThrow || ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.GameStart; private bool _locked = true; - private bool _disabled => (UndoRedoState.Value.CanRedo && _locked) && !_correcting; + private bool Disabled => (UndoRedoState.Value.CanRedo && _locked) && !_correcting; private bool _correcting = false; + private int _version = 0; protected override void OnAfterRender(bool firstRender) { @@ -95,6 +98,15 @@ Dispatcher.Dispatch(new LoadStateFromSessionAction()); } _locked = true; + + if (_version != UndoRedoState.Value.Version) + { + _version = UndoRedoState.Value.Version; + _correcting = false; + _locked = true; + } + + base.OnAfterRender(firstRender); } @@ -119,10 +131,27 @@ Dispatcher.Dispatch(new ThrowAction(LeftSink: leftSink, RightSink: rightSink)); } - private void UnlockClick(MouseEventArgs obj) + private async Task UnlockClick(MouseEventArgs obj) { - _correcting = true; - _locked = false; + if (!CanUnlock) + return; + + // if (!CanUnlock) + // { + // Dispatcher.Dispatch(new UndoAction()); + // await Task.Run(() => + // { + // Task.Delay(200); + // _correcting = true; + // _locked = false; + // Task.Delay(200); + // }); + // } + // else + // { + _correcting = true; + _locked = false; + // } } } diff --git a/KoogleApp/Components/Pages/Game.razor b/KoogleApp/Components/Pages/Game.razor index 610ae8f..2ecb928 100644 --- a/KoogleApp/Components/Pages/Game.razor +++ b/KoogleApp/Components/Pages/Game.razor @@ -29,12 +29,11 @@ @* @inject IGameStatusDataService _dataService; *@ -@ThrowPanelState.Value.ThrowPanelStateStatus
- @UndoRedoState.Value.Version + + + + Status @UndoRedoState.Value.Version (@ThrowPanelState.Value.ThrowPanelStateStatus)
diff --git a/KoogleApp/Store/Game/ThrowPanel/Reducers.cs b/KoogleApp/Store/Game/ThrowPanel/Reducers.cs index 890c39a..cf58334 100644 --- a/KoogleApp/Store/Game/ThrowPanel/Reducers.cs +++ b/KoogleApp/Store/Game/ThrowPanel/Reducers.cs @@ -182,9 +182,9 @@ namespace KoogleApp.Store.Game.ThrowPanel { var nextCounter = 1; var reset = true; - if (state.ThrowCounter < state.ThrowsPerRound) + if (state.ThrowCounterPerRound < state.ThrowsPerRound) { - nextCounter = state.ThrowCounter + 1; + nextCounter = state.ThrowCounterPerRound + 1; reset = state.ThrowMode != ThrowMode.Decrease; } @@ -254,9 +254,10 @@ namespace KoogleApp.Store.Game.ThrowPanel Pin8Disabled = _pins[1].Disabled, Pin9Value = _pins[0].Value, Pin9Disabled = _pins[0].Disabled, - ThrowCounter = nextCounter, + ThrowCounterPerRound = nextCounter, BellValue = false, - ThrowPanelStateStatus = ThrowPanelStateStatus.AfterThrow + ThrowPanelStateStatus = ThrowPanelStateStatus.AfterThrow, + ThrowCounter = state.ThrowCounter + 1 }; } diff --git a/KoogleApp/Store/Game/ThrowPanel/State.cs b/KoogleApp/Store/Game/ThrowPanel/State.cs index b328f66..84e94ef 100644 --- a/KoogleApp/Store/Game/ThrowPanel/State.cs +++ b/KoogleApp/Store/Game/ThrowPanel/State.cs @@ -24,13 +24,13 @@ namespace KoogleApp.Store.Game.ThrowPanel public record ThrowPanelState(bool IsStated, bool BellValue, bool Pin1Value, bool Pin2Value, bool Pin3Value, bool Pin4Value, bool Pin5Value, bool Pin6Value, bool Pin7Value, bool Pin8Value, bool Pin9Value, bool Pin1Disabled, bool Pin2Disabled, bool Pin3Disabled, bool Pin4Disabled, bool Pin5Disabled, bool Pin6Disabled, bool Pin7Disabled, bool Pin8Disabled, bool Pin9Disabled, - int ThrowsPerRound, int ThrowCounter, ThrowMode ThrowMode, ThrowPanelStateStatus ThrowPanelStateStatus) + int ThrowsPerRound, int ThrowCounterPerRound, ThrowMode ThrowMode, ThrowPanelStateStatus ThrowPanelStateStatus, int ThrowCounter) { // Required for creating initial state public ThrowPanelState() : this(BellValue:false, IsStated:false, Pin1Value:false, Pin2Value:false, Pin3Value: false, Pin4Value: false, Pin5Value: false, Pin6Value: false, Pin7Value: false, Pin8Value: false, Pin9Value: false, Pin1Disabled:false, Pin2Disabled:false, Pin3Disabled: false, Pin4Disabled: false, Pin5Disabled: false, Pin6Disabled: false, Pin7Disabled: false, Pin8Disabled: false, Pin9Disabled: false, - ThrowsPerRound : 3, ThrowCounter : 1, ThrowMode : ThrowMode.Reposition, ThrowPanelStateStatus: ThrowPanelStateStatus.undefined + ThrowsPerRound : 3, ThrowCounterPerRound : 1, ThrowMode : ThrowMode.Reposition, ThrowPanelStateStatus: ThrowPanelStateStatus.undefined, ThrowCounter:0 ) { } } diff --git a/KoogleApp/appdata.json b/KoogleApp/appdata.json index f982d7e..3a23954 100644 --- a/KoogleApp/appdata.json +++ b/KoogleApp/appdata.json @@ -10,8 +10,8 @@ "Pin4Value": false, "Pin5Value": false, "Pin6Value": false, - "Pin7Value": true, - "Pin8Value": true, + "Pin7Value": false, + "Pin8Value": false, "Pin9Value": true, "Pin1Disabled": false, "Pin2Disabled": false, @@ -19,17 +19,18 @@ "Pin4Disabled": false, "Pin5Disabled": false, "Pin6Disabled": false, - "Pin7Disabled": true, - "Pin8Disabled": true, + "Pin7Disabled": false, + "Pin8Disabled": false, "Pin9Disabled": true, "ThrowsPerRound": 3, - "ThrowCounter": 3, + "ThrowCounterPerRound": 3, "ThrowMode": 1, - "ThrowPanelStateStatus": 3 + "ThrowPanelStateStatus": 3, + "ThrowCounter": 2 } }, "Version": 5, - "LastModified": "2025-11-11T13:46:24.8835415+01:00", + "LastModified": "2025-11-11T14:25:20.7054454+01:00", "LastModifiedBy": "test1@test.de" }, "UndoHistory": [ @@ -44,40 +45,7 @@ "Pin4Value": false, "Pin5Value": false, "Pin6Value": false, - "Pin7Value": true, - "Pin8Value": true, - "Pin9Value": true, - "Pin1Disabled": false, - "Pin2Disabled": false, - "Pin3Disabled": false, - "Pin4Disabled": false, - "Pin5Disabled": false, - "Pin6Disabled": false, - "Pin7Disabled": true, - "Pin8Disabled": false, - "Pin9Disabled": true, - "ThrowsPerRound": 3, - "ThrowCounter": 2, - "ThrowMode": 1, - "ThrowPanelStateStatus": 2 - } - }, - "Version": 4, - "LastModified": "2025-11-11T13:46:24.8797561+01:00", - "LastModifiedBy": "test1@test.de" - }, - { - "Status": { - "ThrowPanelState": { - "IsStated": true, - "BellValue": false, - "Pin1Value": false, - "Pin2Value": false, - "Pin3Value": false, - "Pin4Value": false, - "Pin5Value": false, - "Pin6Value": false, - "Pin7Value": true, + "Pin7Value": false, "Pin8Value": false, "Pin9Value": true, "Pin1Disabled": false, @@ -86,17 +54,18 @@ "Pin4Disabled": false, "Pin5Disabled": false, "Pin6Disabled": false, - "Pin7Disabled": true, + "Pin7Disabled": false, "Pin8Disabled": false, "Pin9Disabled": true, "ThrowsPerRound": 3, - "ThrowCounter": 2, + "ThrowCounterPerRound": 2, "ThrowMode": 1, - "ThrowPanelStateStatus": 3 + "ThrowPanelStateStatus": 2, + "ThrowCounter": 1 } }, - "Version": 3, - "LastModified": "2025-11-11T13:45:23.5062354+01:00", + "Version": 4, + "LastModified": "2025-11-11T14:25:20.6996276+01:00", "LastModifiedBy": "test1@test.de" }, { @@ -110,7 +79,41 @@ "Pin4Value": false, "Pin5Value": false, "Pin6Value": false, - "Pin7Value": true, + "Pin7Value": false, + "Pin8Value": false, + "Pin9Value": true, + "Pin1Disabled": false, + "Pin2Disabled": false, + "Pin3Disabled": false, + "Pin4Disabled": false, + "Pin5Disabled": false, + "Pin6Disabled": false, + "Pin7Disabled": false, + "Pin8Disabled": false, + "Pin9Disabled": true, + "ThrowsPerRound": 3, + "ThrowCounterPerRound": 2, + "ThrowMode": 1, + "ThrowPanelStateStatus": 3, + "ThrowCounter": 1 + } + }, + "Version": 3, + "LastModified": "2025-11-11T14:21:38.6653918+01:00", + "LastModifiedBy": "test1@test.de" + }, + { + "Status": { + "ThrowPanelState": { + "IsStated": true, + "BellValue": false, + "Pin1Value": false, + "Pin2Value": false, + "Pin3Value": false, + "Pin4Value": false, + "Pin5Value": false, + "Pin6Value": false, + "Pin7Value": false, "Pin8Value": false, "Pin9Value": true, "Pin1Disabled": false, @@ -123,13 +126,14 @@ "Pin8Disabled": false, "Pin9Disabled": false, "ThrowsPerRound": 3, - "ThrowCounter": 1, + "ThrowCounterPerRound": 1, "ThrowMode": 1, - "ThrowPanelStateStatus": 2 + "ThrowPanelStateStatus": 2, + "ThrowCounter": 0 } }, "Version": 2, - "LastModified": "2025-11-11T13:45:23.4953972+01:00", + "LastModified": "2025-11-11T14:21:38.6623607+01:00", "LastModifiedBy": "test1@test.de" }, { @@ -156,13 +160,14 @@ "Pin8Disabled": false, "Pin9Disabled": false, "ThrowsPerRound": 3, - "ThrowCounter": 1, + "ThrowCounterPerRound": 1, "ThrowMode": 1, - "ThrowPanelStateStatus": 1 + "ThrowPanelStateStatus": 1, + "ThrowCounter": 0 } }, "Version": 1, - "LastModified": "2025-11-11T12:00:15.1075206+01:00", + "LastModified": "2025-11-11T14:21:31.2803757+01:00", "LastModifiedBy": "test1@test.de" } ],