Skip to content

Commit

Permalink
Merge branch 'feature/frontend' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
takeiteasy23 committed May 15, 2024
2 parents 5101d82 + 452074f commit 917085d
Show file tree
Hide file tree
Showing 9 changed files with 392 additions and 93 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -476,3 +476,6 @@ $RECYCLE.BIN/

# Windows shortcuts
*.lnk

# rider
.idea/
4 changes: 4 additions & 0 deletions Monopoly.Web/Monopoly.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@
<ProjectReference Include="..\Monopoly.Web.Generators\Monopoly.Web.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>

<ItemGroup>
<None Update="Pages/Gaming/Components/MapPanel.razor.css" CssScope="b-9s5izdb9cc" />
</ItemGroup>

</Project>
65 changes: 5 additions & 60 deletions Monopoly.Web/Pages/Gaming/Components/MapPanel.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@using Client.Pages.Gaming.Entities
@using System.Web;
<div class="container">
<!--
Expand All @@ -12,70 +13,14 @@
</div>
-->

@* @for (int i = 0; i < GetMapRow(); i++)
@for (int i = 0; i < GetMapRow(); i++)
{
<div class="row">
@for (int j = 0; j < GetMapCol(); j++)
{
@GetBlockTag(i, j)
@((MarkupString)GetBlockTag(i, j))
}
</div>
} *@

<div class="row">
<div class="start"></div>
<div class="roadTop"><img class="landH"><img class="roadH"></div>
<div class="roadTop"><img class="landH"><img class="roadH"></div>
<div class="roadTop"><img class="landH"><img class="railH"></div>
<div class="roadTop"><img class="landH"><img class="roadH"></div>
<div class="roadTop"><img class="landH"><img class="roadH"></div>
<div class="roadTop"><img class="landH"><img class="roadTopR"></div>
<div class="empty"></div>
<div class="empty"></div>
</div>
<div class="row">
<div class="roadLeft"><img class="landV"><img class="roadV"></div>
<div class="empty"></div>
<div class="empty"></div>
<div class="empty"></div>
<div class="empty"></div>
<div class="empty"></div>
<div class="roadTop"><img class="roadV"></div>
<div class="empty"></div>
<div class="empty"></div>
</div>
<div class="row">
<div class="roadLeft"><img class="landV"><img class="railV"></div>
<div class="empty"></div>
<div class="empty"></div>
<div class="roadTop"><img class="landH"><img class="roadTopL"></div>
<div class="roadTop"><img class="landH"><img class="roadH"></div>
<div class="roadTop"><img class="landH"><img class="roadH"></div>
<div class="parking"></div>
<div class="roadTop"><img class="landH"><img class="roadH"></div>
<div class="roadTop"><img class="landH"><img class="roadTopR"></div>
</div>
<div class="row">
<div class="roadLeft"><img class="landV"> <img class="roadBtmL"></div>
<div class="roadTop"><img class="landH"><img class="roadH"></div>
<div class="roadTop"><img class="landH"><img class="roadH"></div>
<div class="prison"></div>
<div class="empty"></div>
<div class="empty"></div>
<div class="empty"></div>
<div class="empty"></div>
<div class="roadRight"><img class="landV"><img class="railV"></div>
</div>
<div class="row">
<div class="roadLeft"></div>
<div class="empty"></div>
<div class="empty"></div>
<div class="roadLeft"><img class="landV"><img class="roadBtmL"></div>
<div class="roadTop"><img class="landH"><img class="roadH"></div>
<div class="roadTop"><img class="landH"><img class="railH"></div>
<div class="roadTop"><img class="landH"><img class="roadH"></div>
<div class="roadTop"><img class="landH"><img class="roadH"></div>
<div class="roadRight"><img class="roadBtmR"></div>
</div>
}
</div>
37 changes: 16 additions & 21 deletions Monopoly.Web/Pages/Gaming/Components/MapPanel.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ namespace Client.Pages.Gaming.Components;

