diff --git a/KoogleApp/Components/Pages/Game.razor b/KoogleApp/Components/Pages/Game.razor index 2757b45..515993e 100644 --- a/KoogleApp/Components/Pages/Game.razor +++ b/KoogleApp/Components/Pages/Game.razor @@ -42,10 +42,11 @@ Class="mr-5" OnClick="RedoClick"/> - - + + @@ -250,9 +251,9 @@ // } } - private void StartClick() + private void StartStopClick() { - var action = new StartAction(ThrowPanelState.Value); + var action = new StartStopAction(ThrowPanelState.Value); Dispatcher.Dispatch(action); // _throwPanelState = ThrowPanelState.Create(); diff --git a/KoogleApp/Hub/SharedModelHub.cs b/KoogleApp/Hub/SharedModelHub.cs index 5c6c769..1acad82 100644 --- a/KoogleApp/Hub/SharedModelHub.cs +++ b/KoogleApp/Hub/SharedModelHub.cs @@ -52,7 +52,7 @@ namespace KoogleApp.Hub await _hubConnection.StartAsync(); } - public async Task HandleStartAction(StartAction action, IDispatcher dispatcher) + public async Task HandleStartAction(StartStopAction stopAction, IDispatcher dispatcher) { if (_hubConnection?.State != HubConnectionState.Connected) { @@ -64,12 +64,12 @@ namespace KoogleApp.Hub { if (_hubConnection is not null) { - await _hubConnection.SendAsync("BroadcastThrowPanelState", action.State); + await _hubConnection.SendAsync("BroadcastThrowPanelState", stopAction.State); } //await Clients.Others.SendAsync("ReceiveThrowPanelState", new ThrowPanelState()); - //await _hubConnection.InvokeAsync("StartAction", action); + //await _hubConnection.InvokeAsync("StartStopAction", stopAction); // Der Server wird ActivityAdded an alle Clients senden, // einschließlich diesem. Dann wird ActivityAddedAction dispatched. @@ -198,7 +198,7 @@ namespace KoogleApp.Hub { await Clients.Others.SendAsync("ReceiveThrowPanelState", state); - //await _hubConnection.InvokeAsync("StartAction", action); + //await _hubConnection.InvokeAsync("StartStopAction", action); // Der Server wird ActivityAdded an alle Clients senden, // einschließlich diesem. Dann wird ActivityAddedAction dispatched. diff --git a/KoogleApp/Store/Game/ThrowPanel/Actions.cs b/KoogleApp/Store/Game/ThrowPanel/Actions.cs index bd42d7f..b47226d 100644 --- a/KoogleApp/Store/Game/ThrowPanel/Actions.cs +++ b/KoogleApp/Store/Game/ThrowPanel/Actions.cs @@ -4,7 +4,7 @@ namespace KoogleApp.Store.Game.ThrowPanel { public record TogglePinValueAction(bool IsOn, int PinNumber); - public record StartAction(ThrowPanelState State); + public record StartStopAction(ThrowPanelState State); public record ConnectToHubAction(); diff --git a/KoogleApp/Store/Game/ThrowPanel/Effects.cs b/KoogleApp/Store/Game/ThrowPanel/Effects.cs index 5860ee9..c6f57a4 100644 --- a/KoogleApp/Store/Game/ThrowPanel/Effects.cs +++ b/KoogleApp/Store/Game/ThrowPanel/Effects.cs @@ -30,9 +30,9 @@ namespace KoogleApp.Store.Game.ThrowPanel //_sharedModelHub?.Dispose(); } - //[EffectMethod(typeof(StartAction))] + //[EffectMethod(typeof(StartStopAction))] [EffectMethod] - public async Task HandleStartAction(StartAction action, IDispatcher dispatcher) + public async Task HandleStartAction(StartStopAction stopAction, IDispatcher dispatcher) { dispatcher.Dispatch(new BroadcastThrowPanelStateAction(_state.Value)); } @@ -97,7 +97,7 @@ namespace KoogleApp.Store.Game.ThrowPanel // TODO error handling } - await _sharedModelHub.HandleStartAction(new StartAction(_state.Value), dispatcher); + await _sharedModelHub.HandleStartAction(new StartStopAction(_state.Value), dispatcher); } } } diff --git a/KoogleApp/Store/Game/ThrowPanel/Reducers.cs b/KoogleApp/Store/Game/ThrowPanel/Reducers.cs index 8cc977b..b0e5462 100644 --- a/KoogleApp/Store/Game/ThrowPanel/Reducers.cs +++ b/KoogleApp/Store/Game/ThrowPanel/Reducers.cs @@ -41,9 +41,9 @@ namespace KoogleApp.Store.Game.ThrowPanel } [ReducerMethod] - public static ThrowPanelState OnStart(ThrowPanelState state, StartAction action) + public static ThrowPanelState OnStart(ThrowPanelState state, StartStopAction stopAction) { - return state with { IsStated = true }; + return state with { IsStated = !state.IsStated }; } [ReducerMethod] diff --git a/KoogleApp/ThrowPanelState.json b/KoogleApp/ThrowPanelState.json index 0679a84..e231980 100644 --- a/KoogleApp/ThrowPanelState.json +++ b/KoogleApp/ThrowPanelState.json @@ -1,5 +1,5 @@ { - "IsStated": true, + "IsStated": false, "BellValue": false, "Pin1Value": false, "Pin2Value": false,