update participantsState
This commit is contained in:
parent
a282d26cba
commit
0884c8da60
|
|
@ -26,7 +26,14 @@ namespace KoogleApp.Store.Game.Participants
|
||||||
[ReducerMethod]
|
[ReducerMethod]
|
||||||
public static ParticipantsState OnSelectedPlayerChangedAction(ParticipantsState state, SelectedPlayerChangedAction action)
|
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()
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -40,7 +40,7 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
||||||
public record EnsureBeforeThrowStatusAction(ParticipantsState ParticipantsState);
|
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();
|
public record DeleteThrowPanelSessionAction();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
||||||
|
|
||||||
var afterState = _throwPanelState.Value;
|
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
|
// 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)
|
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
|
ParticipantsState = action.ParticipantsState
|
||||||
}, username);
|
}, 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);
|
DeleteAllSessionsFile(dispatcher);
|
||||||
|
|
||||||
dispatcher.Dispatch(new UpdateUndoRedoStateAction());
|
dispatcher.Dispatch(new UpdateUndoRedoStateAction());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteAllSessionsFile(IDispatcher dispatcher)
|
private static void DeleteAllSessionsFile(IDispatcher dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Dispatch(new DeleteThrowPanelSessionAction());
|
dispatcher.Dispatch(new DeleteThrowPanelSessionAction());
|
||||||
dispatcher.Dispatch(new DeleteParticipantsSessionAction());
|
dispatcher.Dispatch(new DeleteParticipantsSessionAction());
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
@ -14,26 +14,94 @@
|
||||||
"Pin8State": 0,
|
"Pin8State": 0,
|
||||||
"Pin9State": 0,
|
"Pin9State": 0,
|
||||||
"ThrowsPerRound": 3,
|
"ThrowsPerRound": 3,
|
||||||
"ThrowCounterPerRound": 1,
|
"ThrowCounterPerRound": 2,
|
||||||
"ThrowMode": 0,
|
"ThrowMode": 0,
|
||||||
"ThrowPanelStateStatus": 1,
|
"ThrowPanelStateStatus": 3,
|
||||||
"ThrowCounter": 0,
|
"ThrowCounter": 1,
|
||||||
"DayId": 34
|
"DayId": 34
|
||||||
},
|
},
|
||||||
"ParticipantsState": {
|
"ParticipantsState": {
|
||||||
"PlayerIds": [
|
"PlayerIds": [
|
||||||
|
9,
|
||||||
5,
|
5,
|
||||||
3,
|
3
|
||||||
9
|
|
||||||
],
|
],
|
||||||
"Eliminated": []
|
"Eliminated": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Version": 2,
|
"Version": 4,
|
||||||
"LastModified": "2025-11-21T11:51:18.3771349+01:00",
|
"LastModified": "2025-11-21T13:31:18.7132247+01:00",
|
||||||
"LastModifiedBy": "test1@test.de"
|
"LastModifiedBy": "test1@test.de"
|
||||||
},
|
},
|
||||||
"UndoHistory": [
|
"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": {
|
"Status": {
|
||||||
"ThrowPanelState": {
|
"ThrowPanelState": {
|
||||||
|
|
@ -58,7 +126,7 @@
|
||||||
"ParticipantsState": null
|
"ParticipantsState": null
|
||||||
},
|
},
|
||||||
"Version": 1,
|
"Version": 1,
|
||||||
"LastModified": "2025-11-21T11:51:18.3766459+01:00",
|
"LastModified": "2025-11-21T13:31:10.7160527+01:00",
|
||||||
"LastModifiedBy": "test1@test.de"
|
"LastModifiedBy": "test1@test.de"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"PlayerIds": [
|
|
||||||
5,
|
|
||||||
3,
|
|
||||||
9
|
|
||||||
],
|
|
||||||
"Eliminated": []
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue