From 482e040352e5acc4922ff7679e0b07184fba56f8 Mon Sep 17 00:00:00 2001 From: "francesco.belacca" Date: Sun, 4 Feb 2024 19:21:44 +0100 Subject: [PATCH] css fixes for smoother transition --- src/BlazorPong.Web.Components/PongComponent.razor | 10 +++++----- src/BlazorPong.Web.Components/PongComponent.razor.css | 8 ++------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/BlazorPong.Web.Components/PongComponent.razor b/src/BlazorPong.Web.Components/PongComponent.razor index 128ece8..66ca329 100644 --- a/src/BlazorPong.Web.Components/PongComponent.razor +++ b/src/BlazorPong.Web.Components/PongComponent.razor @@ -362,7 +362,7 @@ } } - private async Task GetOrInitializeGameObjects() + private async Task GetGameObjects() { // Chiedo al server la posizione di ogni oggetto e aspetto la risposta GameObjectsDict = await Connection!.InvokeAsync>(nameof(IGameHub.GetGameObjects), RoomId); @@ -444,7 +444,7 @@ try { _playerType = await Connection!.InvokeAsync(nameof(IGameHub.OpenRoom), RoomId, username); - await ManageEnteredPlayerTypeAssigned(); + await ManagePlayerTypeAssigned(); } catch (Exception ex) { @@ -460,7 +460,7 @@ NavigationManager.NavigateTo($"/room/{RoomId}/pong"); // Get what type of player the current user will be _playerType = await Connection!.InvokeAsync(nameof(IGameHub.JoinRoom), RoomId, username); - await ManageEnteredPlayerTypeAssigned(); + await ManagePlayerTypeAssigned(); } else { @@ -469,12 +469,12 @@ } } - private async Task ManageEnteredPlayerTypeAssigned() + private async Task ManagePlayerTypeAssigned() { Logger.LogInformation($"Player type: {_playerType}"); PlayerTypeMessage = $"Your role is: {_playerType.ToString()}"; - await GetOrInitializeGameObjects(); + await GetGameObjects(); } } diff --git a/src/BlazorPong.Web.Components/PongComponent.razor.css b/src/BlazorPong.Web.Components/PongComponent.razor.css index 0e03a76..e77c766 100644 --- a/src/BlazorPong.Web.Components/PongComponent.razor.css +++ b/src/BlazorPong.Web.Components/PongComponent.razor.css @@ -1,22 +1,18 @@ #player1 { background-color: red; - width: 2%; - height: 15%; position: absolute; } #player2 { background-color: green; - width: 2%; - height: 15%; position: absolute; } #ball { background-color: blue; - width: 2%; - height:4%; position: absolute; + /*transition: top 0.03s, left 0.03s;*/ + transition: transform 0.03s linear; } #gamearea {