diff --git a/KoogleApp/Store/Game/Participants/Reducers.cs b/KoogleApp/Store/Game/Participants/Reducers.cs index dab0da6..5bb0c73 100644 --- a/KoogleApp/Store/Game/Participants/Reducers.cs +++ b/KoogleApp/Store/Game/Participants/Reducers.cs @@ -26,7 +26,14 @@ namespace KoogleApp.Store.Game.Participants [ReducerMethod] public static ParticipantsState OnSelectedPlayerChangedAction(ParticipantsState state, SelectedPlayerChangedAction action) { - return state with { }; + var lst = state.PlayerIds.ToList(); + lst.Remove(action.Id); + lst.Insert(0,action.Id); + + return state with + { + PlayerIds = lst.ToArray() + }; } } } \ No newline at end of file diff --git a/KoogleApp/Store/Game/ThrowPanel/Actions.cs b/KoogleApp/Store/Game/ThrowPanel/Actions.cs index 71e50e3..0b8e6ab 100644 --- a/KoogleApp/Store/Game/ThrowPanel/Actions.cs +++ b/KoogleApp/Store/Game/ThrowPanel/Actions.cs @@ -40,7 +40,7 @@ namespace KoogleApp.Store.Game.ThrowPanel public record EnsureBeforeThrowStatusAction(ParticipantsState ParticipantsState); - public record GameLogicAction(ThrowPanelState BeforeThrowState, ParticipantsState? BeforeParticipantsState, ThrowPanelState AfterThrowState, ParticipantsState AfterParticipantsState); + public record GameLogicAction(ThrowPanelState? BeforeThrowState, ParticipantsState? BeforeParticipantsState, ThrowPanelState AfterThrowState, ParticipantsState AfterParticipantsState); public record DeleteThrowPanelSessionAction(); diff --git a/KoogleApp/Store/Game/ThrowPanel/Effects.cs b/KoogleApp/Store/Game/ThrowPanel/Effects.cs index 8d5c4ff..bb5438c 100644 --- a/KoogleApp/Store/Game/ThrowPanel/Effects.cs +++ b/KoogleApp/Store/Game/ThrowPanel/Effects.cs @@ -136,7 +136,7 @@ namespace KoogleApp.Store.Game.ThrowPanel var afterState = _throwPanelState.Value; - dispatcher.Dispatch(new GameLogicAction(beforeStates.Status.ThrowPanelState, beforeStates.Status.ParticipantsState, afterState, throwAction.ParticipantsState)); + dispatcher.Dispatch(new GameLogicAction(beforeStates.Status?.ThrowPanelState, beforeStates.Status?.ParticipantsState, afterState, throwAction.ParticipantsState)); // save again - save the new state after the throw dispatcher.Dispatch(new TriggerNewThrowPanelStateChangedAction(true, throwAction.ParticipantsState)); // this will trigger ThrowPanelStateChangedAction with the new state (not current _throwPanelState.Value) @@ -189,14 +189,14 @@ namespace KoogleApp.Store.Game.ThrowPanel ParticipantsState = action.ParticipantsState }, username); - // here we need to invalidate _dataFilePath and _sessionStorage, because with a new throw, state data should come from dataservice + // here we need to invalidate _dataFilePath and _sessionStorage, because with a new throw, state data must be provided by dataservice DeleteAllSessionsFile(dispatcher); dispatcher.Dispatch(new UpdateUndoRedoStateAction()); } } - private void DeleteAllSessionsFile(IDispatcher dispatcher) + private static void DeleteAllSessionsFile(IDispatcher dispatcher) { dispatcher.Dispatch(new DeleteThrowPanelSessionAction()); dispatcher.Dispatch(new DeleteParticipantsSessionAction()); diff --git a/KoogleApp/ThrowPanelState.json b/KoogleApp/ThrowPanelState.json deleted file mode 100644 index 58be9e3..0000000 --- a/KoogleApp/ThrowPanelState.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "IsStated": true, - "BellValue": false, - "Pin1State": 0, - "Pin2State": 0, - "Pin3State": 0, - "Pin4State": 0, - "Pin5State": 0, - "Pin6State": 0, - "Pin7State": 0, - "Pin8State": 0, - "Pin9State": 1, - "ThrowsPerRound": 3, - "ThrowCounterPerRound": 1, - "ThrowMode": 0, - "ThrowPanelStateStatus": 2, - "ThrowCounter": 0, - "DayId": 34 -} \ No newline at end of file diff --git a/KoogleApp/appdata.json b/KoogleApp/appdata.json index 44a9dca..dab57a1 100644 --- a/KoogleApp/appdata.json +++ b/KoogleApp/appdata.json @@ -14,26 +14,94 @@ "Pin8State": 0, "Pin9State": 0, "ThrowsPerRound": 3, - "ThrowCounterPerRound": 1, + "ThrowCounterPerRound": 2, "ThrowMode": 0, - "ThrowPanelStateStatus": 1, - "ThrowCounter": 0, + "ThrowPanelStateStatus": 3, + "ThrowCounter": 1, "DayId": 34 }, "ParticipantsState": { "PlayerIds": [ + 9, 5, - 3, - 9 + 3 ], "Eliminated": [] } }, - "Version": 2, - "LastModified": "2025-11-21T11:51:18.3771349+01:00", + "Version": 4, + "LastModified": "2025-11-21T13:31:18.7132247+01:00", "LastModifiedBy": "test1@test.de" }, "UndoHistory": [ + { + "Status": { + "ThrowPanelState": { + "IsStated": true, + "BellValue": false, + "Pin1State": 0, + "Pin2State": 0, + "Pin3State": 0, + "Pin4State": 0, + "Pin5State": 0, + "Pin6State": 0, + "Pin7State": 0, + "Pin8State": 0, + "Pin9State": 1, + "ThrowsPerRound": 3, + "ThrowCounterPerRound": 1, + "ThrowMode": 0, + "ThrowPanelStateStatus": 2, + "ThrowCounter": 0, + "DayId": 34 + }, + "ParticipantsState": { + "PlayerIds": [ + 9, + 5, + 3 + ], + "Eliminated": [] + } + }, + "Version": 3, + "LastModified": "2025-11-21T13:31:18.7088636+01:00", + "LastModifiedBy": "test1@test.de" + }, + { + "Status": { + "ThrowPanelState": { + "IsStated": true, + "BellValue": false, + "Pin1State": 0, + "Pin2State": 0, + "Pin3State": 0, + "Pin4State": 0, + "Pin5State": 0, + "Pin6State": 0, + "Pin7State": 0, + "Pin8State": 0, + "Pin9State": 0, + "ThrowsPerRound": 3, + "ThrowCounterPerRound": 1, + "ThrowMode": 0, + "ThrowPanelStateStatus": 1, + "ThrowCounter": 0, + "DayId": 34 + }, + "ParticipantsState": { + "PlayerIds": [ + 5, + 3, + 9 + ], + "Eliminated": [] + } + }, + "Version": 2, + "LastModified": "2025-11-21T13:31:10.7173634+01:00", + "LastModifiedBy": "test1@test.de" + }, { "Status": { "ThrowPanelState": { @@ -58,7 +126,7 @@ "ParticipantsState": null }, "Version": 1, - "LastModified": "2025-11-21T11:51:18.3766459+01:00", + "LastModified": "2025-11-21T13:31:10.7160527+01:00", "LastModifiedBy": "test1@test.de" } ], diff --git a/KoogleApp/participantsState.json b/KoogleApp/participantsState.json deleted file mode 100644 index b2d8f81..0000000 --- a/KoogleApp/participantsState.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "PlayerIds": [ - 5, - 3, - 9 - ], - "Eliminated": [] -} \ No newline at end of file