From acca84dd0762f45fbfeac36ad7809917aa750a48 Mon Sep 17 00:00:00 2001 From: aa89227 Date: Thu, 13 Jun 2024 18:15:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=BE=A9=E5=9C=A8=E6=97=81?= =?UTF-8?q?=E8=A7=80=E8=80=85=E6=8C=89=E4=B8=8B=E5=85=83=E7=B4=A0=E6=9C=83?= =?UTF-8?q?=E7=94=A2=E7=94=9F=E7=9A=84=E9=8C=AF=E8=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/Ready/ReadyPage.razor.cs | 12 ++++++++++++ Clients/Monopoly.Clients.Web/Program.cs | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Clients/Monopoly.Clients.Web/Pages/Ready/ReadyPage.razor.cs b/Clients/Monopoly.Clients.Web/Pages/Ready/ReadyPage.razor.cs index d77ff45..e6cab32 100644 --- a/Clients/Monopoly.Clients.Web/Pages/Ready/ReadyPage.razor.cs +++ b/Clients/Monopoly.Clients.Web/Pages/Ready/ReadyPage.razor.cs @@ -115,16 +115,28 @@ await Popup.Show(new Popup.PopupParameter private async Task OnSelectColor(ColorEnum color) { + if (CurrentPlayer is null) + { + return; + } await Connection.SelectLocation(color.ToLocationEnum()); } private async Task OnSelectRole(string role) { + if (CurrentPlayer is null) + { + return; + } await Connection.SelectRole(role); } private async Task OnReady() { + if (CurrentPlayer is null) + { + return; + } await Connection.PlayerReady(); } diff --git a/Clients/Monopoly.Clients.Web/Program.cs b/Clients/Monopoly.Clients.Web/Program.cs index 9373348..88a2d19 100644 --- a/Clients/Monopoly.Clients.Web/Program.cs +++ b/Clients/Monopoly.Clients.Web/Program.cs @@ -11,7 +11,7 @@ builder.Services.AddOptions() .Configure(options => { builder.Configuration.GetSection(nameof(MonopolyApiOptions)).Bind(options); }); -builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); +builder.Services.AddScoped(_ => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); // Register the MonopolyApiClient builder.Services.AddHttpClient(client =>