diff --git a/MathColoringGame/App.xaml b/MathColoringGame/App.xaml index 09b1513..5523ff4 100644 --- a/MathColoringGame/App.xaml +++ b/MathColoringGame/App.xaml @@ -6,7 +6,8 @@ - + + diff --git a/MathColoringGame/MainWindow.xaml b/MathColoringGame/MainWindow.xaml index 0d5028b..5f8554d 100644 --- a/MathColoringGame/MainWindow.xaml +++ b/MathColoringGame/MainWindow.xaml @@ -13,7 +13,7 @@ - + @@ -99,8 +99,8 @@ FontSize="18" FontWeight="Bold" FontFamily="Comic Sans MS" - Content="End Turn" Click="BtnEndTurnClick"/> - + Content="End Turn" Click="BtnEndTurnClick"/> + + FontFamily="Comic Sans MS"/> + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -879,10 +879,10 @@ - + - + @@ -892,7 +892,7 @@ - + diff --git a/MathColoringGame/MainWindow.xaml.cs b/MathColoringGame/MainWindow.xaml.cs index 44cc0c4..d9df0a6 100644 --- a/MathColoringGame/MainWindow.xaml.cs +++ b/MathColoringGame/MainWindow.xaml.cs @@ -221,8 +221,13 @@ namespace MathColoringGame private void BtnRollClick(object sender, RoutedEventArgs e) { - BtnStartRoll.Visibility = Visibility.Hidden; - + BtnStartRoll.Visibility = Visibility.Hidden; + + Container.Children.Cast().ToList().ForEach(checkbox => + { + // uncheck all Checkboxes + checkbox.IsChecked = false; + }); string finalImage1 = "Dice9.png"; string finalImage2 = "Dice2.png"; @@ -312,10 +317,11 @@ namespace MathColoringGame if (diceResult > 0 && diceResult != cellCounter) { + //cast the sender to Cell var checkbox = (CheckBox)sender; - + // bind the cells position in the array var column = Grid.GetColumn(checkbox); @@ -331,7 +337,7 @@ namespace MathColoringGame mResults[index] = mPlayer1Turn ? MarkTyp.Player1Red : MarkTyp.Player2Blue; // set cell color to the result - checkbox.Background = mPlayer1Turn ? Brushes.Red : Brushes.Blue; + checkbox.Background = mPlayer1Turn ? Brushes.Red : Brushes.Blue; //count selectet cells per player CountCells(); } @@ -342,7 +348,6 @@ namespace MathColoringGame // Handel count cells private void BtnEndTurnClick(object sender, RoutedEventArgs e) { - BtnStartRoll.Visibility = Visibility.Visible; diceResult = 0; @@ -356,7 +361,7 @@ namespace MathColoringGame // Check if game is end GameEnded(); - mPlayer1Turn = true; + mPlayer1Turn ^= true; cellCounter = 0; } diff --git a/MathColoringGame/MathColoringGame.csproj b/MathColoringGame/MathColoringGame.csproj index 50b928a..d86c18b 100644 --- a/MathColoringGame/MathColoringGame.csproj +++ b/MathColoringGame/MathColoringGame.csproj @@ -3,7 +3,7 @@ WinExe net5.0-windows - disable + enable true true true @@ -53,4 +53,11 @@ + + + $(DefaultXamlRuntime) + Designer + + + diff --git a/MathColoringGame/Themes/CheckBoxTheme.xaml b/MathColoringGame/Themes/CheckBoxTheme.xaml index 1a9cb00..e21ab94 100644 --- a/MathColoringGame/Themes/CheckBoxTheme.xaml +++ b/MathColoringGame/Themes/CheckBoxTheme.xaml @@ -1,32 +1,27 @@  -