fix handle participants and undo
This commit is contained in:
parent
0884c8da60
commit
e2fdb23f56
|
|
@ -30,7 +30,7 @@
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (ParticipantsState.Value.PlayerIds.Length > 0)
|
if (ParticipantsState.Value != null && ParticipantsState.Value.PlayerIds.Length > 0)
|
||||||
{
|
{
|
||||||
return PlayersState.Value.Players.FirstOrDefault(_ => _.Id == ParticipantsState.Value.PlayerIds.First());
|
return PlayersState.Value.Players.FirstOrDefault(_ => _.Id == ParticipantsState.Value.PlayerIds.First());
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
// set;
|
// set;
|
||||||
// } = null!;
|
// } = null!;
|
||||||
|
|
||||||
[Parameter,EditorRequired]
|
[Parameter]
|
||||||
public Func<PlayersState, PlayerState> ValueSelector
|
public Func<PlayersState, PlayerState> ValueSelector
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
|
|
||||||
|
|
@ -125,15 +125,18 @@
|
||||||
|
|
||||||
|
|
||||||
<MudItem xs="12">
|
<MudItem xs="12">
|
||||||
<MudPaper Class="pa-4 d-flex align-center justify-center mud-width-full" Style="height: 76px;">
|
<MudPaper Class="pa-4 d-flex align-center justify-center mud-width-full" Style="height: 76px;">
|
||||||
<ChangePlayerSelect/>
|
@if (ParticipantsState.Value != null)
|
||||||
@if (CanSelectPlayer)
|
|
||||||
{
|
{
|
||||||
|
<ChangePlayerSelect/>
|
||||||
|
@if (CanSelectPlayer)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<p>@($"P: {@ParticipantsState.Value.PlayerIds.FirstOrDefault()}")</p>
|
<p>@($"P: {@ParticipantsState.Value.PlayerIds.FirstOrDefault()}")</p>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
</MudItem>
|
</MudItem>
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ namespace KoogleApp.Services
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return _undoStack.Count > 0;
|
return _undoStack.Count > 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,5 +35,11 @@ namespace KoogleApp.Store.Game.Participants
|
||||||
PlayerIds = lst.ToArray()
|
PlayerIds = lst.ToArray()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ReducerMethod]
|
||||||
|
public static ParticipantsState OnUpdateStateAfterUndoRedo(ParticipantsState state, UpdateStateAfterUndoRedo action)
|
||||||
|
{
|
||||||
|
return action.ParticipantsState;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -35,7 +35,7 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
||||||
|
|
||||||
public record ThrowUpdateAction(bool LeftSink, bool RightSink);
|
public record ThrowUpdateAction(bool LeftSink, bool RightSink);
|
||||||
|
|
||||||
public record AfterUndoRedoAction(ThrowPanelState State);
|
public record UpdateStateAfterUndoRedo(ThrowPanelState ThrowPanelState, ParticipantsState ParticipantsState);
|
||||||
|
|
||||||
public record EnsureBeforeThrowStatusAction(ParticipantsState ParticipantsState);
|
public record EnsureBeforeThrowStatusAction(ParticipantsState ParticipantsState);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -288,9 +288,9 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
||||||
}
|
}
|
||||||
|
|
||||||
[ReducerMethod]
|
[ReducerMethod]
|
||||||
public static ThrowPanelState OnAfterUndoRedo(ThrowPanelState state, AfterUndoRedoAction action)
|
public static ThrowPanelState OnUpdateStateAfterUndoRedo(ThrowPanelState state, UpdateStateAfterUndoRedo action)
|
||||||
{
|
{
|
||||||
return action.State;
|
return action.ThrowPanelState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ namespace KoogleApp.Store.Game.UndoRedo
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
var currentData = _dataService.GetCurrentData();
|
var currentData = _dataService.GetCurrentData();
|
||||||
dispatcher.Dispatch(new AfterUndoRedoAction(currentData.Status.ThrowPanelState));
|
dispatcher.Dispatch(new UpdateStateAfterUndoRedo(currentData.Status.ThrowPanelState, currentData.Status.ParticipantsState));
|
||||||
}
|
}
|
||||||
dispatcher.Dispatch(new UpdateUndoRedoStateAction());
|
dispatcher.Dispatch(new UpdateUndoRedoStateAction());
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@ namespace KoogleApp.Store.Game.UndoRedo
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
var currentData = _dataService.GetCurrentData();
|
var currentData = _dataService.GetCurrentData();
|
||||||
dispatcher.Dispatch(new AfterUndoRedoAction(currentData.Status.ThrowPanelState));
|
dispatcher.Dispatch(new UpdateStateAfterUndoRedo(currentData.Status.ThrowPanelState, currentData.Status.ParticipantsState));
|
||||||
}
|
}
|
||||||
dispatcher.Dispatch(new UpdateUndoRedoStateAction());
|
dispatcher.Dispatch(new UpdateUndoRedoStateAction());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,15 +22,15 @@
|
||||||
},
|
},
|
||||||
"ParticipantsState": {
|
"ParticipantsState": {
|
||||||
"PlayerIds": [
|
"PlayerIds": [
|
||||||
9,
|
|
||||||
5,
|
5,
|
||||||
3
|
3,
|
||||||
|
9
|
||||||
],
|
],
|
||||||
"Eliminated": []
|
"Eliminated": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Version": 4,
|
"Version": 4,
|
||||||
"LastModified": "2025-11-21T13:31:18.7132247+01:00",
|
"LastModified": "2025-11-21T14:49:53.2943989+01:00",
|
||||||
"LastModifiedBy": "test1@test.de"
|
"LastModifiedBy": "test1@test.de"
|
||||||
},
|
},
|
||||||
"UndoHistory": [
|
"UndoHistory": [
|
||||||
|
|
@ -42,11 +42,11 @@
|
||||||
"Pin1State": 0,
|
"Pin1State": 0,
|
||||||
"Pin2State": 0,
|
"Pin2State": 0,
|
||||||
"Pin3State": 0,
|
"Pin3State": 0,
|
||||||
"Pin4State": 0,
|
"Pin4State": 1,
|
||||||
"Pin5State": 0,
|
"Pin5State": 1,
|
||||||
"Pin6State": 0,
|
"Pin6State": 1,
|
||||||
"Pin7State": 0,
|
"Pin7State": 1,
|
||||||
"Pin8State": 0,
|
"Pin8State": 1,
|
||||||
"Pin9State": 1,
|
"Pin9State": 1,
|
||||||
"ThrowsPerRound": 3,
|
"ThrowsPerRound": 3,
|
||||||
"ThrowCounterPerRound": 1,
|
"ThrowCounterPerRound": 1,
|
||||||
|
|
@ -57,15 +57,15 @@
|
||||||
},
|
},
|
||||||
"ParticipantsState": {
|
"ParticipantsState": {
|
||||||
"PlayerIds": [
|
"PlayerIds": [
|
||||||
9,
|
|
||||||
5,
|
5,
|
||||||
3
|
3,
|
||||||
|
9
|
||||||
],
|
],
|
||||||
"Eliminated": []
|
"Eliminated": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Version": 3,
|
"Version": 3,
|
||||||
"LastModified": "2025-11-21T13:31:18.7088636+01:00",
|
"LastModified": "2025-11-21T14:49:53.289455+01:00",
|
||||||
"LastModifiedBy": "test1@test.de"
|
"LastModifiedBy": "test1@test.de"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -99,7 +99,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Version": 2,
|
"Version": 2,
|
||||||
"LastModified": "2025-11-21T13:31:10.7173634+01:00",
|
"LastModified": "2025-11-21T14:49:31.5450392+01:00",
|
||||||
"LastModifiedBy": "test1@test.de"
|
"LastModifiedBy": "test1@test.de"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -126,7 +126,7 @@
|
||||||
"ParticipantsState": null
|
"ParticipantsState": null
|
||||||
},
|
},
|
||||||
"Version": 1,
|
"Version": 1,
|
||||||
"LastModified": "2025-11-21T13:31:10.7160527+01:00",
|
"LastModified": "2025-11-21T14:49:31.5423511+01:00",
|
||||||
"LastModifiedBy": "test1@test.de"
|
"LastModifiedBy": "test1@test.de"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue