before first release
This commit is contained in:
@@ -67,7 +67,8 @@
|
||||
Content="🗕" Click="BtnMinimizeClick"/>
|
||||
|
||||
|
||||
<Button Style="{StaticResource ModernButton}"
|
||||
<Button x:Name="BtnStartRoll"
|
||||
Style="{StaticResource ModernButton}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Bottom"
|
||||
@@ -92,22 +93,22 @@
|
||||
|
||||
<Border Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="0,30"
|
||||
Margin="15,40"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Left"
|
||||
Width="100"
|
||||
Height="100">
|
||||
Width="80"
|
||||
Height="80">
|
||||
<Border.Background>
|
||||
<ImageBrush x:Name="Dice1" ImageSource="/Images/DiceSix.png"/>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<Border Margin="0,30"
|
||||
<Border Margin="0,40,15,0"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Right"
|
||||
Width="100"
|
||||
Height="100">
|
||||
Width="80"
|
||||
Height="80">
|
||||
<Border.Background>
|
||||
<ImageBrush x:Name="Dice2" ImageSource="/Images/DiceSix.png"/>
|
||||
</Border.Background>
|
||||
@@ -118,7 +119,7 @@
|
||||
Grid.Column="1"
|
||||
Grid.Row="1">
|
||||
<TextBlock
|
||||
FontSize="16"
|
||||
FontSize="20"
|
||||
FontWeight="Bold"
|
||||
FontFamily="Comic Sans MS"
|
||||
Text="Round: "/>
|
||||
@@ -130,7 +131,7 @@
|
||||
FontWeight="Bold"
|
||||
Background="Transparent"
|
||||
BorderThickness="0 "
|
||||
FontSize="16"
|
||||
FontSize="20"
|
||||
Height="30"
|
||||
FontFamily="Comic Sans MS"/>
|
||||
</WrapPanel>
|
||||
@@ -256,7 +257,7 @@
|
||||
<TextBlock
|
||||
Margin="10,30,0,0"
|
||||
FontSize="16"
|
||||
Text="Total Resul: "
|
||||
Text="Total Result: "
|
||||
FontFamily="Comic Sans MS"/>
|
||||
|
||||
<TextBox x:Name="p1TotalResult"
|
||||
@@ -368,7 +369,7 @@
|
||||
<TextBlock
|
||||
Margin="10,30,0,0"
|
||||
FontSize="16"
|
||||
Text="Total Resul: "
|
||||
Text="Total Result: "
|
||||
FontFamily="Comic Sans MS"/>
|
||||
|
||||
<TextBox x:Name="p2TotalResult"
|
||||
@@ -392,7 +393,7 @@
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3">
|
||||
<Button Click="Button_Click" BorderBrush="Black" Background="{x:Null}"/>
|
||||
<Button Click="Button_Click" BorderBrush="Black" Background="Red"/>
|
||||
<Button Click="Button_Click" Background="Red" Grid.Row="1" BorderBrush="Black"/>
|
||||
<Button Click="Button_Click" Background="Red" Grid.Row="2" BorderBrush="Black"/>
|
||||
<Button Click="Button_Click" Background="Red" Grid.Row="3" BorderBrush="Black"/>
|
||||
|
||||
@@ -24,10 +24,9 @@ namespace MathColoringGame
|
||||
|
||||
int cellCounter;
|
||||
int roundCounter;
|
||||
|
||||
|
||||
private MarkTyp[] mResults;
|
||||
private bool mPlayer1Turn;
|
||||
//private bool mGameEnded;
|
||||
private bool mPlayer1Turn;
|
||||
|
||||
//Starts a new game an clear all values back to the start
|
||||
public void NewGame()
|
||||
@@ -50,10 +49,7 @@ namespace MathColoringGame
|
||||
{
|
||||
// Change background to default values
|
||||
button.Background = Brushes.White;
|
||||
});
|
||||
|
||||
// make sure the game hasn´t finished
|
||||
//mGameEnded = false;
|
||||
});
|
||||
}
|
||||
|
||||
// Ends the game
|
||||
@@ -61,16 +57,35 @@ namespace MathColoringGame
|
||||
{
|
||||
if (roundCounter >= 6)
|
||||
{
|
||||
Round.Text = "5";
|
||||
MessageBox.Show("Ende");
|
||||
//mGameEnded = true;
|
||||
CheckWinner();
|
||||
Round.Text = "5";
|
||||
ClearAll();
|
||||
NewGame();
|
||||
|
||||
mPlayer1Turn ^= true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckWinner()
|
||||
{
|
||||
int endResult1 = int.Parse(p1TotalResult.Text);
|
||||
int endResult2 = int.Parse(p2TotalResult.Text);
|
||||
|
||||
if (endResult1 > endResult2)
|
||||
{
|
||||
MessageBox.Show("The Winner is Player 1!");
|
||||
}
|
||||
if(endResult1 < endResult2)
|
||||
{
|
||||
MessageBox.Show("The Winner is Player 2!");
|
||||
}
|
||||
if(endResult1 == endResult2)
|
||||
{
|
||||
MessageBox.Show("The Game ended in a draw!");
|
||||
}
|
||||
}
|
||||
|
||||
// reset all fields
|
||||
private void ClearAll()
|
||||
{
|
||||
@@ -107,22 +122,40 @@ 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);
|
||||
int p1result3 = int.Parse(p1round3.Text);
|
||||
int p1result4 = int.Parse(p1round4.Text);
|
||||
int p1result5 = int.Parse(p1round5.Text);
|
||||
|
||||
int p2result1 = int.Parse(p2round1.Text);
|
||||
int p2result2 = int.Parse(p2round2.Text);
|
||||
int p2result3 = int.Parse(p2round3.Text);
|
||||
int p2result4 = int.Parse(p2round4.Text);
|
||||
int p2result5 = int.Parse(p2round5.Text);
|
||||
|
||||
int totalResult1 = p1result1 + p1result2 + p1result3 + p1result4 + p1result5;
|
||||
p1TotalResult.Text = Convert.ToString(totalResult1);
|
||||
|
||||
int totalResult2 = p2result1 + p2result2 + p2result3 + p2result4 + p2result5;
|
||||
p2TotalResult.Text = Convert.ToString(totalResult2);
|
||||
}
|
||||
|
||||
// count cells by player click cell
|
||||
public void CountCells()
|
||||
{
|
||||
{
|
||||
|
||||
if (mPlayer1Turn && roundCounter == 1)
|
||||
{
|
||||
cellCounter++;
|
||||
p1round1.Text = cellCounter.ToString();
|
||||
p1round1.Text = cellCounter.ToString();
|
||||
}
|
||||
if (!(mPlayer1Turn) && roundCounter == 1)
|
||||
{
|
||||
cellCounter++;
|
||||
p2round1.Text = cellCounter.ToString();
|
||||
p2round1.Text = cellCounter.ToString();
|
||||
}
|
||||
|
||||
if (mPlayer1Turn && roundCounter == 2)
|
||||
@@ -207,6 +240,8 @@ namespace MathColoringGame
|
||||
// shuffle the dices
|
||||
private void BtnRollClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BtnStartRoll.Visibility = Visibility.Hidden;
|
||||
|
||||
string finalImage1 = "DiceSix.png";
|
||||
string finalImage2 = "DiceOne.png";
|
||||
|
||||
@@ -297,6 +332,8 @@ namespace MathColoringGame
|
||||
// Handel count cells
|
||||
private void BtnEndTurnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BtnStartRoll.Visibility = Visibility.Visible;
|
||||
|
||||
// check how many cells the Player marks
|
||||
PlayerResult();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user