Dodano projekt MonoGame

This commit is contained in:
Michał Dulski 2019-04-21 15:05:06 +02:00
parent 9aaa79a5c5
commit cb32b99cd9
28 changed files with 718 additions and 64 deletions

View File

@ -11,28 +11,54 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.WPFv2", "I
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.AI_Naive", "Components\CzokoŚmieciarka.AI_Naive\CzokoŚmieciarka.AI_Naive.csproj", "{10E77BBE-55E1-483D-A456-0E94EAC9B24A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.AI_Naive", "Components\CzokoŚmieciarka.AI_Naive\CzokoŚmieciarka.AI_Naive.csproj", "{10E77BBE-55E1-483D-A456-0E94EAC9B24A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.MonoGame", "Interface\CzokoŚmieciarka.MonoGame\CzokoŚmieciarka.MonoGame.csproj", "{3A27CBFB-44DF-4B1D-B776-770FCA3DF905}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|Any CPU.Build.0 = Debug|Any CPU {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|x86.ActiveCfg = Debug|Any CPU
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|x86.Build.0 = Debug|Any CPU
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|Any CPU.ActiveCfg = Release|Any CPU {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|Any CPU.Build.0 = Release|Any CPU {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|Any CPU.Build.0 = Release|Any CPU
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|x86.ActiveCfg = Release|Any CPU
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|x86.Build.0 = Release|Any CPU
{A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|Any CPU.Build.0 = Debug|Any CPU {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|x86.ActiveCfg = Debug|Any CPU
{A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|x86.Build.0 = Debug|Any CPU
{A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|Any CPU.ActiveCfg = Release|Any CPU {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|Any CPU.Build.0 = Release|Any CPU {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|Any CPU.Build.0 = Release|Any CPU
{A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|x86.ActiveCfg = Release|Any CPU
{A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|x86.Build.0 = Release|Any CPU
{2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|Any CPU.Build.0 = Debug|Any CPU {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|x86.ActiveCfg = Debug|Any CPU
{2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|x86.Build.0 = Debug|Any CPU
{2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|Any CPU.ActiveCfg = Release|Any CPU {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|Any CPU.Build.0 = Release|Any CPU {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|Any CPU.Build.0 = Release|Any CPU
{2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|x86.ActiveCfg = Release|Any CPU
{2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|x86.Build.0 = Release|Any CPU
{10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|Any CPU.Build.0 = Debug|Any CPU {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|x86.ActiveCfg = Debug|Any CPU
{10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|x86.Build.0 = Debug|Any CPU
{10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|Any CPU.ActiveCfg = Release|Any CPU {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|Any CPU.Build.0 = Release|Any CPU {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|Any CPU.Build.0 = Release|Any CPU
{10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|x86.ActiveCfg = Release|Any CPU
{10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|x86.Build.0 = Release|Any CPU
{3A27CBFB-44DF-4B1D-B776-770FCA3DF905}.Debug|Any CPU.ActiveCfg = Debug|x86
{3A27CBFB-44DF-4B1D-B776-770FCA3DF905}.Debug|x86.ActiveCfg = Debug|x86
{3A27CBFB-44DF-4B1D-B776-770FCA3DF905}.Debug|x86.Build.0 = Debug|x86
{3A27CBFB-44DF-4B1D-B776-770FCA3DF905}.Release|Any CPU.ActiveCfg = Release|x86
{3A27CBFB-44DF-4B1D-B776-770FCA3DF905}.Release|x86.ActiveCfg = Release|x86
{3A27CBFB-44DF-4B1D-B776-770FCA3DF905}.Release|x86.Build.0 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -0,0 +1,118 @@
#----------------------------- Global Properties ----------------------------#
/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:Windows
/config:
/profile:Reach
/compress:False
#-------------------------------- References --------------------------------#
#---------------------------------- Content ---------------------------------#
#begin Font.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:Font.spritefont
#begin Images/Dumps/glass.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Images/Dumps/glass.png
#begin Images/Dumps/organic.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Images/Dumps/organic.png
#begin Images/Dumps/paper.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Images/Dumps/paper.png
#begin Images/Dumps/plasticmetal.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Images/Dumps/plasticmetal.png
#begin Images/garbageCollector.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Images/garbageCollector.png
#begin Images/house.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Images/house.png
#begin Images/intersection.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Images/intersection.png
#begin Images/intersectionRED.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Images/intersectionRED.png

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
<Asset Type="Graphics:FontDescription">
<!--
Modify this string to change the font that will be imported.
-->
<FontName>Arial</FontName>
<!--
Size is a float value, measured in points. Modify this value to change
the size of the font.
-->
<Size>12</Size>
<!--
Spacing is a float value, measured in pixels. Modify this value to change
the amount of spacing in between characters.
-->
<Spacing>0</Spacing>
<!--
UseKerning controls the layout of the font. If this value is true, kerning information
will be used when placing characters.
-->
<UseKerning>true</UseKerning>
<!--
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
and "Bold, Italic", and are case sensitive.
-->
<Style>Regular</Style>
<!--
If you uncomment this line, the default character will be substituted if you draw
or measure text that contains characters which were not included in the font.
-->
<!-- <DefaultCharacter>*</DefaultCharacter> -->
<!--
CharacterRegions control what letters are available in the font. Every
character from Start to End will be built and made available for drawing. The
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
character set. The characters are ordered according to the Unicode standard.
See the documentation for more information.
-->
<CharacterRegions>
<CharacterRegion>
<Start>&#32;</Start>
<End>&#126;</End>
</CharacterRegion>
</CharacterRegions>
</Asset>
</XnaContent>

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{3A27CBFB-44DF-4B1D-B776-770FCA3DF905}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CzokoŚmieciarka.MonoGame</RootNamespace>
<AssemblyName>CzokoŚmieciarka.MonoGame</AssemblyName>
<FileAlignment>512</FileAlignment>
<MonoGamePlatform>Windows</MonoGamePlatform>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath>
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Compile Include="Game1.cs" />
<Compile Include="Interfaces\IWPFObject.cs" />
<Compile Include="Models\Dump.cs" />
<Compile Include="Models\GarbageCollector.cs" />
<Compile Include="Models\House.cs" />
<Compile Include="Models\Road.cs" />
<Compile Include="Models\Road2.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="MonoGame.Framework">
<HintPath>$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Content Include="Icon.ico" />
</ItemGroup>
<ItemGroup>
<MonoGameContentReference Include="Content\Content.mgcb" />
<None Include="app.manifest" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Components\CzokoŚmieciarka.AI_Naive\CzokoŚmieciarka.AI_Naive.csproj">
<Project>{10e77bbe-55e1-483d-a456-0e94eac9b24a}</Project>
<Name>CzokoŚmieciarka.AI_Naive</Name>
</ProjectReference>
<ProjectReference Include="..\..\Components\CzokoŚmieciarka.DataModels.GeneralModels\CzokoŚmieciarka.DataModels.GeneralModels.csproj">
<Project>{a3d5da96-69d7-463f-b1ee-6fc70716e3b2}</Project>
<Name>CzokoŚmieciarka.DataModels.GeneralModels</Name>
</ProjectReference>
<ProjectReference Include="..\..\Components\CzokoŚmieciarka.DataModels\CzokoŚmieciarka.DataModels.csproj">
<Project>{f2e11fee-c5ac-47d2-ba9c-819909b6dff7}</Project>
<Name>CzokoŚmieciarka.DataModels</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,94 @@
using System.Collections.Generic;
using CzokoŚmieciarka.MonoGame.Interfaces;
using CzokoŚmieciarka.MonoGame.Models;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace CzokoŚmieciarka.MonoGame
{
/// <summary>
/// This is the main type for your game.
/// </summary>
public class Game1 : Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
private Texture2D road;
private IWPFObject[,] Objects = new IWPFObject[9, 9];
private IEnumerable<AGarbageCollectorContainer> GarbageCollectorContainers;
private WPFGarbageCollector garbageCollector;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
// TODO: Add your initialization logic here
base.Initialize();
}
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
road = Content.Load<Texture2D>("Images/intersection");
// TODO: use this.Content to load your game content here
}
/// <summary>
/// UnloadContent will be called once per game and is the place to unload
/// game-specific content.
/// </summary>
protected override void UnloadContent()
{
// TODO: Unload any non ContentManager content here
Content.Unload();
}
/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
// TODO: Add your update logic here
base.Update(gameTime);
}
/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
spriteBatch.Begin();
spriteBatch.Draw(road, new Rectangle(0,0,40,40),Color.White);
spriteBatch.End();
base.Draw(gameTime);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CzokoŚmieciarka.MonoGame.Interfaces
{
public interface IWPFObject
{
Coords Coords { get; set; }
}
}

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CzokoŚmieciarka.DataModels.Enums;
using CzokoŚmieciarka.DataModels.GeneralModels.Models;
using CzokoŚmieciarka.DataModels.Interfaces;
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
using CzokoŚmieciarka.DataModels.Models;
using CzokoŚmieciarka.MonoGame.Interfaces;
namespace CzokoŚmieciarka.MonoGame.Models
{
class WPFDump : ADump, IWPFObject
{
public string ImagePath { get; set; }
public WPFDump(ITypeOfGarbage typeofGarbage, int maxVolume, Coords localization) : base ( typeofGarbage, maxVolume, localization)
{
switch (typeofGarbage.GarbageType)
{
case GarbageType.Glass:
ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\Dumps\glass.png";
break;
case GarbageType.PlasticMetal:
ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\Dumps\plasticmetal.png";
break;
case GarbageType.Organic:
ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\Dumps\organic.png";
break;
case GarbageType.Paper:
ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\Dumps\paper.png";
break;
}
}
}
}

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector;
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
using CzokoŚmieciarka.DataModels.Models;
using CzokoŚmieciarka.MonoGame.Interfaces;
namespace CzokoŚmieciarka.MonoGame.Models
{
class WPFGarbageCollector : AGarbageCollector, IWPFObject, INotifyPropertyChanged
{
public WPFGarbageCollector(Coords startPosition, IEnumerable<AGarbageCollectorContainer> trashContainers, int columns, int rows) : base(startPosition, trashContainers, columns, rows)
{
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CzokoŚmieciarka.DataModels.Interfaces;
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
using CzokoŚmieciarka.DataModels.Models;
using CzokoŚmieciarka.MonoGame.Interfaces;
namespace CzokoŚmieciarka.MonoGame.Models
{
class WPFHouse : IGarbageLocalization, IWPFObject
{
public Coords Coords { get; set; }
public IEnumerable<ATrashCan> TrashCans { get; set; }
public WPFHouse(Coords coords, IEnumerable<ATrashCan> trashCans)
{
TrashCans = trashCans;
Coords = coords;
}
}
}

View File

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mime;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using CzokoŚmieciarka.DataModels.Models;
using CzokoŚmieciarka.MonoGame.Interfaces;
namespace CzokoŚmieciarka.MonoGame.Models
{
class Road : IWPFObject
{
public MediaTypeNames.Image Image
{
get
{
return new MediaTypeNames.Image
{
Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png")),
Width = 100,
Height = 100
};
}
}
public Road()
{
//Image = new Image()
//{
// Source =
// new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png"))
//};
}
public Coords Coords { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CzokoŚmieciarka.DataModels.Models;
using CzokoŚmieciarka.MonoGame.Interfaces;
namespace CzokoŚmieciarka.MonoGame.Models
{
class Road2 : IWPFObject
{
public string ImagePath { get; set; }
public Coords Coords { get; set; }
public Road2()
{
}
}
}

View File

@ -0,0 +1,22 @@
using System;
namespace CzokoŚmieciarka.MonoGame
{
#if WINDOWS || LINUX
/// <summary>
/// The main class.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
using (var game = new Game1())
game.Run();
}
}
#endif
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CzokoŚmieciarka.MonoGame")]
[assembly: AssemblyProduct("CzokoŚmieciarka.MonoGame")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3cdbdf0b-e65f-481e-83b9-45c21a07b884")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="CzokoŚmieciarka.MonoGame"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on and is
is designed to work with. Uncomment the appropriate elements and Windows will
automatically selected the most compatible environment. -->
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
</windowsSettings>
</application>
</assembly>

View File

@ -5,12 +5,10 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CzokoŚmieciarka.WPFv2" xmlns:local="clr-namespace:CzokoŚmieciarka.WPFv2"
mc:Ignorable="d" mc:Ignorable="d"
Title="MainWindow" Height="800" Width="1000" Title="MainWindow" Height="800" Width="800"
KeyDown="MainWindow_OnKeyDown"> KeyDown="MainWindow_OnKeyDown">
<Grid> <Grid Margin="0">
<Grid Name="Board" Margin="0,0,200,0"/> <Canvas Name="Board" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top"/>
<DataGrid Name="CollectorInfo" HorizontalAlignment="Right" Width="192"/>
<Grid Name="CollectorBoard" Margin="0,0,200,0"/>
</Grid> </Grid>
</Window> </Window>

View File

@ -51,18 +51,17 @@ namespace CzokoŚmieciarka.WPFv2
//routePlanningEngine.PerformStep(); //routePlanningEngine.PerformStep();
} }
CollectorBoard.Children.Clear();
Grid.SetColumn(garbageCollector.Image, garbageCollector.Coords.X);
Grid.SetRow(garbageCollector.Image, garbageCollector.Coords.Y);
CollectorBoard.Children.Add(garbageCollector.Image);
Board.Children.Clear(); Board.Children.Clear();
for (int x=0;x<Columns;x++) Canvas.SetLeft(garbageCollector.Image, garbageCollector.Coords.X * 100);
{ Canvas.SetTop(garbageCollector.Image, garbageCollector.Coords.Y * 100);
Board.Children.Add(garbageCollector.Image);
for (int y=0;y<Rows;y++) for (int y=0;y<Rows;y++)
{
for (int x = 0; x < Columns; x++)
{ {
var item = Objects[x, y]; var item = Objects[x, y];
Grid.SetColumn(item.Image, x); Canvas.SetLeft(Objects[x, y].Image, x * 100);
Grid.SetRow(item.Image, y); Canvas.SetTop(Objects[x, y].Image, y * 100);
Board.Children.Add(item.Image); Board.Children.Add(item.Image);
} }
} }
@ -74,44 +73,34 @@ namespace CzokoŚmieciarka.WPFv2
private void BoardInitialize() private void BoardInitialize()
{ {
ColumnDefinition column;
RowDefinition row;
for (int y = 0; y < Rows; y++) for (int y = 0; y < Rows; y++)
{ {
column = new ColumnDefinition();
row = new RowDefinition();
Board.ColumnDefinitions.Add(column);
Board.RowDefinitions.Add(row);
column = new ColumnDefinition();
row = new RowDefinition();
CollectorBoard.ColumnDefinitions.Add(column);
CollectorBoard.RowDefinitions.Add(row);
for (int x = 0; x < Columns; x++) for (int x = 0; x < Columns; x++)
{ {
Road road = new Road(); Road road = new Road();
Objects[x, y] = road; Objects[x, y] = road;
Grid.SetRow(Objects[x, y].Image, y); Canvas.SetLeft(Objects[x, y].Image, x * 100);
Grid.SetColumn(Objects[x, y].Image, x); Canvas.SetTop(Objects[x, y].Image, y * 100);
Board.Children.Add(Objects[x, y].Image); Board.Children.Add(Objects[x, y].Image);
} }
} }
Objects[2,7] = new WPFDump(new TypeOfGarbage(GarbageType.Glass,1,1), 10000,new Coords(2,7)); //Objects[2,7] = new WPFDump(new TypeOfGarbage(GarbageType.Glass,1,1), 10000,new Coords(2,7));
Grid.SetColumn(Objects[2, 7].Image, 2); //Grid.SetColumn(Objects[2, 7].Image, 2);
Grid.SetRow(Objects[2, 7].Image, 7); //Grid.SetRow(Objects[2, 7].Image, 7);
Board.Children.Add(Objects[2, 7].Image); //Board.Children.Add(Objects[2, 7].Image);
Objects[3,7] = new WPFDump(new TypeOfGarbage(GarbageType.Organic,1,1),10000, new Coords(3,7)); //Objects[3,7] = new WPFDump(new TypeOfGarbage(GarbageType.Organic,1,1),10000, new Coords(3,7));
Grid.SetColumn(Objects[3, 7].Image, 3); //Grid.SetColumn(Objects[3, 7].Image, 3);
Grid.SetRow(Objects[3, 7].Image, 7); //Grid.SetRow(Objects[3, 7].Image, 7);
Board.Children.Add(Objects[3, 7].Image); //Board.Children.Add(Objects[3, 7].Image);
Objects[2,8] = new WPFDump(new TypeOfGarbage(GarbageType.Paper,1,1), 10000, new Coords(2,8)); //Objects[2,8] = new WPFDump(new TypeOfGarbage(GarbageType.Paper,1,1), 10000, new Coords(2,8));
Grid.SetColumn(Objects[2, 8].Image, 2); //Grid.SetColumn(Objects[2, 8].Image, 2);
Grid.SetRow(Objects[2, 8].Image, 8); //Grid.SetRow(Objects[2, 8].Image, 8);
Board.Children.Add(Objects[2, 8].Image); //Board.Children.Add(Objects[2, 8].Image);
Objects[3,8] = new WPFDump(new TypeOfGarbage(GarbageType.PlasticMetal, 1,1), 10000, new Coords(3,8)); //Objects[3,8] = new WPFDump(new TypeOfGarbage(GarbageType.PlasticMetal, 1,1), 10000, new Coords(3,8));
Grid.SetColumn(Objects[3, 8].Image, 3); //Grid.SetColumn(Objects[3, 8].Image, 3);
Grid.SetRow(Objects[3, 8].Image, 8); //Grid.SetRow(Objects[3, 8].Image, 8);
Board.Children.Add(Objects[3, 8].Image); //Board.Children.Add(Objects[3, 8].Image);
GarbageCollectorContainers = new List<AGarbageCollectorContainer>() GarbageCollectorContainers = new List<AGarbageCollectorContainer>()
@ -122,10 +111,9 @@ namespace CzokoŚmieciarka.WPFv2
new GarbageCollectorContainer(new TypeOfGarbage(GarbageType.Paper, 1,1), 500) new GarbageCollectorContainer(new TypeOfGarbage(GarbageType.Paper, 1,1), 500)
}; };
garbageCollector = new WPFGarbageCollector(new Coords(2, 1), GarbageCollectorContainers, Columns, Rows); garbageCollector = new WPFGarbageCollector(new Coords(2, 1), GarbageCollectorContainers, Columns, Rows);
Grid.SetRow(garbageCollector.Image, garbageCollector.Coords.Y); Canvas.SetLeft(garbageCollector.Image, garbageCollector.Coords.X * 100);
Grid.SetColumn(garbageCollector.Image, garbageCollector.Coords.X); Canvas.SetTop(garbageCollector.Image, garbageCollector.Coords.Y * 100);
CollectorBoard.Children.Add(garbageCollector.Image); Board.Children.Add(garbageCollector.Image);
CollectorBoard.ShowGridLines = true;
//CollectorInfo.ItemsSource = garbageCollector; //CollectorInfo.ItemsSource = garbageCollector;
//CollectorInfo.Items.Add(garbageCollector); //CollectorInfo.Items.Add(garbageCollector);
//CollectorInfo.Columns.Add(new DataGridTextColumn {Header="X", Binding = new Binding("Coords.X")}); //CollectorInfo.Columns.Add(new DataGridTextColumn {Header="X", Binding = new Binding("Coords.X")});
@ -140,8 +128,8 @@ namespace CzokoŚmieciarka.WPFv2
WPFHouse house = new WPFHouse(new Coords(1, 3), trashCans); WPFHouse house = new WPFHouse(new Coords(1, 3), trashCans);
Objects[1, 3] = house; Objects[1, 3] = house;
Grid.SetRow(Objects[1, 3].Image, 3); Canvas.SetLeft(Objects[1, 3].Image, 1 * 100);
Grid.SetColumn(Objects[1, 3].Image, 1); Canvas.SetTop(Objects[1, 3].Image, 3 * 100);
Board.Children.Add(Objects[1, 3].Image); Board.Children.Add(Objects[1, 3].Image);

View File

@ -33,7 +33,9 @@ namespace CzokoŚmieciarka.WPFv2.Models
{ {
Image = new Image() Image = new Image()
{ {
Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png")) Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png")),
Width = 100,
Height = 100
}; };
} }

View File

@ -30,7 +30,9 @@ namespace CzokoŚmieciarka.WPFv2.Models
{ {
Image = new Image() Image = new Image()
{ {
Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\house.png")) Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\house.png")),
Width = 100,
Height = 100
}; };
TrashCans = trashCans; TrashCans = trashCans;
Coords = coords; Coords = coords;

View File

@ -13,24 +13,26 @@ namespace CzokoŚmieciarka.WPFv2.Models
{ {
class Road : IWPFObject class Road : IWPFObject
{ {
public Image Image { get; set; } public Image Image
//{ {
// get get
// { {
// return new Image return new Image
// { {
// Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png")) Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png")),
// }; Width = 100,
// } Height = 100
//} };
}
}
public Road() public Road()
{ {
Image = new Image() //Image = new Image()
{ //{
Source = // Source =
new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png")) // new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png"))
}; //};
} }
public Coords Coords { get; set; } public Coords Coords { get; set; }