This commit is contained in:
beo3000 2025-11-11 13:47:03 +01:00
parent 92899f96f9
commit 0cc84e31e0
3 changed files with 188 additions and 104 deletions

View File

@ -2,6 +2,7 @@
@using KoogleApp.Store.Game @using KoogleApp.Store.Game
@using KoogleApp.Store.Game.ThrowPanel @using KoogleApp.Store.Game.ThrowPanel
@using KoogleApp.Store.Game.UndoRedo @using KoogleApp.Store.Game.UndoRedo
@using Microsoft.AspNetCore.Mvc.TagHelpers
@inherits FluxorComponent @inherits FluxorComponent
@ -12,13 +13,43 @@
@if (ThrowPanelState.Value.IsStated) @if (ThrowPanelState.Value.IsStated)
{ {
<MudGrid> <MudGrid>
<NumberPinPanel/> <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"> <MudItem xs="4">
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0"> <MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
<MudButton OnClick="SinkLeftClick" <MudButton OnClick="SinkLeftClick"
Disabled="@(ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.BeforeThrow && UndoRedoState.Value.CanRedo)"> Disabled="@_disabled">
<MudIcon Class="ma-2" Icon="@Icons.Material.Filled.ArrowCircleLeft" <MudIcon Class="ma-2" Icon="@Icons.Material.Filled.ArrowCircleLeft"
Color="@(ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.BeforeThrow && UndoRedoState.Value.CanRedo ? Color.Dark : Color.Error)" Color="@(_disabled ? Color.Dark : Color.Error)"
Style="font-size: 3rem;"/> Style="font-size: 3rem;"/>
Gosse Gosse
</MudButton> </MudButton>
@ -26,9 +57,9 @@
</MudItem> </MudItem>
<MudItem xs="4"> <MudItem xs="4">
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0"> <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)"> <MudButton OnClick="ThrowClick" Disabled="_disabled">
<MudIcon Class="ma-2" Icon="@Icons.Material.Filled.ArrowCircleUp" <MudIcon Class="ma-2" Icon="@Icons.Material.Filled.ArrowCircleUp"
Color="@(ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.BeforeThrow && UndoRedoState.Value.CanRedo ? Color.Dark : Color.Success)" Color="@(_disabled ? Color.Dark : Color.Success)"
Style="font-size: 3rem;"/> Style="font-size: 3rem;"/>
Wurf Wurf
</MudButton> </MudButton>
@ -37,19 +68,25 @@
<MudItem xs="4"> <MudItem xs="4">
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0"> <MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
<MudButton OnClick="SinkRightClick" <MudButton OnClick="SinkRightClick"
Disabled="@(ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.BeforeThrow && UndoRedoState.Value.CanRedo)"> Disabled="@_disabled">
<MudIcon Class="ma-2" Icon="@Icons.Material.Filled.ArrowCircleRight" <MudIcon Class="ma-2" Icon="@Icons.Material.Filled.ArrowCircleRight"
Color="@(ThrowPanelState.Value.ThrowPanelStateStatus == ThrowPanelStateStatus.BeforeThrow && UndoRedoState.Value.CanRedo ? Color.Dark : Color.Error)" Color="@(_disabled ? Color.Dark : Color.Error)"
Style="font-size: 3rem;"/> Style="font-size: 3rem;"/>
Gosse Gosse
</MudButton> </MudButton>
</MudPaper> </MudPaper>
</MudItem> </MudItem>
}
</MudGrid> </MudGrid>
} }
@code { @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) protected override void OnAfterRender(bool firstRender)
{ {
@ -57,7 +94,7 @@
{ {
Dispatcher.Dispatch(new LoadStateFromSessionAction()); Dispatcher.Dispatch(new LoadStateFromSessionAction());
} }
_locked = true;
base.OnAfterRender(firstRender); base.OnAfterRender(firstRender);
} }
@ -78,6 +115,14 @@
private void DoThrow(bool leftSink, bool rightSink) private void DoThrow(bool leftSink, bool rightSink)
{ {
_correcting = false;
Dispatcher.Dispatch(new ThrowAction(LeftSink: leftSink, RightSink: rightSink)); Dispatcher.Dispatch(new ThrowAction(LeftSink: leftSink, RightSink: rightSink));
} }
private void UnlockClick(MouseEventArgs obj)
{
_correcting = true;
_locked = false;
}
} }

View File

@ -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
}

View File

@ -10,7 +10,107 @@
"Pin4Value": false, "Pin4Value": false,
"Pin5Value": false, "Pin5Value": false,
"Pin6Value": false, "Pin6Value": false,
"Pin7Value": false, "Pin7Value": true,
"Pin8Value": true,
"Pin9Value": true,
"Pin1Disabled": false,
"Pin2Disabled": false,
"Pin3Disabled": false,
"Pin4Disabled": false,
"Pin5Disabled": false,
"Pin6Disabled": false,
"Pin7Disabled": true,
"Pin8Disabled": true,
"Pin9Disabled": true,
"ThrowsPerRound": 3,
"ThrowCounter": 3,
"ThrowMode": 1,
"ThrowPanelStateStatus": 3
}
},
"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, "Pin8Value": false,
"Pin9Value": true, "Pin9Value": true,
"Pin1Disabled": false, "Pin1Disabled": false,
@ -29,10 +129,9 @@
} }
}, },
"Version": 2, "Version": 2,
"LastModified": "2025-11-11T12:00:22.6133973+01:00", "LastModified": "2025-11-11T13:45:23.4953972+01:00",
"LastModifiedBy": "test1@test.de" "LastModifiedBy": "test1@test.de"
}, },
"UndoHistory": [
{ {
"Status": { "Status": {
"ThrowPanelState": { "ThrowPanelState": {
@ -67,39 +166,5 @@
"LastModifiedBy": "test1@test.de" "LastModifiedBy": "test1@test.de"
} }
], ],
"RedoHistory": [ "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"
}
]
} }