Initial commit
This commit is contained in:
9
MathColoringGame/App.xaml
Normal file
9
MathColoringGame/App.xaml
Normal file
@@ -0,0 +1,9 @@
|
||||
<Application x:Class="MathColoringGame.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:MathColoringGame"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
17
MathColoringGame/App.xaml.cs
Normal file
17
MathColoringGame/App.xaml.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace MathColoringGame
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
10
MathColoringGame/AssemblyInfo.cs
Normal file
10
MathColoringGame/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
BIN
MathColoringGame/Images/DiceFive.png
Normal file
BIN
MathColoringGame/Images/DiceFive.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
BIN
MathColoringGame/Images/DiceFour.png
Normal file
BIN
MathColoringGame/Images/DiceFour.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
BIN
MathColoringGame/Images/DiceOne.png
Normal file
BIN
MathColoringGame/Images/DiceOne.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
BIN
MathColoringGame/Images/DiceSix.png
Normal file
BIN
MathColoringGame/Images/DiceSix.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 71 KiB |
BIN
MathColoringGame/Images/DiceThree.png
Normal file
BIN
MathColoringGame/Images/DiceThree.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
BIN
MathColoringGame/Images/DiceTwo.png
Normal file
BIN
MathColoringGame/Images/DiceTwo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
99
MathColoringGame/MainWindow.xaml
Normal file
99
MathColoringGame/MainWindow.xaml
Normal file
@@ -0,0 +1,99 @@
|
||||
<Window x:Class="MathColoringGame.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:MathColoringGame"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800"
|
||||
WindowStyle="None"
|
||||
Background="Transparent"
|
||||
AllowsTransparency="True"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
|
||||
<Border CornerRadius="20"
|
||||
Background="Gray">
|
||||
|
||||
<Grid>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="35"/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="230"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Grid.Row="0"
|
||||
Background="Transparent"
|
||||
MouseDown="Border_MouseDown"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
Foreground="White"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,15,0"
|
||||
Height="25"
|
||||
Width="25"
|
||||
Content="✖" Click="BtnExit"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
Foreground="White"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,40,3"
|
||||
Height="25"
|
||||
Width="25"
|
||||
FontWeight="Bold"
|
||||
FontSize="18"
|
||||
Content="▢" Click="BtnMaximizeClick"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
Foreground="White"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,60,6"
|
||||
Height="25"
|
||||
Width="25"
|
||||
FontWeight="Bold"
|
||||
FontSize="18"
|
||||
Content="🗕" Click="BtnMinimizeClick"/>
|
||||
|
||||
<Button Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="100"
|
||||
Height="50"
|
||||
Content="Start Roll" Click="BtnRollClick"/>
|
||||
<Border Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
Width="100"
|
||||
Height="100">
|
||||
<Border.Background>
|
||||
<ImageBrush x:Name="Dice1" ImageSource="/Images/DiceSix.png"/>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<Border Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
Width="100"
|
||||
Height="100">
|
||||
<Border.Background>
|
||||
<ImageBrush x:Name="Dice2" ImageSource="/Images/DiceSix.png"/>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
||||
|
||||
</Window>
|
||||
134
MathColoringGame/MainWindow.xaml.cs
Normal file
134
MathColoringGame/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace MathColoringGame
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void BtnExit(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
private void Border_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed)
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void BtnMinimizeClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
private void BtnMaximizeClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.WindowState == WindowState.Normal)
|
||||
{
|
||||
this.WindowState = WindowState.Maximized;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WindowState = WindowState.Normal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Instantiate random number generator.
|
||||
private readonly Random random = new Random();
|
||||
|
||||
// Gernerates a random number within a range
|
||||
|
||||
public int RandomNumber(int min, int max)
|
||||
{
|
||||
return random.Next(min, max);
|
||||
}
|
||||
|
||||
private void BtnRollClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string finalImage1 = "DiceSix.png";
|
||||
string finalImage2 = "DiceOne.png";
|
||||
|
||||
|
||||
int number1 = RandomNumber(1, 13);
|
||||
|
||||
// Dice1
|
||||
if (number1 == 1)
|
||||
{
|
||||
finalImage1 = "DiceOne.png";
|
||||
}
|
||||
else if (number1 == 2)
|
||||
{
|
||||
finalImage1 = "DiceTwo.png";
|
||||
}
|
||||
else if (number1 == 3)
|
||||
{
|
||||
finalImage1 = "DiceThree.png"; ;
|
||||
}
|
||||
else if (number1 == 4)
|
||||
{
|
||||
finalImage1 = "DiceFour.png";
|
||||
}
|
||||
else if (number1 == 5)
|
||||
{
|
||||
finalImage1 = "DiceFive.png";
|
||||
}
|
||||
else if (number1 == 6)
|
||||
{
|
||||
finalImage1 = "DiceSix.png";
|
||||
}
|
||||
// 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));
|
||||
Dice2.ImageSource = new BitmapImage(new Uri("Images/" + finalImage2, UriKind.Relative));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
40
MathColoringGame/MathColoringGame.csproj
Normal file
40
MathColoringGame/MathColoringGame.csproj
Normal file
@@ -0,0 +1,40 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Images\DiceFive.png" />
|
||||
<None Remove="Images\DiceFour.png" />
|
||||
<None Remove="Images\DiceOne.png" />
|
||||
<None Remove="Images\DiceSix.png" />
|
||||
<None Remove="Images\DiceThree.png" />
|
||||
<None Remove="Images\DiceTwo.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Images\DiceFive.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\DiceFour.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\DiceOne.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\DiceSix.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\DiceThree.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\DiceTwo.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user