public partial class MapPanel
{
private static Block?[][] Blocks =>
[
[new StartPoint("Start"), new Land("A1", lot:"A"), new Station("Station1"), new Land("A2", lot:"A"), new Land("A3", lot:"A"), null, null],
[new Land("F4", lot:"F"), null, null, null, new Land("A4", lot:"A"), null, null],
[new Station("Station4"), null, new Land("B5", lot:"B"), new Land("B6", lot:"B"), new ParkingLot("ParkingLot"), new Land("C1", lot:"C"), new Land("C2", lot:"C")],
[new Land("F3", lot:"F"), null, new Land("B4", lot:"B"), null, new Land("B1", lot:"B"), null, new Land("C3", lot:"C")],
[new Land("F2", lot:"F"), new Land("F1", lot:"F"), new Jail("Jail"), new Land("B3", lot:"B"), new Land("B2", lot:"B"), null, new Station("Station2")],
[null, null, new Land("E3", lot:"E"), null, null, null, new Land("D1", lot:"D")],
[null, null, new Land("E2", lot:"E"), new Land("E1", lot:"E"), new Station("Station3"), new Land("D3", lot:"D"), new Land("D2", lot:"D")],
];

public static int GetMapRow()
[CascadingParameter] public GamingPage Parent { get; set; } = default!;

private Block?[][] Blocks => Parent.Map.Blocks;
private int rowSize => Blocks.Length-1;
private int colSize => Blocks[0].Length-1;

private static string cssScope = "b-9s5izdb9cc";

public int GetMapRow()
{
return Blocks.Length;
}
Expand All @@ -33,22 +30,20 @@ public string GetBlockTag(int row, int col)
case null:
if (col == 0)
{
return "<div class=\"roadLeft\"></div>";
return string.Format("<div class='roadLeft' {0}></div>", cssScope);
}
else
{
return "<div class=\"empty\"></div>";
return string.Format("<div class='empty' {0}></div>", cssScope);
}
case StartPoint:
return "<div class=\"start\"></div>";
case ParkingLot:
return "<div class=\"parking\"></div>";
case Jail:
return "<div class=\"prison\"></div>";
case Station: //* 從可選擇方向判斷
return "<div></div>";
case Land: //* 從可選擇方向判斷
return "<div></div>";
return Blocks[row][col]!.GetHtml(cssScope);
case Road:
case Station:
case Land:
return Blocks[row][col]!.GetHtml(cssScope, row, col, rowSize, colSize);
}
return "";
}
Expand Down
33 changes: 30 additions & 3 deletions Monopoly.Web/Pages/Gaming/Components/MapPanel.razor.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.container {
width: calc(1277 * var(--unit));
top: 20vh;
top: calc(1080 * var(--unit) * 0.2);
margin: auto;
/* background-color: antiquewhite; */
position: relative;
font-size: 0;
user-select: none;
}

div {
Expand All @@ -14,11 +15,14 @@ div {
div.row {
margin: 0;
height: calc(156 * var(--unit));
display: flex;
}

/* #region special block */

.empty, .start, .parking, .prison {
.empty, .start, .parking, .prison
, .pathBtmL, .pathBtmR, .pathH
, .pathTopL, .pathTopR, .pathV {
display: inline-block;
position: relative;
width: calc(133 * var(--unit));
Expand All @@ -37,6 +41,30 @@ div.start {
content: url('images/gamepage/startpoint.svg');
}

div.pathBtmL {
content: url('images/gamepage/road_bottom_left.svg');
}

div.pathBtmR {
content: url('images/gamepage/road_bottom_right.svg');
}

div.pathH {
content: url('images/gamepage/road_horizontal.svg');
}

div.pathTopL {
content: url('images/gamepage/road_top_left.svg');
}

div.pathTopR {
content: url('images/gamepage/road_top_right.svg');
}

div.pathV {
content: url('images/gamepage/road_vertical.svg');
}

/* #endregion */

/* #region roadTop */
Expand Down Expand Up @@ -67,7 +95,6 @@ div.start {
.roadLeft {
display: inline-block;
width: calc(133 * var(--unit));
height: calc(133 * var(--unit));
text-align: right;
position: relative;
}
Expand Down
Loading

0 comments on commit 917085d

Please sign in to comment.