Results per Round finish

This commit is contained in:
Natlinux81
2022-02-28 02:21:26 +01:00
parent 5629a35f08
commit f7dae93596
5 changed files with 851 additions and 81 deletions

View File

@@ -4,6 +4,10 @@
xmlns:local="clr-namespace:MathColoringGame" xmlns:local="clr-namespace:MathColoringGame"
StartupUri="MainWindow.xaml"> StartupUri="MainWindow.xaml">
<Application.Resources> <Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes/ModernButtonTheme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources> </Application.Resources>
</Application> </Application>

View File

@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MathColoringGame" xmlns:local="clr-namespace:MathColoringGame"
mc:Ignorable="d" mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" Title="MainWindow" Height="780" Width="650"
WindowStyle="None" WindowStyle="None"
Background="Transparent" Background="Transparent"
AllowsTransparency="True" AllowsTransparency="True"
@@ -18,7 +18,7 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="35"/> <RowDefinition Height="35"/>
<RowDefinition/> <RowDefinition Height="180"/>
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
@@ -66,14 +66,34 @@
FontSize="18" FontSize="18"
Content="🗕" Click="BtnMinimizeClick"/> Content="🗕" Click="BtnMinimizeClick"/>
<Button Grid.Column="1"
<Button Style="{StaticResource ModernButton}"
Grid.Column="1"
Grid.Row="1" Grid.Row="1"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
Width="100" Width="120"
Height="50" Height="45"
FontSize="18"
FontWeight="Bold"
FontFamily="Comic Sans MS"
Content="Start Roll" Click="BtnRollClick"/> Content="Start Roll" Click="BtnRollClick"/>
<Button Style="{StaticResource ModernButton}"
Grid.Column="1"
Grid.Row="2"
VerticalAlignment="Bottom"
Margin="20"
Width="120"
Height="45"
FontSize="18"
FontWeight="Bold"
FontFamily="Comic Sans MS"
Content="End Turn" Click="BtnEndTurnClick"/>
<Border Grid.Row="1" <Border Grid.Row="1"
Grid.Column="1" Grid.Column="1"
Margin="0,30"
VerticalAlignment="Top"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Width="100" Width="100"
Height="100"> Height="100">
@@ -81,8 +101,10 @@
<ImageBrush x:Name="Dice1" ImageSource="/Images/DiceSix.png"/> <ImageBrush x:Name="Dice1" ImageSource="/Images/DiceSix.png"/>
</Border.Background> </Border.Background>
</Border> </Border>
<Border Grid.Row="1" <Border Margin="0,30"
Grid.Row="1"
Grid.Column="1" Grid.Column="1"
VerticalAlignment="Top"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Width="100" Width="100"
Height="100"> Height="100">
@@ -91,6 +113,510 @@
</Border.Background> </Border.Background>
</Border> </Border>
<WrapPanel
HorizontalAlignment="Center"
Grid.Column="1"
Grid.Row="1">
<TextBlock
FontSize="16"
FontWeight="Bold"
FontFamily="Comic Sans MS"
Text="Round: "/>
<TextBox x:Name="Round"
Text="1"
Grid.Column="1"
Grid.Row="1"
FontWeight="Bold"
Background="Transparent"
BorderThickness="0 "
FontSize="16"
Height="30"
FontFamily="Comic Sans MS"/>
</WrapPanel>
<TextBlock
Margin="0,10,0,0"
Grid.Row="1"
HorizontalAlignment="Center"
Text="Player 1"
FontSize="30"
FontFamily="Comic Sans MS"
Foreground="red">
<TextBlock.Effect>
<DropShadowEffect/>
</TextBlock.Effect>
</TextBlock>
<TextBlock
Margin="0,10,0,0"
Grid.Row="1"
Grid.Column="2"
HorizontalAlignment="Center"
Text="Player 2"
FontSize="30"
FontFamily="Comic Sans MS"
Foreground="blue">
<TextBlock.Effect>
<DropShadowEffect/>
</TextBlock.Effect>
</TextBlock>
<StackPanel Grid.Row="2">
<WrapPanel>
<TextBlock
Margin="10,30,0,0"
FontSize="16"
Text="Resuld Round 1: "
FontFamily="Comic Sans MS"/>
<TextBox x:Name="p1round1" Text="0"
Margin="0,29,0,0"
FontWeight="Bold"
Background="Transparent"
BorderThickness="0 "
FontSize="16"
Height="30"
FontFamily="Comic Sans MS"/>
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,30,0,0"
FontSize="16"
Text="Resuld Round 2: "
FontFamily="Comic Sans MS"/>
<TextBox x:Name="p1round2"
Text="0"
Margin="0,29,0,0"
FontWeight="Bold"
Background="Transparent"
BorderThickness="0 "
FontSize="16"
Height="30"
FontFamily="Comic Sans MS"/>
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,30,0,0"
FontSize="16"
Text="Resuld Round 3: "
FontFamily="Comic Sans MS"/>
<TextBox x:Name="p1round3"
Text="0"
Margin="0,29,0,0"
FontWeight="Bold"
Background="Transparent"
BorderThickness="0 "
FontSize="16"
Height="30"
FontFamily="Comic Sans MS"/>
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,30,0,0"
FontSize="16"
Text="Resuld Round 4: "
FontFamily="Comic Sans MS"/>
<TextBox x:Name="p1round4"
Text="0"
Margin="0,29,0,0"
FontWeight="Bold"
Background="Transparent"
BorderThickness="0 "
FontSize="16"
Height="30"
FontFamily="Comic Sans MS"/>
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,30,0,0"
FontSize="16"
Text="Resuld Round 5: "
FontFamily="Comic Sans MS"/>
<TextBox x:Name="p1round5"
Text="0"
Margin="0,29,0,0"
FontWeight="Bold"
Background="Transparent"
BorderThickness="0 "
FontSize="16"
Height="30"
FontFamily="Comic Sans MS"/>
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,30,0,0"
FontSize="16"
Text="Total Resul: "
FontFamily="Comic Sans MS"/>
<TextBox x:Name="p1TotalResult"
Text="0"
Margin="0,29,0,0"
FontWeight="Bold"
Background="Transparent"
BorderThickness="0 "
FontSize="16"
Height="30"
FontFamily="Comic Sans MS"/>
</WrapPanel>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="2"
Margin="15,0,0,0">
<WrapPanel>
<TextBlock
Margin="10,30,0,0"
FontSize="16"
Text="Resuld Round 1: "
FontFamily="Comic Sans MS"/>
<TextBox x:Name="p2round1"
Text="0"
Margin="0,29,0,0"
FontWeight="Bold"
Background="Transparent"
BorderThickness="0 "
FontSize="16"
Height="30"
FontFamily="Comic Sans MS"/>
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,30,0,0"
FontSize="16"
Text="Resuld Round 2: "
FontFamily="Comic Sans MS"/>
<TextBox x:Name="p2round2"
Text="0"
Margin="0,29,0,0"
FontWeight="Bold"
Background="Transparent"
BorderThickness="0 "
FontSize="16"
Height="30"
FontFamily="Comic Sans MS"/>
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,30,0,0"
FontSize="16"
Text="Resuld Round 3: "
FontFamily="Comic Sans MS"/>
<TextBox x:Name="p2round3"
Text="0"
Margin="0,29,0,0"
FontWeight="Bold"
Background="Transparent"
BorderThickness="0 "
FontSize="16"
Height="30"
FontFamily="Comic Sans MS"/>
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,30,0,0"
FontSize="16"
Text="Resuld Round 4: "
FontFamily="Comic Sans MS"/>
<TextBox x:Name="p2round4"
Text="0"
Margin="0,29,0,0"
FontWeight="Bold"
Background="Transparent"
BorderThickness="0 "
FontSize="16"
Height="30"
FontFamily="Comic Sans MS"/>
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,30,0,0"
FontSize="16"
Text="Resuld Round 5: "
FontFamily="Comic Sans MS"/>
<TextBox x:Name="p2round5"
Text="0"
Margin="0,29,0,0"
FontWeight="Bold"
Background="Transparent"
BorderThickness="0 "
FontSize="16"
Height="30"
FontFamily="Comic Sans MS"/>
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,30,0,0"
FontSize="16"
Text="Total Resul: "
FontFamily="Comic Sans MS"/>
<TextBox x:Name="p2TotalResult"
Text="0"
Margin="0,29,0,0"
FontWeight="Bold"
Background="Transparent"
BorderThickness="0 "
FontSize="16"
Height="30"
FontFamily="Comic Sans MS"/>
</WrapPanel>
</StackPanel>
<Grid x:Name="Container"
Width="250"
Height="450"
VerticalAlignment="Top"
Margin="28"
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="3">
<Button Click="Button_Click" BorderBrush="Black" Background="{x:Null}"/>
<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"/>
<Button Click="Button_Click" Background="blue" Grid.Row="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="10" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="11" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="12" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="13" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="14" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="15" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="16" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="17" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="1" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="2" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="3" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="4" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="5" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="6" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="7" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="8" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="9" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="10" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="11" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="12" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="13" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="14" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="15" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="16" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="17" Grid.Column="1" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="1" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="2" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="3" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="4" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="5" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="6" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="7" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="8" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="9" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="10" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="11" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="12" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="13" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="14" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="15" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="16" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="17" Grid.Column="2" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="1" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="2" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="3" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="4" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="5" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="6" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="7" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="8" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="9" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="10" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="11" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="12" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="13" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="14" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="15" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="16" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="17" Grid.Column="3" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="1" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="2" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="3" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="4" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="5" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="6" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="7" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="8" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="9" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="10" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="11" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="12" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="13" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="14" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="15" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="16" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="17" Grid.Column="4" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="1" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="2" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="3" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="4" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="5" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="6" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="7" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="8" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="9" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="10" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="11" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="12" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="13" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="14" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="15" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="16" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="17" Grid.Column="5" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="1" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="2" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="3" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="4" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="5" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="6" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="7" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="8" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="9" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="10" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="11" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="12" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="13" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="14" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="15" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="16" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="17" Grid.Column="6" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="1" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="2" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="3" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="4" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="5" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="6" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="7" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="8" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="9" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="10" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="11" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="12" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="13" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="14" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="15" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="16" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="17" Grid.Column="7" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="1" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="2" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="3" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="4" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="5" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="6" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="7" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="8" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="9" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="10" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="11" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="12" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="13" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="14" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="15" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="16" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="17" Grid.Column="8" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="1" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="Red" Grid.Row="2" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="3" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="4" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="5" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="blue" Grid.Row="6" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="7" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="8" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="9" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="10" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="11" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="12" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="13" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="14" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="15" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="16" Grid.Column="9" BorderBrush="Black"/>
<Button Click="Button_Click" Background="White" Grid.Row="17" Grid.Column="9" BorderBrush="Black"/>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
</Grid>
</Grid> </Grid>
</Border> </Border>

