-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3eddd45
commit c9d45d3
Showing
174 changed files
with
13,801 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,19 @@ | ||
# battleships-csharp | ||
WinForm application with server/client | ||
# Battleships C# | ||
Final project for my C# programing class in WinForm applications | ||
|
||
## Components | ||
- Server (Console) | ||
- Client (Windows Forms) | ||
- Library | ||
|
||
## Usage | ||
1. The Console Server application | ||
- Displaying the IPs on which the server listens | ||
- Showing logs | ||
- Changable name by setting more args when running from console | ||
|
||
|
||
2. The Client Application | ||
- Loggin Form | ||
- Lobby Form | ||
- Game Form |
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.1"/> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
<?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>{15B79A33-1392-489D-87E0-3272D64D292B}</ProjectGuid> | ||
<OutputType>WinExe</OutputType> | ||
<RootNamespace>BattleshipsClient</RootNamespace> | ||
<AssemblyName>BattleshipsClient</AssemblyName> | ||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Deterministic>true</Deterministic> | ||
<TargetFrameworkProfile /> | ||
</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="NetworkCommsDotNetComplete"> | ||
<HintPath>F:\PLOCHA\NetworkCommsDotNetComplete.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="Drawing.cs" /> | ||
<Compile Include="GameForm.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="GameForm.Designer.cs"> | ||
<DependentUpon>GameForm.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="GridTile.cs"> | ||
<SubType>Component</SubType> | ||
</Compile> | ||
<Compile Include="LobbyForm.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="LobbyForm.Designer.cs"> | ||
<DependentUpon>LobbyForm.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="LoginForm.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="LoginForm.Designer.cs"> | ||
<DependentUpon>LoginForm.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Utils.cs" /> | ||
<EmbeddedResource Include="GameForm.resx"> | ||
<DependentUpon>GameForm.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="LobbyForm.resx"> | ||
<DependentUpon>LobbyForm.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="LoginForm.resx"> | ||
<DependentUpon>LoginForm.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="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> | ||
<ProjectReference Include="..\BattleshipsLibrary\BattleshipsLibrary.csproj"> | ||
<Project>{9e01c4c2-44e3-4953-a2f7-277f639e8d5d}</Project> | ||
<Name>BattleshipsLibrary</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\Cover.jpg" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\ShipCenter.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\ShipEnd.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\ShipSolo.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\Water.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\Pb1.jpg" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\Pb2.jpg" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\Pb3.jpg" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\Pb4.jpg" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\Pb5.jpg" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\Fire.png" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
2 changes: 2 additions & 0 deletions
2
source/BattleshipsClient/BattleshipsClient.csproj.DotSettings.user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeEditing/Localization/MoveToResource/LastResourceFile/@EntryValue">15B79A33-1392-489D-87E0-3272D64D292B/d:Resources/f:Messages.resx</s:String></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Drawing; | ||
using System.Drawing.Drawing2D; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using BattleshipsClient.Properties; | ||
using BattleshipsLibrary; | ||
|
||
namespace BattleshipsClient | ||
{ | ||
//Třída pro kreslení na GridTile, zakresluje označení, zásah a minutí cíle | ||
static class Drawing | ||
{ | ||
private static Pen _pen = new Pen(Color.Red, 4); | ||
private static int _offset = 5; | ||
|
||
//Označení - "šipka" | ||
public static void DrawSelected(GridTile gridTile, Graphics graphics) | ||
{ | ||
Point[] points = | ||
{ | ||
new Point(gridTile.Width / 2, _offset), | ||
new Point(_offset, gridTile.Height - _offset), | ||
new Point(gridTile.Width - _offset, gridTile.Height - _offset) | ||
}; | ||
|
||
graphics.DrawClosedCurve(_pen, points, 0.3f, FillMode.Winding); | ||
} | ||
|
||
//Zásah - křížek | ||
public static void DrawHit(GridTile gridTile, Graphics graphics) | ||
{ | ||
Point upperLeft = new Point(0 + _offset, 0 + _offset); | ||
Point upperRight = new Point(gridTile.Width - _offset, 0 + _offset); | ||
Point lowerLeft = new Point(0 + _offset, gridTile.Height - _offset); | ||
Point lowerRight = new Point(gridTile.Width - _offset, gridTile.Height - _offset); | ||
|
||
graphics.DrawLine(_pen, upperLeft, lowerRight); | ||
graphics.DrawLine(_pen, upperRight, lowerLeft); | ||
} | ||
|
||
//Minutí - kolečko | ||
public static void DrawMiss(GridTile gridTile, Graphics graphics) | ||
{ | ||
Rectangle r = new Rectangle(0 + _offset, 0 + _offset, gridTile.Width - _offset*2, gridTile.Height - _offset*2); | ||
|
||
graphics.DrawEllipse(_pen, r); | ||
} | ||
|
||
//Oheň | ||
public static void DrawFire(GridTile gridTile, Graphics graphics) | ||
{ | ||
graphics.DrawImage(Resources.Fire, new Point(0,0)); | ||
} | ||
} | ||
} |
Oops, something went wrong.