diff --git a/MathColoringGame/App.xaml.cs b/MathColoringGame/App.xaml.cs
index 4fb3aeb..6194ef2 100644
--- a/MathColoringGame/App.xaml.cs
+++ b/MathColoringGame/App.xaml.cs
@@ -13,6 +13,5 @@ namespace MathColoringGame
///
public partial class App : Application
{
-
}
}
diff --git a/MathColoringGame/Images/Dice2.png b/MathColoringGame/Images/Dice2.png
new file mode 100644
index 0000000..2c9263e
Binary files /dev/null and b/MathColoringGame/Images/Dice2.png differ
diff --git a/MathColoringGame/Images/Dice3.png b/MathColoringGame/Images/Dice3.png
new file mode 100644
index 0000000..ad77dae
Binary files /dev/null and b/MathColoringGame/Images/Dice3.png differ
diff --git a/MathColoringGame/Images/Dice4.png b/MathColoringGame/Images/Dice4.png
new file mode 100644
index 0000000..73bae9d
Binary files /dev/null and b/MathColoringGame/Images/Dice4.png differ
diff --git a/MathColoringGame/Images/Dice5.png b/MathColoringGame/Images/Dice5.png
new file mode 100644
index 0000000..4912119
Binary files /dev/null and b/MathColoringGame/Images/Dice5.png differ
diff --git a/MathColoringGame/Images/Dice6.png b/MathColoringGame/Images/Dice6.png
new file mode 100644
index 0000000..94d6a66
Binary files /dev/null and b/MathColoringGame/Images/Dice6.png differ
diff --git a/MathColoringGame/Images/Dice7.png b/MathColoringGame/Images/Dice7.png
new file mode 100644
index 0000000..70d4729
Binary files /dev/null and b/MathColoringGame/Images/Dice7.png differ
diff --git a/MathColoringGame/Images/Dice8.png b/MathColoringGame/Images/Dice8.png
new file mode 100644
index 0000000..3c70c93
Binary files /dev/null and b/MathColoringGame/Images/Dice8.png differ
diff --git a/MathColoringGame/Images/Dice9.png b/MathColoringGame/Images/Dice9.png
new file mode 100644
index 0000000..f01828c
Binary files /dev/null and b/MathColoringGame/Images/Dice9.png differ
diff --git a/MathColoringGame/MainWindow.xaml b/MathColoringGame/MainWindow.xaml
index 2148936..94e7967 100644
--- a/MathColoringGame/MainWindow.xaml
+++ b/MathColoringGame/MainWindow.xaml
@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MathColoringGame"
mc:Ignorable="d"
- Title="MainWindow" Height="780" Width="900"
+ Title="MainWindow" Height="850" Width="850"
WindowStyle="None"
Background="Transparent"
AllowsTransparency="True"
@@ -14,21 +14,31 @@
+
+
-
+
-
+
+
@@ -68,6 +78,7 @@
-
+ Width="100"
+ Height="100">
-
+
+ Grid.Row="0">
@@ -138,7 +149,7 @@
+ Margin="0,0,0,0">
@@ -295,7 +306,7 @@
@@ -313,7 +324,7 @@
@@ -331,7 +342,7 @@
@@ -349,7 +360,7 @@
@@ -367,7 +378,7 @@
@@ -383,24 +394,7 @@
FontFamily="Comic Sans MS"/>
-
-
-
-
-
-
+
-
+
-
+
@@ -473,6 +467,9 @@
+
+
+
@@ -492,6 +489,9 @@
+
+
+
@@ -511,6 +511,9 @@
+
+
+
@@ -530,6 +533,9 @@
+
+
+
@@ -549,6 +555,9 @@
+
+
+
@@ -568,6 +577,9 @@
+
+
+
@@ -587,6 +599,9 @@
+
+
+
@@ -606,6 +621,229 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -641,7 +879,9 @@
-
+
+
+
@@ -653,6 +893,7 @@
+
diff --git a/MathColoringGame/MainWindow.xaml.cs b/MathColoringGame/MainWindow.xaml.cs
index 78970cd..443b086 100644
--- a/MathColoringGame/MainWindow.xaml.cs
+++ b/MathColoringGame/MainWindow.xaml.cs
@@ -13,7 +13,7 @@ namespace MathColoringGame
/// Interaction logic for MainWindow.xaml
///
public partial class MainWindow : Window
- {
+ {
public MainWindow()
{
@@ -27,7 +27,7 @@ namespace MathColoringGame
int diceResult;
private MarkTyp[] mResults;
- private bool mPlayer1Turn;
+ private bool mPlayer1Turn;
//Starts a new game an clear all values back to the start
public void NewGame()
@@ -35,10 +35,10 @@ namespace MathColoringGame
{
cellCounter = 0;
roundCounter = 1;
-
+
// Create a new blanck aray of free cells
- mResults = new MarkTyp[180];
+ mResults = new MarkTyp[420];
for (var i = 0; i < mResults.Length; i++)
mResults[i] = MarkTyp.Free;
@@ -51,7 +51,7 @@ namespace MathColoringGame
{
// Change background to default values
button.Background = Brushes.White;
- });
+ });
}
// Ends the game
@@ -60,10 +60,10 @@ namespace MathColoringGame
if (roundCounter >= 6)
{
Round.Text = "5";
- CheckWinner();
- ClearAll();
+ CheckWinner();
+ ClearAll();
NewGame();
-
+
mPlayer1Turn ^= true;
}
@@ -78,11 +78,11 @@ namespace MathColoringGame
{
MessageBox.Show("The Winner is Player 1!");
}
- if(endResult1 < endResult2)
+ if (endResult1 < endResult2)
{
MessageBox.Show("The Winner is Player 2!");
}
- if(endResult1 == endResult2)
+ if (endResult1 == endResult2)
{
MessageBox.Show("The Game ended in a draw!");
}
@@ -92,7 +92,7 @@ namespace MathColoringGame
private void ClearAll()
{
Round.Text = "1";
-
+
p1round1.Text = "0";
p1round2.Text = "0";
p1round3.Text = "0";
@@ -124,7 +124,7 @@ namespace MathColoringGame
// add Totalresulst by Player selectet cells
public void PlayerResult()
- {
+ {
// text to int
int p1result1 = int.Parse(p1round1.Text);
int p1result2 = int.Parse(p1round2.Text);
@@ -148,17 +148,17 @@ namespace MathColoringGame
// count cells by player click cell
public void CountCells()
{
-
+
if (mPlayer1Turn && roundCounter == 1)
{
cellCounter++;
p1round1.Text = cellCounter.ToString();
-
+
}
if (!(mPlayer1Turn) && roundCounter == 1)
{
cellCounter++;
- p2round1.Text = cellCounter.ToString();
+ p2round1.Text = cellCounter.ToString();
}
if (mPlayer1Turn && roundCounter == 2)
@@ -216,6 +216,8 @@ namespace MathColoringGame
{
if (e.LeftButton == MouseButtonState.Pressed)
DragMove();
+
+
}
// Minimize the Window on Click MinimizeButton
private void BtnMinimizeClick(object sender, RoutedEventArgs e)
@@ -245,82 +247,95 @@ namespace MathColoringGame
{
BtnStartRoll.Visibility = Visibility.Hidden;
- string finalImage1 = "DiceSix.png";
- string finalImage2 = "DiceOne.png";
+ string finalImage1 = "Dice9.png";
+ string finalImage2 = "Dice2.png";
+
-
// Gernerate Numbers in Range
- int number1 = dice.Next(1, 7);
- int number2 = dice.Next(1, 7);
+ int number1 = dice.Next(2, 10);
+ int number2 = dice.Next(2, 10);
// switch Pictures by case
switch (number1)
{
- case 1:
- finalImage1 = "DiceOne.png";
- break;
case 2:
- finalImage1 = "DiceTwo.png";
+ finalImage1 = "Dice2.png";
break;
case 3:
- finalImage1 = "DiceThree.png";
+ finalImage1 = "Dice3.png";
break;
case 4:
- finalImage1 = "DiceFour.png";
+ finalImage1 = "Dice4.png";
break;
case 5:
- finalImage1 = "DiceFive.png";
+ finalImage1 = "Dice5.png";
break;
case 6:
- finalImage1 = "DiceSix.png";
+ finalImage1 = "Dice6.png";
+ break;
+ case 7:
+ finalImage1 = "Dice7.png";
+ break;
+ case 8:
+ finalImage1 = "Dice8.png";
+ break;
+ case 9:
+ finalImage1 = "Dice9.png";
break;
default:
- finalImage1 = "DiceSix.png";
+ finalImage1 = "Dice9.png";
break;
}
Dice1.ImageSource = new BitmapImage(new Uri("Images/" + finalImage1, UriKind.Relative));
switch (number2)
{
- case 1:
- finalImage2 = "DiceOne.png";
- break;
case 2:
- finalImage2 = "DiceTwo.png";
+ finalImage2 = "Dice2.png";
break;
case 3:
- finalImage2 = "DiceThree.png";
+ finalImage2 = "Dice3.png";
break;
case 4:
- finalImage2 = "DiceFour.png";
+ finalImage2 = "Dice4.png";
break;
case 5:
- finalImage2 = "DiceFive.png";
+ finalImage2 = "Dice5.png";
break;
case 6:
- finalImage2 = "DiceSix.png";
+ finalImage2 = "Dice6.png";
+ break;
+ case 7:
+ finalImage2 = "Dice7.png";
+ break;
+ case 8:
+ finalImage2 = "Dice8.png";
+ break;
+ case 9:
+ finalImage2 = "Dice9.png";
break;
default:
- finalImage2 = "DiceOne.png";
+ finalImage2 = "Dice9.png";
break;
}
Dice2.ImageSource = new BitmapImage(new Uri("Images/" + finalImage2, UriKind.Relative));
diceResult = number1 * number2;
- testbox.Text = diceResult.ToString();
-
+
+
}
-
+
// Handesl Cell click event
private void Button_Click(object sender, RoutedEventArgs e)
{
-
+
if (diceResult > 0 && diceResult != cellCounter)
{
+
//cast the sender to Cell
var button = (Button)sender;
@@ -329,7 +344,7 @@ namespace MathColoringGame
var column = Grid.GetColumn(button);
var row = Grid.GetRow(button);
- var index = column + (row * 10);
+ var index = column + (row * 20);
// dont`t do anything if the cellalready has a value in it
if (mResults[index] != MarkTyp.Free)
@@ -342,32 +357,34 @@ namespace MathColoringGame
button.Background = mPlayer1Turn ? Brushes.Red : Brushes.Blue;
//count selectet cells per player
CountCells();
- }
-
-
+ }
+
+
}
-
+
// Handel count cells
private void BtnEndTurnClick(object sender, RoutedEventArgs e)
{
+
BtnStartRoll.Visibility = Visibility.Visible;
diceResult = 0;
// check how many cells the Player marks
- PlayerResult();
+ PlayerResult();
//count rounds
CountRounds();
// Check if game is end
GameEnded();
-
+
mPlayer1Turn ^= true;
cellCounter = 0;
- }
-
+ }
+
+
}
}
diff --git a/MathColoringGame/MathColoringGame.csproj b/MathColoringGame/MathColoringGame.csproj
index ed492de..aa3b722 100644
--- a/MathColoringGame/MathColoringGame.csproj
+++ b/MathColoringGame/MathColoringGame.csproj
@@ -10,6 +10,14 @@
+
+
+
+
+
+
+
+
@@ -19,6 +27,30 @@
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
PreserveNewest