View File

@@ -1,17 +1,11 @@
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MathColoringGame namespace MathColoringGame
{ {
@@ -21,8 +15,159 @@ namespace MathColoringGame
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
NewGame();
}
int cellCounter;
int roundCounter;
private MarkTyp[] mResults;
private bool mPlayer1Turn;
//private bool mGameEnded;
//Starts a new game an clear all values back to the start
public void NewGame()
{
cellCounter = 0;
roundCounter = 1;
// Create a new blanck aray of free cells
mResults = new MarkTyp[180];
for (var i = 0; i < mResults.Length; i++)
mResults[i] = MarkTyp.Free;
// make sure Player1 is starts The game
mPlayer1Turn = true;
// interate every Cell on the grid
Container.Children.Cast<Button>().ToList().ForEach(button =>
{
// Change background to default values
button.Background = Brushes.White;
});
// make sure the game hasn´t finished
//mGameEnded = false;
}
// Ends the game
private void GameEnded()
{
if (roundCounter >= 6)
{
Round.Text = "5";
MessageBox.Show("Ende");
//mGameEnded = true;
ClearAll();
NewGame();
mPlayer1Turn ^= true;
}
}
// reset all fields
private void ClearAll()
{
Round.Text = "1";
p1round1.Text = "0";
p1round2.Text = "0";
p1round3.Text = "0";
p1round4.Text = "0";
p1round5.Text = "0";
p1TotalResult.Text = "0";
p2round1.Text = "0";
p2round2.Text = "0";
p2round3.Text = "0";
p2round4.Text = "0";
p2round5.Text = "0";
p2TotalResult.Text = "0";
}
// counts the rounds when player2 turn ends
public void CountRounds()
{
if (mPlayer1Turn)
{
}
else
{
roundCounter++;
Round.Text = roundCounter.ToString();
}
}
// add Totalresulst by Player selectet cells
public void PlayerResult()
{
}
// 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();
}
if (mPlayer1Turn && roundCounter == 2)
{
cellCounter++;
p1round2.Text = cellCounter.ToString();
}
if (!(mPlayer1Turn) && roundCounter == 2)
{
cellCounter++;
p2round2.Text = cellCounter.ToString();
}
if (mPlayer1Turn && roundCounter == 3)
{
cellCounter++;
p1round3.Text = cellCounter.ToString();
}
if (!(mPlayer1Turn) && roundCounter == 3)
{
cellCounter++;
p2round3.Text = cellCounter.ToString();
}
if (mPlayer1Turn && roundCounter == 4)
{
cellCounter++;
p1round4.Text = cellCounter.ToString();
}
if (!(mPlayer1Turn) && roundCounter == 4)
{
cellCounter++;
p2round4.Text = cellCounter.ToString();
}
if (mPlayer1Turn && roundCounter == 5)
{
cellCounter++;
p1round5.Text = cellCounter.ToString();
}
if (!(mPlayer1Turn) && roundCounter == 5)
{
cellCounter++;
p2round5.Text = cellCounter.ToString();
}
} }
private void BtnExit(object sender, RoutedEventArgs e) private void BtnExit(object sender, RoutedEventArgs e)
@@ -30,17 +175,19 @@ namespace MathColoringGame
Application.Current.Shutdown(); Application.Current.Shutdown();
} }
// Drag Window by MouseDown
private void Border_MouseDown(object sender, MouseButtonEventArgs e) private void Border_MouseDown(object sender, MouseButtonEventArgs e)
{ {
if (e.LeftButton == MouseButtonState.Pressed) if (e.LeftButton == MouseButtonState.Pressed)
DragMove(); DragMove();
} }
// Minimize the Window on Click MinimizeButton
private void BtnMinimizeClick(object sender, RoutedEventArgs e) private void BtnMinimizeClick(object sender, RoutedEventArgs e)
{ {
this.WindowState = WindowState.Minimized; this.WindowState = WindowState.Minimized;
} }
// Maximize Window on Click MaximizeButton
private void BtnMaximizeClick(object sender, RoutedEventArgs e) private void BtnMaximizeClick(object sender, RoutedEventArgs e)
{ {
if (this.WindowState == WindowState.Normal) if (this.WindowState == WindowState.Normal)
@@ -55,77 +202,115 @@ namespace MathColoringGame
} }
// Instantiate random number generator. // Instantiate random number generator.
private readonly Random random = new Random(); private readonly Random dice = new Random();
// Gernerates a random number within a range
public int RandomNumber(int min, int max)
{
return random.Next(min, max);
}
// shuffle the dices
private void BtnRollClick(object sender, RoutedEventArgs e) private void BtnRollClick(object sender, RoutedEventArgs e)
{ {
string finalImage1 = "DiceSix.png"; string finalImage1 = "DiceSix.png";
string finalImage2 = "DiceOne.png"; string finalImage2 = "DiceOne.png";
// Gernerate Numbers in Range
int number1 = dice.Next(1, 7);
int number2 = dice.Next(1, 7);
int number1 = RandomNumber(1, 13); // switch Pictures by case
switch (number1)
// Dice1
if (number1 == 1)
{ {
case 1:
finalImage1 = "DiceOne.png"; finalImage1 = "DiceOne.png";
} break;
else if (number1 == 2) case 2:
{
finalImage1 = "DiceTwo.png"; finalImage1 = "DiceTwo.png";
} break;
else if (number1 == 3) case 3:
{ finalImage1 = "DiceThree.png";
finalImage1 = "DiceThree.png"; ; break;
} case 4:
else if (number1 == 4)
{
finalImage1 = "DiceFour.png"; finalImage1 = "DiceFour.png";
} break;
else if (number1 == 5) case 5:
{
finalImage1 = "DiceFive.png"; finalImage1 = "DiceFive.png";
} break;
else if (number1 == 6) case 6:
{
finalImage1 = "DiceSix.png"; finalImage1 = "DiceSix.png";
break;
default:
finalImage1 = "DiceSix.png";
break;
} }
// Dice 2
else if (number1 == 7)
{
finalImage2 = "DiceOne.png";
}
else if (number1 == 8)
{
finalImage2 = "DiceTwo.png";
}
else if (number1 == 9)
{
finalImage2 = "DiceThree.png"; ;
}
else if (number1 == 10)
{
finalImage2 = "DiceFour.png";
}
else if (number1 == 11)
{
finalImage2 = "DiceFive.png";
}
else if (number1 == 12)
{
finalImage2 = "DiceSix.png";
}
Dice1.ImageSource = new BitmapImage(new Uri("Images/" + finalImage1, UriKind.Relative)); Dice1.ImageSource = new BitmapImage(new Uri("Images/" + finalImage1, UriKind.Relative));
switch (number2)
{
case 1:
finalImage2 = "DiceOne.png";
break;
case 2:
finalImage2 = "DiceTwo.png";
break;
case 3:
finalImage2 = "DiceThree.png";
break;
case 4:
finalImage2 = "DiceFour.png";
break;
case 5:
finalImage2 = "DiceFive.png";
break;
case 6:
finalImage2 = "DiceSix.png";
break;
default:
finalImage2 = "DiceOne.png";
break;
}
Dice2.ImageSource = new BitmapImage(new Uri("Images/" + finalImage2, UriKind.Relative)); Dice2.ImageSource = new BitmapImage(new Uri("Images/" + finalImage2, UriKind.Relative));
} }
// Handesl Cell click event
private void Button_Click(object sender, RoutedEventArgs e)
{
//cast the sender to Cell
var button = (Button)sender;
// bind the cells position in the array
var column = Grid.GetColumn(button);
var row = Grid.GetRow(button);
var index = column + (row * 10);
// dont`t do anything if the cellalready has a value in it
if (mResults[index] != MarkTyp.Free)
return;
// set the cell value based on which players turn it is (Compact if else statement)
mResults[index] = mPlayer1Turn ? MarkTyp.Player1Red : MarkTyp.Player2Blue;
// set cell color to the result
button.Background = mPlayer1Turn ? Brushes.Red : Brushes.Blue;
//count selectet cells per player
CountCells();
}
// Handel count cells
private void BtnEndTurnClick(object sender, RoutedEventArgs e)
{
// check how many cells the Player marks
PlayerResult();
//count rounds
CountRounds();
// Check if game is end
GameEnded();
mPlayer1Turn ^= true;
cellCounter = 0;
}
} }
} }

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MathColoringGame
{
public enum MarkTyp
{
// Cell hasn´t been fill
Free,
// Cell is red
Player1Red,
//cell is blue
Player2Blue
}
}

View File

@@ -0,0 +1,34 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type Button}"
x:Key="ModernButton">
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="Gadugi"/>
<Setter Property="FontWeight" Value="Light"/>
<Setter Property="Background" Value="#FF6D6D6D"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}" CornerRadius="8"
BorderThickness="4"
BorderBrush="White">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FFA7A7A7"/>
<Setter Property="Opacity" Value="0.8"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>