diff --git a/Client/Pages/Ready/Entities/ColorEnum.cs b/Client/Pages/Enums/ColorEnum.cs similarity index 65% rename from Client/Pages/Ready/Entities/ColorEnum.cs rename to Client/Pages/Enums/ColorEnum.cs index 6499621..ff92b90 100644 --- a/Client/Pages/Ready/Entities/ColorEnum.cs +++ b/Client/Pages/Enums/ColorEnum.cs @@ -1,4 +1,4 @@ -namespace Client.Pages.Ready.Entities; +namespace Client.Pages.Enums; public enum ColorEnum { diff --git a/Client/Pages/Enums/GamingStatusEnum.cs b/Client/Pages/Enums/GamingStatusEnum.cs new file mode 100644 index 0000000..e9c82f3 --- /dev/null +++ b/Client/Pages/Enums/GamingStatusEnum.cs @@ -0,0 +1,6 @@ +namespace Client.Pages.Enums; + +public enum GamingStatusEnum +{ + None, +} diff --git a/Client/Pages/Ready/Entities/RoleEnum.cs b/Client/Pages/Enums/RoleEnum.cs similarity index 64% rename from Client/Pages/Ready/Entities/RoleEnum.cs rename to Client/Pages/Enums/RoleEnum.cs index 6ac7611..4792895 100644 --- a/Client/Pages/Ready/Entities/RoleEnum.cs +++ b/Client/Pages/Enums/RoleEnum.cs @@ -1,4 +1,4 @@ -namespace Client.Pages.Ready.Entities; +namespace Client.Pages.Enums; public enum RoleEnum { diff --git a/Client/Pages/Gaming/Components/PlayerInfo.razor b/Client/Pages/Gaming/Components/PlayerInfo.razor index fdbcc67..c1cd989 100644 --- a/Client/Pages/Gaming/Components/PlayerInfo.razor +++ b/Client/Pages/Gaming/Components/PlayerInfo.razor @@ -1,12 +1,15 @@ - +@using Client.Pages.Gaming.Entities +@code { + [CascadingParameter] + public GamingPage Parent { get; set; } = default!; + private Player player => Parent?.Players.FirstOrDefault(); +} +
- 9,000 + @player.Money
- 9,000 -
-
- 9,000 + @player.GetTotalMoney

diff --git a/Client/Pages/Gaming/Components/PlayerRankList.razor b/Client/Pages/Gaming/Components/PlayerRankList.razor index adc83c4..40eaa9a 100644 --- a/Client/Pages/Gaming/Components/PlayerRankList.razor +++ b/Client/Pages/Gaming/Components/PlayerRankList.razor @@ -1,86 +1,33 @@ -
-
-
-
-
- 1 -
-

- Jason1 -

-
-
-
-
-

1,0000

-

9,000

-
-
-
-
-
-
-
-
-
-
- 2 -
-

- Jason2 -

-
-
-
-
-

1,0000

-

9,000

-
-
-
-
-
-
-
-
-
-
- 3 -
-

- Jason3 -

-
-
-
-
-

1,0000

-

9,000

-
-
-
-
-
-
-
-
-
-
- 4 -
-

- Jason4 -

-
-
-
-
-

1,0000

-

9,000

-
-
-
+@using Client.Pages.Gaming.Entities +@code { + [CascadingParameter] + public GamingPage Parent { get; set; } = default!; + private IEnumerable players => Parent?.Players; +} + +
+ @foreach (var (player, index) in players.OrderBy(p=>p.GetTotalMoney).Select((item, index) => (item, index))) + { +
+
+
+
+ @(@index + 1) +
+

+ @player.Name +

+
+
+
+
+

@player.Money

+

@player.GetTotalMoney

+
+
+
+
+
-
-
+ }
\ No newline at end of file diff --git a/Client/Pages/Gaming/Entities/ILandContract.cs b/Client/Pages/Gaming/Entities/ILandContract.cs new file mode 100644 index 0000000..950518d --- /dev/null +++ b/Client/Pages/Gaming/Entities/ILandContract.cs @@ -0,0 +1,9 @@ +namespace Client.Pages.Gaming.Entities; + +public interface ILandContract +{ + int Money { get; set; } + int HouseCount { get; set; } + + int HouseMoney => HouseCount * 50; //TODO +} diff --git a/Client/Pages/Gaming/Entities/Player.cs b/Client/Pages/Gaming/Entities/Player.cs new file mode 100644 index 0000000..e2c065e --- /dev/null +++ b/Client/Pages/Gaming/Entities/Player.cs @@ -0,0 +1,19 @@ +using Client.Pages.Enums; + +namespace Client.Pages.Gaming.Entities; + +public class Player +{ + public string Id { get; set; } = string.Empty; + public string Name { get; set; } = string.Empty; + public bool IsHost { get; set; } = false; + public ColorEnum Color { get; set; } = ColorEnum.None; + public RoleEnum Role { get; set; } = RoleEnum.None; + public int Order { get; set; } = 0; + + public int Money { get; set; } = 0; + public IEnumerable LandContracts { get; set; } = []; + public GamingStatusEnum Status { get; set; } = GamingStatusEnum.None; + + public int GetTotalMoney => Money + LandContracts.Sum(x => x.Money + x.HouseMoney); +} diff --git a/Client/Pages/Gaming/GamingPage.razor b/Client/Pages/Gaming/GamingPage.razor index 1f18133..94ddb59 100644 --- a/Client/Pages/Gaming/GamingPage.razor +++ b/Client/Pages/Gaming/GamingPage.razor @@ -2,13 +2,15 @@ @using Client.Pages.Gaming.Components
- + + - - - + + + - - - + + + +
\ No newline at end of file diff --git a/Client/Pages/Gaming/GamingPage.razor.cs b/Client/Pages/Gaming/GamingPage.razor.cs index 4fb7b2d..f3e27ec 100644 --- a/Client/Pages/Gaming/GamingPage.razor.cs +++ b/Client/Pages/Gaming/GamingPage.razor.cs @@ -1,5 +1,55 @@ -namespace Client.Pages.Gaming; +using Client.Pages.Enums; +using Client.Pages.Gaming.Entities; + +namespace Client.Pages.Gaming; public partial class GamingPage { + public IEnumerable Players { get; set; } = []; + + + protected override async Task OnInitializedAsync() + { + //假資料 + Players = + [ + new Player + { + Name = "Player1", + Money = 1000, + Color = ColorEnum.Red, + Role = RoleEnum.Baby, + Order = 1, + + IsHost = true + }, + new Player + { + Name = "Player2", + Money = 1000, + Color = ColorEnum.Blue, + Role = RoleEnum.Dai, + Order = 2 + }, + new Player + { + Name = "Player3", + Money = 1000, + Color = ColorEnum.Green, + Role = RoleEnum.Mei, + Order = 3 + }, + new Player + { + Name = "Player4", + Money = 1000, + Color = ColorEnum.Yellow, + Role = RoleEnum.OldMan, + Order = 4 + } + ]; + + //初始化遊戲介面,從Ready轉入Player資料 + + } } diff --git a/Client/Pages/Ready/Components/ColorChoicePanel.razor b/Client/Pages/Ready/Components/ColorChoicePanel.razor index 59595c0..c83d057 100644 --- a/Client/Pages/Ready/Components/ColorChoicePanel.razor +++ b/Client/Pages/Ready/Components/ColorChoicePanel.razor @@ -1,4 +1,4 @@ -@using Client.Pages.Ready.Entities +@using Client.Pages.Enums
@foreach (var color in new[] { ColorEnum.Blue, ColorEnum.Red, ColorEnum.Yellow, ColorEnum.Green }) { diff --git a/Client/Pages/Ready/Components/ColorChoicePanel.razor.cs b/Client/Pages/Ready/Components/ColorChoicePanel.razor.cs index 745ad5a..7afe1ae 100644 --- a/Client/Pages/Ready/Components/ColorChoicePanel.razor.cs +++ b/Client/Pages/Ready/Components/ColorChoicePanel.razor.cs @@ -1,4 +1,5 @@ -using Client.Pages.Ready.Entities; +using Client.Pages.Enums; +using Client.Pages.Ready.Entities; using Microsoft.AspNetCore.Components; namespace Client.Pages.Ready.Components; diff --git a/Client/Pages/Ready/Components/ReadyButton.razor.cs b/Client/Pages/Ready/Components/ReadyButton.razor.cs index 897e2e3..e23a25a 100644 --- a/Client/Pages/Ready/Components/ReadyButton.razor.cs +++ b/Client/Pages/Ready/Components/ReadyButton.razor.cs @@ -1,4 +1,5 @@ -using Client.Pages.Ready.Entities; +using Client.Pages.Enums; +using Client.Pages.Ready.Entities; using Microsoft.AspNetCore.Components; namespace Client.Pages.Ready.Components; diff --git a/Client/Pages/Ready/Components/RoleChoicePanel.razor b/Client/Pages/Ready/Components/RoleChoicePanel.razor index 95f40e6..bd4cdb5 100644 --- a/Client/Pages/Ready/Components/RoleChoicePanel.razor +++ b/Client/Pages/Ready/Components/RoleChoicePanel.razor @@ -1,4 +1,4 @@ -@using Client.Pages.Ready.Entities +@using Client.Pages.Enums @if (CurrentPlayer is not null) {
diff --git a/Client/Pages/Ready/Components/RoleChoicePanel.razor.cs b/Client/Pages/Ready/Components/RoleChoicePanel.razor.cs index 2c25969..f9618a9 100644 --- a/Client/Pages/Ready/Components/RoleChoicePanel.razor.cs +++ b/Client/Pages/Ready/Components/RoleChoicePanel.razor.cs @@ -1,4 +1,5 @@ -using Client.Pages.Ready.Entities; +using Client.Pages.Enums; +using Client.Pages.Ready.Entities; using Microsoft.AspNetCore.Components; namespace Client.Pages.Ready.Components; diff --git a/Client/Pages/Ready/Entities/Player.cs b/Client/Pages/Ready/Entities/Player.cs index 6fe3075..72f8004 100644 --- a/Client/Pages/Ready/Entities/Player.cs +++ b/Client/Pages/Ready/Entities/Player.cs @@ -1,4 +1,6 @@ -namespace Client.Pages.Ready.Entities; +using Client.Pages.Enums; + +namespace Client.Pages.Ready.Entities; public class Player {