dev undo
This commit is contained in:
parent
92899f96f9
commit
0cc84e31e0
|
|
@ -2,6 +2,7 @@
|
|||
@using KoogleApp.Store.Game
|
||||
@using KoogleApp.Store.Game.ThrowPanel
|
||||
@using KoogleApp.Store.Game.UndoRedo
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
@inherits FluxorComponent
|
||||
|
||||
|
|
@ -12,44 +13,80 @@
|
|||
@if (ThrowPanelState.Value.IsStated)
|
||||
{
|
||||
<MudGrid>
|
||||
<NumberPinPanel />
|
||||
<MudItem xs="4">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<MudButton OnClick="SinkLeftClick"
|
||||
Disabled="@(ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.BeforeThrow && UndoRedoState.Value.CanRedo)">
|
||||
<MudIcon Class="ma-2" Icon="@Icons.Material.Filled.ArrowCircleLeft"
|
||||
Color="@(ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.BeforeThrow && UndoRedoState.Value.CanRedo ? Color.Dark : Color.Error)"
|
||||
Style="font-size: 3rem;"/>
|
||||
Gosse
|
||||
</MudButton>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="4">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<MudButton OnClick="ThrowClick" Disabled="@(ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.BeforeThrow && UndoRedoState.Value.CanRedo)">
|
||||
<MudIcon Class="ma-2" Icon="@Icons.Material.Filled.ArrowCircleUp"
|
||||
Color="@(ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.BeforeThrow && UndoRedoState.Value.CanRedo ? Color.Dark : Color.Success)"
|
||||
Style="font-size: 3rem;"/>
|
||||
Wurf
|
||||
</MudButton>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="4">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<MudButton OnClick="SinkRightClick"
|
||||
Disabled="@(ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.BeforeThrow && UndoRedoState.Value.CanRedo)">
|
||||
<MudIcon Class="ma-2" Icon="@Icons.Material.Filled.ArrowCircleRight"
|
||||
Color="@(ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.BeforeThrow && UndoRedoState.Value.CanRedo ? Color.Dark : Color.Error)"
|
||||
Style="font-size: 3rem;"/>
|
||||
Gosse
|
||||
</MudButton>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
||||
<NumberPinPanel/>
|
||||
@if ((@UndoRedoState.Value.CanRedo && _locked) && (!_correcting))
|
||||
{
|
||||
<MudItem xs="6">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
@if (!_canUnlock)
|
||||
{
|
||||
<MudText>Wurf @(UndoRedoState.Value.Version - 1) von XX um YY</MudText>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudText>Bild @((UndoRedoState.Value.Version / 2) + 1)</MudText>
|
||||
}
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
||||
<MudItem xs="6">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<MudButton OnClick="UnlockClick"
|
||||
Disabled="!_canUnlock">
|
||||
<MudIcon Class="ma-2" Icon="@Icons.Material.Filled.ChangeHistory"
|
||||
Color="@(!_canUnlock ? Color.Dark : Color.Secondary)"
|
||||
Style="font-size: 3rem;"/>
|
||||
Korrigieren
|
||||
</MudButton>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudItem xs="4">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<MudButton OnClick="SinkLeftClick"
|
||||
Disabled="@_disabled">
|
||||
<MudIcon Class="ma-2" Icon="@Icons.Material.Filled.ArrowCircleLeft"
|
||||
Color="@(_disabled ? Color.Dark : Color.Error)"
|
||||
Style="font-size: 3rem;"/>
|
||||
Gosse
|
||||
</MudButton>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="4">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<MudButton OnClick="ThrowClick" Disabled="_disabled">
|
||||
<MudIcon Class="ma-2" Icon="@Icons.Material.Filled.ArrowCircleUp"
|
||||
Color="@(_disabled ? Color.Dark : Color.Success)"
|
||||
Style="font-size: 3rem;"/>
|
||||
Wurf
|
||||
</MudButton>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="4">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<MudButton OnClick="SinkRightClick"
|
||||
Disabled="@_disabled">
|
||||
<MudIcon Class="ma-2" Icon="@Icons.Material.Filled.ArrowCircleRight"
|
||||
Color="@(_disabled ? Color.Dark : Color.Error)"
|
||||
Style="font-size: 3rem;"/>
|
||||
Gosse
|
||||
</MudButton>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
}
|
||||
</MudGrid>
|
||||
}
|
||||
|
||||
|
||||
@code {
|
||||
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 _correcting = false;
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
|
|
@ -57,7 +94,7 @@
|
|||
{
|
||||
Dispatcher.Dispatch(new LoadStateFromSessionAction());
|
||||
}
|
||||
|
||||
_locked = true;
|
||||
base.OnAfterRender(firstRender);
|
||||
}
|
||||
|
||||
|
|
@ -78,6 +115,14 @@
|
|||
|
||||
private void DoThrow(bool leftSink, bool rightSink)
|
||||
{
|
||||
_correcting = false;
|
||||
Dispatcher.Dispatch(new ThrowAction(LeftSink: leftSink, RightSink: rightSink));
|
||||
}
|
||||
|
||||
private void UnlockClick(MouseEventArgs obj)
|
||||
{
|
||||
_correcting = true;
|
||||
_locked = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1Value": false,
|
||||
"Pin2Value": false,
|
||||
"Pin3Value": false,
|
||||
"Pin4Value": false,
|
||||
"Pin5Value": false,
|
||||
"Pin6Value": false,
|
||||
"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,
|
||||
"ThrowCounter": 2,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 2
|
||||
}
|
||||
|
|
@ -10,8 +10,8 @@
|
|||
"Pin4Value": false,
|
||||
"Pin5Value": false,
|
||||
"Pin6Value": false,
|
||||
"Pin7Value": false,
|
||||
"Pin8Value": false,
|
||||
"Pin7Value": true,
|
||||
"Pin8Value": true,
|
||||
"Pin9Value": true,
|
||||
"Pin1Disabled": false,
|
||||
"Pin2Disabled": false,
|
||||
|
|
@ -19,20 +19,119 @@
|
|||
"Pin4Disabled": false,
|
||||
"Pin5Disabled": false,
|
||||
"Pin6Disabled": false,
|
||||
"Pin7Disabled": false,
|
||||
"Pin8Disabled": false,
|
||||
"Pin9Disabled": false,
|
||||
"Pin7Disabled": true,
|
||||
"Pin8Disabled": true,
|
||||
"Pin9Disabled": true,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounter": 1,
|
||||
"ThrowCounter": 3,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 2
|
||||
"ThrowPanelStateStatus": 3
|
||||
}
|
||||
},
|
||||
"Version": 2,
|
||||
"LastModified": "2025-11-11T12:00:22.6133973+01:00",
|
||||
"Version": 5,
|
||||
"LastModified": "2025-11-11T13:46:24.8835415+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
"UndoHistory": [
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1Value": false,
|
||||
"Pin2Value": false,
|
||||
"Pin3Value": false,
|
||||
"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,
|
||||
"Pin8Value": false,
|
||||
"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": 3
|
||||
}
|
||||
},
|
||||
"Version": 3,
|
||||
"LastModified": "2025-11-11T13:45:23.5062354+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,
|
||||
"Pin8Value": false,
|
||||
"Pin9Value": true,
|
||||
"Pin1Disabled": false,
|
||||
"Pin2Disabled": false,
|
||||
"Pin3Disabled": false,
|
||||
"Pin4Disabled": false,
|
||||
"Pin5Disabled": false,
|
||||
"Pin6Disabled": false,
|
||||
"Pin7Disabled": false,
|
||||
"Pin8Disabled": false,
|
||||
"Pin9Disabled": false,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounter": 1,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 2
|
||||
}
|
||||
},
|
||||
"Version": 2,
|
||||
"LastModified": "2025-11-11T13:45:23.4953972+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
|
|
@ -67,39 +166,5 @@
|
|||
"LastModifiedBy": "test1@test.de"
|
||||
}
|
||||
],
|
||||
"RedoHistory": [
|
||||
{
|
||||
"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,
|
||||
"Pin2Disabled": false,
|
||||
"Pin3Disabled": false,
|
||||
"Pin4Disabled": false,
|
||||
"Pin5Disabled": false,
|
||||
"Pin6Disabled": false,
|
||||
"Pin7Disabled": false,
|
||||
"Pin8Disabled": false,
|
||||
"Pin9Disabled": true,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounter": 2,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 3
|
||||
}
|
||||
},
|
||||
"Version": 3,
|
||||
"LastModified": "2025-11-11T12:00:22.6164777+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
}
|
||||
]
|
||||
"RedoHistory": []
|
||||
}
|
||||
Loading…
Reference in New Issue