Skip to content

Commit f3fad04

Browse files
Merge pull request #125 from CodebreakerApp/120-game5x5x4-clear-field-and-selection-updates
120 game5x5x4 clear field and selection updates
2 parents 8bcd352 + ca9a13b commit f3fad04

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/CodeBreaker.Blazor.Client/Components/Playground.razor.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,21 @@ private void SelectField(int index)
122122
for (int i = 0; i < _currentMove.Length; i++)
123123
_currentMove[i].Selected = false;
124124

125-
// Reset the field, if it is already filled
126-
if (_currentMove[_selectedField].Color is not null || _currentMove[_selectedField].Shape is not null)
125+
if (AvailableShapes is null || !AvailableShapes.Any())
127126
{
127+
// Current game only with colors
128+
// Reset the color of the selected field (will be selected in the next step)
129+
_currentMove[_selectedField].Color = null;
130+
}
131+
else if (_currentMove[_selectedField].Color is not null && _currentMove[_selectedField].Shape is not null)
132+
{
133+
// Current game with colors and shapes
134+
// Reset the color and shape of the selected field when both are set
128135
_currentMove[_selectedField].Color = null;
129136
_currentMove[_selectedField].Shape = null;
130137
}
131138

139+
132140
// Set the selected field to selected
133141
_currentMove[_selectedField].Selected = true;
134142
_selectable = true;

src/CodeBreaker.Blazor/CodeBreaker.Blazor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<PackageReference Include="Microsoft.Identity.Web" Version="3.1.0" />
2121
<PackageReference Include="Microsoft.Identity.Web.UI" Version="3.1.0" />
2222
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
23-
<PackageReference Include="System.Text.Json" Version="8.0.4" />
23+
<PackageReference Include="System.Text.Json" Version="8.0.5" />
2424
</ItemGroup>
2525

2626
<ItemGroup>

0 commit comments

Comments
 (0)