diff --git a/Clients/Monopoly.Clients.Web/Pages/Gaming/Components/DiceBox.razor b/Clients/Monopoly.Clients.Web/Pages/Gaming/Components/DiceBox.razor
index b352e74..230df40 100644
--- a/Clients/Monopoly.Clients.Web/Pages/Gaming/Components/DiceBox.razor
+++ b/Clients/Monopoly.Clients.Web/Pages/Gaming/Components/DiceBox.razor
@@ -1,6 +1,6 @@
- @foreach (var Dice in GetShowDices())
+ @foreach (var dice in Dices)
{
-
+
}
\ No newline at end of file
diff --git a/Clients/Monopoly.Clients.Web/Pages/Gaming/Components/DiceBox.razor.cs b/Clients/Monopoly.Clients.Web/Pages/Gaming/Components/DiceBox.razor.cs
index 4586c37..7b131f4 100644
--- a/Clients/Monopoly.Clients.Web/Pages/Gaming/Components/DiceBox.razor.cs
+++ b/Clients/Monopoly.Clients.Web/Pages/Gaming/Components/DiceBox.razor.cs
@@ -1,15 +1,16 @@
-using Microsoft.AspNetCore.Components;
-
-namespace Client.Pages.Gaming.Components;
+namespace Client.Pages.Gaming.Components;
public partial class DiceBox
{
- [CascadingParameter] public GamingPage Parent { get; set; } = default!;
-
- public List ShowDice => Parent.ShowDice;
+ private IEnumerable Dices { get; set; } = [];
- public List GetShowDices()
+ public async Task ShowDices(IEnumerable dices)
{
- return ShowDice.TrueForAll(x => x > 0) ? ShowDice : [];
+ Console.WriteLine("ShowDices");
+ Dices = dices;
+ StateHasChanged();
+ await Task.Delay(3000);
+ Dices = [];
+ StateHasChanged();
}
-}
+}
\ No newline at end of file
diff --git a/Clients/Monopoly.Clients.Web/Pages/Gaming/GamingPage.razor b/Clients/Monopoly.Clients.Web/Pages/Gaming/GamingPage.razor
index 9d88bb9..54bcab5 100644
--- a/Clients/Monopoly.Clients.Web/Pages/Gaming/GamingPage.razor
+++ b/Clients/Monopoly.Clients.Web/Pages/Gaming/GamingPage.razor
@@ -12,6 +12,6 @@
-
+
\ No newline at end of file
diff --git a/Clients/Monopoly.Clients.Web/Pages/Gaming/GamingPage.razor.cs b/Clients/Monopoly.Clients.Web/Pages/Gaming/GamingPage.razor.cs
index e0eeee1..9d7a892 100644
--- a/Clients/Monopoly.Clients.Web/Pages/Gaming/GamingPage.razor.cs
+++ b/Clients/Monopoly.Clients.Web/Pages/Gaming/GamingPage.razor.cs
@@ -1,5 +1,6 @@
using Client.Options;
using Client.Pages.Enums;
+using Client.Pages.Gaming.Components;
using Client.Pages.Gaming.Entities;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.SignalR.Client;
@@ -40,7 +41,7 @@ public partial class GamingPage
private GamingHubConnection Connection { get; set; } = default!;
public IEnumerable Players { get; set; } = [];
- public List ShowDice { get; set; } = [];
+ private DiceBox DiceBox { get; set; } = default!;
protected override void OnInitialized()
{
@@ -106,19 +107,7 @@ protected override async Task OnInitializedAsync()
private async Task OnRolledDiceEvent(PlayerRolledDiceEventArgs e)
{
- // 顯示骰子點數
- ShowDice = [.. e.DicePoints];
- StateHasChanged();
-
- await Task.Delay(3000);
-
- // TODO 角色移動
-
- // 關閉骰子點數
- ShowDice = [];
- StateHasChanged();
-
- await Task.CompletedTask;
+ await DiceBox.ShowDices(e.DicePoints);
}
private async Task OnRolledDice()