Skip to content

Commit

Permalink
add card game project template
Browse files Browse the repository at this point in the history
  • Loading branch information
rcarubbi committed Nov 4, 2018
1 parent fc3a3d9 commit 89b64c7
Show file tree
Hide file tree
Showing 16 changed files with 6,185 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CardGameProjectTemplate/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
</configuration>
98 changes: 98 additions & 0 deletions CardGameProjectTemplate/CardGameProjectTemplate.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8F79B246-D5A4-4C5A-A5D2-6F4F1B79F162}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>CardGameProjectTemplate</RootNamespace>
<AssemblyName>CardGameProjectTemplate</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Carubbi.Cards, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Carubbi.Cards.1.1.0\lib\net461\Carubbi.Cards.dll</HintPath>
</Reference>
<Reference Include="Carubbi.Cards.WinForms, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Carubbi.Cards.WinForms.1.0.0\lib\net462\Carubbi.Cards.WinForms.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Logic\Game.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\bg.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\cards-icon.jpg" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
87 changes: 87 additions & 0 deletions CardGameProjectTemplate/Logic/Game.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using Carubbi.Cards;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;

namespace CardGameProjectTemplate.Logic
{
public class Game : INotifyPropertyChanged
{
public Game()
{
Deck = new Deck();

}

private string _gameNumber;

public string GameNumber
{
get => _gameNumber;
set
{
_gameNumber = value;
OnPropertyChanged();
}
}

private Deck Deck { get; }
private CardSet DiscardPile { get; set; }

public void Discard()
{
if (Deck.IsEmpty)
{
return;
}

DiscardCard = Deck.GetTop();
DeckCard = Deck.FirstOrDefault();
DiscardCard.Turn();
DiscardPile.Add(DiscardCard);
}


private Card _discardCard;

public Card DiscardCard
{
get => _discardCard;
set
{
_discardCard = value;
OnPropertyChanged();
}
}

private Card _deckCard;

public Card DeckCard
{
get => _deckCard;
set
{
_deckCard = value;
OnPropertyChanged();
}
}

public event PropertyChangedEventHandler PropertyChanged;


protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));

}

public void Start()
{
Deck.Shuffle(true);
DiscardPile = new CardSet();
DiscardCard = null;
DeckCard = Deck.First();
GameNumber = $"#{Deck.GameNumber}";
}
}
}
Loading

0 comments on commit 89b64c7

Please sign in to comment.