diff --git a/Trunk/Components/CzokoŚmieciarka.AI_Naive/CzokoŚmieciarka.AI_Naive.csproj b/Trunk/Components/CzokoŚmieciarka.AI_Naive/CzokoŚmieciarka.AI_Naive.csproj index 756d35c..72141fe 100644 --- a/Trunk/Components/CzokoŚmieciarka.AI_Naive/CzokoŚmieciarka.AI_Naive.csproj +++ b/Trunk/Components/CzokoŚmieciarka.AI_Naive/CzokoŚmieciarka.AI_Naive.csproj @@ -1,54 +1,58 @@ - - - - - Debug - AnyCPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A} - Library - Properties - CzokoŚmieciarka.AI_Naive - CzokoŚmieciarka.AI_Naive - v4.6.1 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - {f2e11fee-c5ac-47d2-ba9c-819909b6dff7} - CzokoŚmieciarka.DataModels - - - + + + + + Debug + AnyCPU + {10E77BBE-55E1-483D-A456-0E94EAC9B24A} + Library + Properties + CzokoŚmieciarka.AI_Naive + CzokoŚmieciarka.AI_Naive + v4.6.1 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + {a3d5da96-69d7-463f-b1ee-6fc70716e3b2} + CzokoŚmieciarka.DataModels.GeneralModels + + + {f2e11fee-c5ac-47d2-ba9c-819909b6dff7} + CzokoŚmieciarka.DataModels + + + \ No newline at end of file diff --git a/Trunk/Components/CzokoŚmieciarka.AI_Naive/RoutePlanningEngine.cs b/Trunk/Components/CzokoŚmieciarka.AI_Naive/RoutePlanningEngine.cs deleted file mode 100644 index ed0112a..0000000 --- a/Trunk/Components/CzokoŚmieciarka.AI_Naive/RoutePlanningEngine.cs +++ /dev/null @@ -1,116 +0,0 @@ -using CzokoŚmieciarka.DataModels.Enums; -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.RoutePlanningEngine; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; -using CzokoŚmieciarka.DataModels.Models.Steps; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Czoko_Smieciarka.AI_Naive -{ - public class RoutePlanningEngine : IRoutePlanningEngine - { - public IGarbageCollector Collector { get; } - public IEnumerable Cans { get; } - public IEnumerable Dumps { get; } - - - - enum State { TravelToDump, TravelToCan, Wait, Finish } - public Coords Destination { get; set; } - public object DestinationObject { get; set; } - private State CurrentState { get; set; } - - public void PerformStep() - { - PerformMove(); - } - - public RoutePlanningEngine(IGarbageCollector collector, IEnumerable cans, IEnumerable dumps) - { - this.Collector = collector; - this.Cans = cans; - this.Dumps = dumps; - this.CurrentState = State.Wait; - } - - - private bool PerformMove() - { - - switch (CurrentState) - { - case State.TravelToDump: - if (Destination == Collector.Coords) - { - var dump = (DestinationObject as ADump); - var step = new SpillStep(Collector, dump, dump.TypeOfGarbage); - step.Invoke(); - this.CurrentState = State.Wait; - } - else - { - var dif = Destination - Collector.Coords; - Direction nextDirection = (dif.X == 0) ? - ((dif.Y > 0) ? Direction.Up : Direction.Down) : - ((dif.X > 0) ? Direction.Right : Direction.Left); - - var step = new MoveStep(nextDirection, Collector); - step.Invoke(); - } - break; - case State.TravelToCan: - if (Destination == Collector.Coords) - { - var garbage = (DestinationObject as IGarbageLocalization); - foreach (var item in garbage.TrashCans) - { - var step = new CollectStep(Collector, garbage, item.TypeOfGarbage); - step.Invoke(); - } - - this.CurrentState = State.Wait; - } - else - { - var dif = Destination - Collector.Coords; - Direction nextDirection = (dif.X == 0) ? - ((dif.Y > 0) ? Direction.Up : Direction.Down) : - ((dif.X > 0) ? Direction.Right : Direction.Left); - - var step = new MoveStep(nextDirection, Collector); - step.Invoke(); - } - break; - case State.Wait: - var notEmpty = Collector.TrashContainers.Where(i => i.FillPercent > 0); - if (notEmpty.Any()) - { - var destDump = Dumps.First(i => i.TypeOfGarbage == notEmpty.First().TypeOfGarbage); - this.Destination = destDump.Coords; - this.CurrentState = State.TravelToDump; - } - else - { - var notEmptyCans = Cans.Where(i => i.TrashCans.Any(j => j.FillPercent > 0)); - if (notEmptyCans.Any()) - { - this.Destination = notEmptyCans.First().Coords; - this.CurrentState = State.TravelToCan; - } - else - { - this.CurrentState = State.Finish; - } - } - break; - case State.Finish: - return false; - } - return true; - - } - } -} \ No newline at end of file diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/Dump.cs b/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/Dump.cs deleted file mode 100644 index ea9d2b7..0000000 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/Dump.cs +++ /dev/null @@ -1,13 +0,0 @@ -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; - -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models -{ - public class Dump : ADump - { - public Dump(ITypeOfGarbage typeOfGarbage, int maxVolume, Coords localization) : base(typeOfGarbage, maxVolume, localization) - { - } - } -} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageCollector.cs b/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageCollector.cs deleted file mode 100644 index 5a224df..0000000 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageCollector.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; -using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; - -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models -{ - public class GarbageCollector : AGarbageCollector - { - public GarbageCollector(Coords startPosition, IEnumerable trashContainers, int columns, int rows) : base(startPosition, trashContainers, columns, rows) - { - } - } -} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/CzokoŚmieciarka.DataModels.csproj b/Trunk/Components/CzokoŚmieciarka.DataModels/CzokoŚmieciarka.DataModels.csproj index 1104398..f1402e1 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/CzokoŚmieciarka.DataModels.csproj +++ b/Trunk/Components/CzokoŚmieciarka.DataModels/CzokoŚmieciarka.DataModels.csproj @@ -1,68 +1,53 @@ - - - - - Debug - AnyCPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7} - Library - Properties - CzokoŚmieciarka.DataModels - CzokoŚmieciarka.DataModels - v4.6.1 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + AnyCPU + {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7} + Library + Properties + CzokoŚmieciarka.DataModels + CzokoŚmieciarka.DataModels + v4.6.1 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Exceptions/OutOfGridException.cs b/Trunk/Components/CzokoŚmieciarka.DataModels/Exceptions/OutOfGridException.cs deleted file mode 100644 index a0c69cc..0000000 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Exceptions/OutOfGridException.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CzokoŚmieciarka.DataModels.Exceptions -{ - public class OutOfGridException : Exception - { - public OutOfGridException() - { - } - public OutOfGridException(string message) - : base(message) - { - } - - public OutOfGridException(string message, Exception inner) - : base(message, inner) - { - } - } -} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IStep.cs b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IStep.cs deleted file mode 100644 index fa8c4ad..0000000 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IStep.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CzokoŚmieciarka.DataModels.Interfaces -{ - public interface IStep - { - void Invoke(); - } -} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Road/IRoad.cs b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Road/IRoad.cs new file mode 100644 index 0000000..ffe723d --- /dev/null +++ b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Road/IRoad.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.DataModels.Interfaces.Road +{ + public interface IRoad + { + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Road/IRoad2.cs b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Road/IRoad2.cs new file mode 100644 index 0000000..9c30c0f --- /dev/null +++ b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Road/IRoad2.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.DataModels.Interfaces.Road +{ + public interface IRoad2 + { + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs deleted file mode 100644 index ebace0a..0000000 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; - -namespace CzokoŚmieciarka.DataModels.Interfaces.RoutePlanningEngine -{ - public interface IRoutePlanningEngine - { - void PerformStep(); - } -} \ No newline at end of file diff --git a/Trunk/CzokoŚmieciarka.sln b/Trunk/CzokoŚmieciarka.sln index fa54b36..c584a58 100644 --- a/Trunk/CzokoŚmieciarka.sln +++ b/Trunk/CzokoŚmieciarka.sln @@ -3,62 +3,31 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.28307.136 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.DataModels", "Components\CzokoŚmieciarka.DataModels\CzokoŚmieciarka.DataModels.csproj", "{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.DataModels.GeneralModels", "Components\CzokoŚmieciarka.DataModels.GeneralModels\CzokoŚmieciarka.DataModels.GeneralModels.csproj", "{A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.WPFv2", "Interface\CzokoŚmieciarka.WPFv2\CzokoŚmieciarka.WPFv2.csproj", "{2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}" -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}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.MonoGame", "Interface\CzokoŚmieciarka.MonoGame\CzokoŚmieciarka.MonoGame.csproj", "{3A27CBFB-44DF-4B1D-B776-770FCA3DF905}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGameView", "MonoGameView\MonoGameView.csproj", "{EBE9431C-9B66-4300-B288-7A0F7B899415}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {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|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.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.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.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.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.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.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.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 + {EBE9431C-9B66-4300-B288-7A0F7B899415}.Debug|Any CPU.ActiveCfg = Debug|x86 + {EBE9431C-9B66-4300-B288-7A0F7B899415}.Debug|Any CPU.Build.0 = Debug|x86 + {EBE9431C-9B66-4300-B288-7A0F7B899415}.Debug|ARM.ActiveCfg = Debug|x86 + {EBE9431C-9B66-4300-B288-7A0F7B899415}.Debug|x64.ActiveCfg = Debug|x86 + {EBE9431C-9B66-4300-B288-7A0F7B899415}.Debug|x86.ActiveCfg = Debug|x86 + {EBE9431C-9B66-4300-B288-7A0F7B899415}.Debug|x86.Build.0 = Debug|x86 + {EBE9431C-9B66-4300-B288-7A0F7B899415}.Release|Any CPU.ActiveCfg = Release|x86 + {EBE9431C-9B66-4300-B288-7A0F7B899415}.Release|ARM.ActiveCfg = Release|x86 + {EBE9431C-9B66-4300-B288-7A0F7B899415}.Release|x64.ActiveCfg = Release|x86 + {EBE9431C-9B66-4300-B288-7A0F7B899415}.Release|x86.ActiveCfg = Release|x86 + {EBE9431C-9B66-4300-B288-7A0F7B899415}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Trunk/Interface/CzokoŚmieciarka.WPFv2/CzokoŚmieciarka.WPFv2.csproj b/Trunk/Interface/CzokoŚmieciarka.WPFv2/CzokoŚmieciarka.WPFv2.csproj index 588269c..e146b90 100644 --- a/Trunk/Interface/CzokoŚmieciarka.WPFv2/CzokoŚmieciarka.WPFv2.csproj +++ b/Trunk/Interface/CzokoŚmieciarka.WPFv2/CzokoŚmieciarka.WPFv2.csproj @@ -1,120 +1,107 @@ - - - - - Debug - AnyCPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947} - WinExe - CzokoŚmieciarka.WPFv2 - CzokoŚmieciarka.WPFv2 - v4.6.1 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - 4.0 - - - - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - - MainWindow.xaml - Code - - - - - - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - {10e77bbe-55e1-483d-a456-0e94eac9b24a} - CzokoŚmieciarka.AI_Naive - - - {a3d5da96-69d7-463f-b1ee-6fc70716e3b2} - CzokoŚmieciarka.DataModels.GeneralModels - - - {f2e11fee-c5ac-47d2-ba9c-819909b6dff7} - CzokoŚmieciarka.DataModels - - - - + + + + + Debug + AnyCPU + {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947} + WinExe + CzokoŚmieciarka.WPFv2 + CzokoŚmieciarka.WPFv2 + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + MainWindow.xaml + Code + + + + + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + \ No newline at end of file diff --git a/Trunk/Interface/CzokoŚmieciarka.WPFv2/MainWindow.xaml.cs b/Trunk/Interface/CzokoŚmieciarka.WPFv2/MainWindow.xaml.cs index 1940503..8eb0dd9 100644 --- a/Trunk/Interface/CzokoŚmieciarka.WPFv2/MainWindow.xaml.cs +++ b/Trunk/Interface/CzokoŚmieciarka.WPFv2/MainWindow.xaml.cs @@ -13,7 +13,6 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -using Czoko_Smieciarka.AI_Naive; using CzokoŚmieciarka.DataModels.Enums; using CzokoŚmieciarka.DataModels.GeneralModels.Models; using CzokoŚmieciarka.DataModels.Interfaces; @@ -34,7 +33,6 @@ namespace CzokoŚmieciarka.WPFv2 IWPFObject[,] Objects = new IWPFObject[Columns,Rows]; private IEnumerable GarbageCollectorContainers; private WPFGarbageCollector garbageCollector; - private RoutePlanningEngine routePlanningEngine; public MainWindow() { @@ -133,14 +131,7 @@ namespace CzokoŚmieciarka.WPFv2 Board.Children.Add(Objects[1, 3].Image); - routePlanningEngine = new RoutePlanningEngine(garbageCollector, - new List() - { - new GarbageLocalization(house.Coords,house.TrashCans) - }, - new List() - { - }); + } } } diff --git a/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/ImageContainer.cs b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/ImageContainer.cs new file mode 100644 index 0000000..5804482 --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/ImageContainer.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Windows.Media.Imaging; + +namespace CzokoŚmieciarka.WPFv2.Models +{ + public sealed class ImageContainer + { + private static ImageContainer _Instance = null; + + private Dictionary Images; + + + public static ImageContainer Instance { + get { + if (_Instance == null) + { + _Instance = new ImageContainer(); + } + return _Instance; + } + } + + public ImageContainer() + { + Images = new Dictionary(); + Images.Add("Road", new Image { Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png")) }); + } + + + public Image GetImage(string s) + { + return Images[s]; + } + } +} diff --git a/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road.cs b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road.cs index 4c81dd5..c682cd6 100644 --- a/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road.cs +++ b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road.cs @@ -7,32 +7,24 @@ using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Imaging; using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.DataModels.Interfaces; using CzokoŚmieciarka.WPFv2.Interfaces; namespace CzokoŚmieciarka.WPFv2.Models { - class Road : IWPFObject + class Road : IWPFObject, IRoad { - public Image Image + public Image Image { get { - return new Image - { - Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png")), - Width = 100, - Height = 100 - }; + return ImageContainer.Instance.GetImage("Road"); } } public Road() { - //Image = new Image() - //{ - // Source = - // new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png")) - //}; + } public Coords Coords { get; set; } diff --git a/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road2.cs b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road2.cs index 10a51a2..6201a0a 100644 --- a/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road2.cs +++ b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road2.cs @@ -7,10 +7,11 @@ using System.Windows.Controls; using System.Windows.Media.Imaging; using CzokoŚmieciarka.DataModels.Models; using CzokoŚmieciarka.WPFv2.Interfaces; +using CzokoŚmieciarka.DataModels.Interfaces; namespace CzokoŚmieciarka.WPFv2.Models { - class Road2 : IWPFObject + class Road2 : IWPFObject, IRoad { public string ImagePath { get; set; } public Image Image { get; set; } diff --git a/Trunk/MonoGameView/Algorithms/DFS.cs b/Trunk/MonoGameView/Algorithms/DFS.cs new file mode 100644 index 0000000..a7cf1a7 --- /dev/null +++ b/Trunk/MonoGameView/Algorithms/DFS.cs @@ -0,0 +1,105 @@ +using CzokoŚmieciarka.MonoGameView.DataModels.Enums; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; +using CzokoŚmieciarka.MonoGameView.DataModels.Models.Steps; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework.Content; + +namespace CzokoŚmieciarka.MonoGameView.Algorithms +{ + public class DFS + { + public DFS() + { + } + int count = 0; + + + public List BestPath(ContentManager content, AGarbageCollector collector, object[,] grid) + { + var r=Search(content, collector, grid, 0).Key; + Console.WriteLine(count); + return r; + } + + List PossibleSteps(ContentManager content, AGarbageCollector collector, object[,] grid) + { + + + var result = new List(); + var moveSteps = new List() + { + new MoveStep(Direction.Up), + new MoveStep(Direction.Down), + new MoveStep(Direction.Left), + new MoveStep(Direction.Right) + }; + var filteredMoveSteps = new List(); + foreach (var item in moveSteps) + { + var copyCollector = (AGarbageCollector)collector.Clone(content); + var copyGrid = (object[,])grid.Clone(); + try + { + item.Invoke(copyCollector, grid); + var gcx = copyCollector.Coords.X; + var gcy = copyCollector.Coords.Y; + if (grid[gcx, gcy] is IRoad1 || grid[gcx, gcy] is IGarbageLocalization || grid[gcx, gcy] is ADump) + { + result.Add(item); + } + } + catch (Exception e) + { + + } + } + + return result; + } + + KeyValuePair, int> Search(ContentManager content, AGarbageCollector collector, object[,] grid, int length) + { + count++; + if (length > 40) return new KeyValuePair, int>(new List(), length); + var possibleSteps = PossibleSteps(content, collector, grid); + + foreach (var item in possibleSteps) + { + var copyCollector = (AGarbageCollector)collector.Clone(content); + var copyGrid = (object[,])grid.Clone(); + + + //if (copyGrid[copyCollector.Coords.X, copyCollector.Coords.Y] is IRoad1) copyGrid[copyCollector.Coords.X, copyCollector.Coords.Y] = new Road2(); + item.Invoke(copyCollector, copyGrid); + var s = Search(content, copyCollector, copyGrid, length + 1); + if (s.Key != null) + { + s.Key.Insert(0, item); + return s; + } + } + return new KeyValuePair, int>(null, length); + /*var min = int.MaxValue; + var min_index = 0; + for (int i = 0; i < mapped.Count; i++) + { + if (mapped.ElementAt(i).Value <= min) + { + min = mapped.ElementAt(i).Value; + min_index = i; + } + } + return mapped.ElementAt(min_index); + */ + + + } + } +} diff --git a/Trunk/MonoGameView/Content/Content.mgcb b/Trunk/MonoGameView/Content/Content.mgcb new file mode 100644 index 0000000..60deb1d --- /dev/null +++ b/Trunk/MonoGameView/Content/Content.mgcb @@ -0,0 +1,75 @@ + +#----------------------------- Global Properties ----------------------------# + +/outputDir:bin/$(Platform) +/intermediateDir:obj/$(Platform) +/platform:Windows +/config: +/profile:Reach +/compress:False + +#-------------------------------- References --------------------------------# + + +#---------------------------------- Content ---------------------------------# + +#begin collector.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:collector.png + +#begin grass.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:grass.png + +#begin 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:house.png + +#begin road1.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:road1.png + +#begin road2.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:road2.png + diff --git a/Trunk/MonoGameView/Content/Dumps/glass.png b/Trunk/MonoGameView/Content/Dumps/glass.png new file mode 100644 index 0000000..60a475e Binary files /dev/null and b/Trunk/MonoGameView/Content/Dumps/glass.png differ diff --git a/Trunk/MonoGameView/Content/Dumps/organic.png b/Trunk/MonoGameView/Content/Dumps/organic.png new file mode 100644 index 0000000..fec2e9e Binary files /dev/null and b/Trunk/MonoGameView/Content/Dumps/organic.png differ diff --git a/Trunk/MonoGameView/Content/Dumps/paper.png b/Trunk/MonoGameView/Content/Dumps/paper.png new file mode 100644 index 0000000..548493e Binary files /dev/null and b/Trunk/MonoGameView/Content/Dumps/paper.png differ diff --git a/Trunk/MonoGameView/Content/Dumps/plasticmetal.png b/Trunk/MonoGameView/Content/Dumps/plasticmetal.png new file mode 100644 index 0000000..cbf47a7 Binary files /dev/null and b/Trunk/MonoGameView/Content/Dumps/plasticmetal.png differ diff --git a/Trunk/MonoGameView/Content/collector.png b/Trunk/MonoGameView/Content/collector.png new file mode 100644 index 0000000..296e3a5 Binary files /dev/null and b/Trunk/MonoGameView/Content/collector.png differ diff --git a/Trunk/MonoGameView/Content/grass.png b/Trunk/MonoGameView/Content/grass.png new file mode 100644 index 0000000..f9f1991 Binary files /dev/null and b/Trunk/MonoGameView/Content/grass.png differ diff --git a/Trunk/MonoGameView/Content/house.png b/Trunk/MonoGameView/Content/house.png new file mode 100644 index 0000000..b2bcc94 Binary files /dev/null and b/Trunk/MonoGameView/Content/house.png differ diff --git a/Trunk/MonoGameView/Content/road1.png b/Trunk/MonoGameView/Content/road1.png new file mode 100644 index 0000000..2f84feb Binary files /dev/null and b/Trunk/MonoGameView/Content/road1.png differ diff --git a/Trunk/MonoGameView/Content/road2.png b/Trunk/MonoGameView/Content/road2.png new file mode 100644 index 0000000..ad1f45b Binary files /dev/null and b/Trunk/MonoGameView/Content/road2.png differ diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Enums/Directions.cs b/Trunk/MonoGameView/DataModels/Enums/Directions.cs similarity index 61% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Enums/Directions.cs rename to Trunk/MonoGameView/DataModels/Enums/Directions.cs index 1c46e50..aff1717 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Enums/Directions.cs +++ b/Trunk/MonoGameView/DataModels/Enums/Directions.cs @@ -1,4 +1,4 @@ -namespace CzokoŚmieciarka.DataModels.Enums +namespace CzokoŚmieciarka.MonoGameView.DataModels.Enums { public enum Direction { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Enums/GarbageTypes.cs b/Trunk/MonoGameView/DataModels/Enums/GarbageTypes.cs similarity index 80% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Enums/GarbageTypes.cs rename to Trunk/MonoGameView/DataModels/Enums/GarbageTypes.cs index ce58a4a..755bb93 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Enums/GarbageTypes.cs +++ b/Trunk/MonoGameView/DataModels/Enums/GarbageTypes.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace CzokoŚmieciarka.DataModels.Enums +namespace CzokoŚmieciarka.MonoGameView.DataModels.Enums { public enum GarbageType { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Exceptions.cs b/Trunk/MonoGameView/DataModels/Exceptions/Exceptions.cs similarity index 63% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Exceptions.cs rename to Trunk/MonoGameView/DataModels/Exceptions/Exceptions.cs index fb15cd3..52ec2f5 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Exceptions.cs +++ b/Trunk/MonoGameView/DataModels/Exceptions/Exceptions.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace CzokoŚmieciarka.DataModels +namespace CzokoŚmieciarka.MonoGameView.DataModels.Exceptions { public class WrongPositionException : Exception { @@ -26,4 +26,20 @@ namespace CzokoŚmieciarka.DataModels } } + public class OutOfGridException : Exception + { + public OutOfGridException() + { + } + public OutOfGridException(string message) + : base(message) + { + } + + public OutOfGridException(string message, Exception inner) + : base(message, inner) + { + } + } + } diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Garbage/AGarbage.cs b/Trunk/MonoGameView/DataModels/Interfaces/Garbage/AGarbage.cs similarity index 93% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Garbage/AGarbage.cs rename to Trunk/MonoGameView/DataModels/Interfaces/Garbage/AGarbage.cs index 1ae2f2a..3c71b29 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Garbage/AGarbage.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/Garbage/AGarbage.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace CzokoŚmieciarka.DataModels.Interfaces +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.Garbage { public abstract class AGarbage : IGarbage { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Garbage/IGarbage.cs b/Trunk/MonoGameView/DataModels/Interfaces/Garbage/IGarbage.cs similarity index 79% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Garbage/IGarbage.cs rename to Trunk/MonoGameView/DataModels/Interfaces/Garbage/IGarbage.cs index f76aef2..097f8b7 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Garbage/IGarbage.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/Garbage/IGarbage.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace CzokoŚmieciarka.DataModels.Interfaces +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.Garbage { public interface IGarbage : ICloneable { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs b/Trunk/MonoGameView/DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs similarity index 72% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs rename to Trunk/MonoGameView/DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs index 414d5d6..4c0d953 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs @@ -3,65 +3,70 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Exceptions; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGameView.DataModels.Exceptions; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; +using Microsoft.Xna.Framework.Content; -namespace CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector { - public abstract class AGarbageCollector : IGarbageCollector + public abstract class AGarbageCollector : IGarbageCollector, ICloneable { public AGarbageCollector(Coords startPosition, IEnumerable trashContainers, int columns, int rows) - { - this.columns = columns; + { + this.columns = columns; this.rows = rows; this.Coords = startPosition; this.TrashContainers = trashContainers; } - public Coords Coords { get; set; } - public int columns { get; set; } + public Coords Coords { get; set; } + public int columns { get; set; } public int rows { get; set; } public void MoveUp() { - if(Coords.Y -1 < 0) - { - throw new OutOfGridException(); + if(Coords.Y -1 < 0) + { + throw new OutOfGridException(); } Coords.Y -= 1; } public void MoveDown() { - if (Coords.Y + 1 >= rows) - { - throw new OutOfGridException(); + if (Coords.Y + 1 >= rows) + { + throw new OutOfGridException(); } Coords.Y +=1; } public void MoveLeft() { - if (Coords.X - 1 < 0) - { - throw new OutOfGridException(); + if (Coords.X - 1 < 0) + { + throw new OutOfGridException(); } Coords.X -= 1; } public void MoveRight() { - if (Coords.X + 1 >= columns) - { - throw new OutOfGridException(); + if (Coords.X + 1 >= columns) + { + throw new OutOfGridException(); } - Coords.X += 1; - } - - public object Clone() - { - return this.MemberwiseClone(); - } - + Coords.X += 1; + } + + public virtual object Clone(ContentManager content) + { + throw new NotImplementedException(); + } + public IEnumerable TrashContainers { get; } + public object Clone() + { + throw new NotImplementedException(); + } } } diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/IGarbageCollector.cs b/Trunk/MonoGameView/DataModels/Interfaces/GarbageCollector/IGarbageCollector.cs similarity index 65% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/IGarbageCollector.cs rename to Trunk/MonoGameView/DataModels/Interfaces/GarbageCollector/IGarbageCollector.cs index 89bc30e..c705805 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/IGarbageCollector.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/GarbageCollector/IGarbageCollector.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; -namespace CzokoŚmieciarka.DataModels.Interfaces +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector { public interface IGarbageCollector : ICloneable { diff --git a/Trunk/MonoGameView/DataModels/Interfaces/IDrawables.cs b/Trunk/MonoGameView/DataModels/Interfaces/IDrawables.cs new file mode 100644 index 0000000..b212af0 --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Interfaces/IDrawables.cs @@ -0,0 +1,10 @@ +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces +{ + public interface IDrawables + { + void Draw(ContentManager content, SpriteBatch spriteBatch, int size); + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IGarbageLocalization.cs b/Trunk/MonoGameView/DataModels/Interfaces/IGarbageLocalization.cs similarity index 58% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IGarbageLocalization.cs rename to Trunk/MonoGameView/DataModels/Interfaces/IGarbageLocalization.cs index 55435a7..08c4fcd 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IGarbageLocalization.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/IGarbageLocalization.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; -namespace CzokoŚmieciarka.DataModels.Interfaces +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces { public interface IGarbageLocalization { diff --git a/Trunk/MonoGameView/DataModels/Interfaces/IHouse.cs b/Trunk/MonoGameView/DataModels/Interfaces/IHouse.cs new file mode 100644 index 0000000..d03aa40 --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Interfaces/IHouse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces +{ + public interface IHouse + { + } +} diff --git a/Trunk/MonoGameView/DataModels/Interfaces/IRoad.cs b/Trunk/MonoGameView/DataModels/Interfaces/IRoad.cs new file mode 100644 index 0000000..5c03df8 --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Interfaces/IRoad.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces +{ + public interface IRoad + { + } +} diff --git a/Trunk/MonoGameView/DataModels/Interfaces/IRoad1.cs b/Trunk/MonoGameView/DataModels/Interfaces/IRoad1.cs new file mode 100644 index 0000000..9c8382f --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Interfaces/IRoad1.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces +{ + public interface IRoad1 + { + } +} diff --git a/Trunk/MonoGameView/DataModels/Interfaces/IRoad2.cs b/Trunk/MonoGameView/DataModels/Interfaces/IRoad2.cs new file mode 100644 index 0000000..e962c74 --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Interfaces/IRoad2.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces +{ + public interface IRoad2 + { + } +} diff --git a/Trunk/MonoGameView/DataModels/Interfaces/IStep.cs b/Trunk/MonoGameView/DataModels/Interfaces/IStep.cs new file mode 100644 index 0000000..f526bec --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Interfaces/IStep.cs @@ -0,0 +1,9 @@ +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces +{ + public interface IStep + { + void Invoke(IGarbageCollector collector, object [,] grid); + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/ITypeOfGarbage.cs b/Trunk/MonoGameView/DataModels/Interfaces/ITypeOfGarbage.cs similarity index 71% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/ITypeOfGarbage.cs rename to Trunk/MonoGameView/DataModels/Interfaces/ITypeOfGarbage.cs index b8b65c0..f7e6e85 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/ITypeOfGarbage.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/ITypeOfGarbage.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Enums; +using CzokoŚmieciarka.MonoGameView.DataModels.Enums; -namespace CzokoŚmieciarka.DataModels.Interfaces +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces { public interface ITypeOfGarbage { diff --git a/Trunk/MonoGameView/DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs b/Trunk/MonoGameView/DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs new file mode 100644 index 0000000..23defd3 --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.RoutePlanningEngine +{ + public interface IRoutePlanningEngine + { + IEnumerable ReturnSteps(); + } +} \ No newline at end of file diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/ADump.cs b/Trunk/MonoGameView/DataModels/Interfaces/TrashCans/ADump.cs similarity index 69% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/ADump.cs rename to Trunk/MonoGameView/DataModels/Interfaces/TrashCans/ADump.cs index d59ce30..59094fd 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/ADump.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/TrashCans/ADump.cs @@ -1,6 +1,6 @@ -using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; -namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans { public abstract class ADump : ATrashCan { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/AGarbageCollectorContainer.cs b/Trunk/MonoGameView/DataModels/Interfaces/TrashCans/AGarbageCollectorContainer.cs similarity index 75% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/AGarbageCollectorContainer.cs rename to Trunk/MonoGameView/DataModels/Interfaces/TrashCans/AGarbageCollectorContainer.cs index 6c49db5..de7a40c 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/AGarbageCollectorContainer.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/TrashCans/AGarbageCollectorContainer.cs @@ -1,4 +1,4 @@ -namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans { public abstract class AGarbageCollectorContainer : ATrashCan { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/ATrashCan.cs b/Trunk/MonoGameView/DataModels/Interfaces/TrashCans/ATrashCan.cs similarity index 90% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/ATrashCan.cs rename to Trunk/MonoGameView/DataModels/Interfaces/TrashCans/ATrashCan.cs index 9d900cf..5df8a4b 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/ATrashCan.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/TrashCans/ATrashCan.cs @@ -1,6 +1,7 @@ using System; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.Garbage; -namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans { public abstract class ATrashCan { diff --git a/Trunk/MonoGameView/DataModels/MapLoader.cs b/Trunk/MonoGameView/DataModels/MapLoader.cs new file mode 100644 index 0000000..77c61eb --- /dev/null +++ b/Trunk/MonoGameView/DataModels/MapLoader.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; +using CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; +using MonoGameView.DataModels.Models; + +namespace MonoGameView.DataModels +{ + public class MapLoader + { + public void Load(out int size, out object[,] grid, string filename) + { + XmlDocument xml = new XmlDocument(); + xml.Load(filename); + XmlNode node = xml.GetElementsByTagName("Map").Item(0); + XmlNode sizeNode = node.SelectSingleNode("/Map/Size"); + size = Convert.ToInt32(sizeNode.InnerText); + grid = new object[size,size]; + for (int x = 0; x < size; x++) + { + for (int y = 0; y < size; y++) + { + grid[x, y] = new Grass(new Coords(x,y)); + } + } + foreach(XmlNode objectNode in node.SelectNodes("/Map/Objects/Object")) + { + XmlNode positionNode; + int x; + int y; + switch (objectNode.SelectSingleNode("Type").InnerText) + { + case "Road": + positionNode = objectNode.SelectSingleNode("Position"); + x = Convert.ToInt32(positionNode.SelectSingleNode("X").InnerText); + y = Convert.ToInt32(positionNode.SelectSingleNode("Y").InnerText); + Road1 road = new Road1(new Coords(x,y)); + grid[x, y] = road; + break; + case "House": + positionNode = objectNode.SelectSingleNode("Position"); + x = Convert.ToInt32(positionNode.SelectSingleNode("X").InnerText); + y = Convert.ToInt32(positionNode.SelectSingleNode("Y").InnerText); + House house = new House(new Coords(x,y)); + grid[x, y] = house; + break; + } + } + } + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Coords.cs b/Trunk/MonoGameView/DataModels/Models/Coords.cs similarity index 69% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Models/Coords.cs rename to Trunk/MonoGameView/DataModels/Models/Coords.cs index b1d9ede..8d27913 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Coords.cs +++ b/Trunk/MonoGameView/DataModels/Models/Coords.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace CzokoŚmieciarka.DataModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models { public class Coords { @@ -35,5 +35,20 @@ namespace CzokoŚmieciarka.DataModels.Models { return new Coords(a.X - b.X, a.Y - b.Y); } + + public override string ToString() + { + return base.ToString(); + } + + public override bool Equals(object obj) + { + return base.Equals(obj); + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } } } diff --git a/Trunk/MonoGameView/DataModels/Models/Dump.cs b/Trunk/MonoGameView/DataModels/Models/Dump.cs new file mode 100644 index 0000000..2de111e --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Models/Dump.cs @@ -0,0 +1,13 @@ +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models +{ + public class Dump : ADump + { + public Dump(ITypeOfGarbage typeOfGarbage, int maxVolume, Coords localization) : base(typeOfGarbage, maxVolume, localization) + { + } + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/Garbage.cs b/Trunk/MonoGameView/DataModels/Models/Garbage.cs similarity index 70% rename from Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/Garbage.cs rename to Trunk/MonoGameView/DataModels/Models/Garbage.cs index 059e9f7..165d1a2 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/Garbage.cs +++ b/Trunk/MonoGameView/DataModels/Models/Garbage.cs @@ -1,7 +1,8 @@ using System; -using CzokoŚmieciarka.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.Garbage; -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models { public class Garbage : AGarbage { diff --git a/Trunk/MonoGameView/DataModels/Models/GarbageCollector.cs b/Trunk/MonoGameView/DataModels/Models/GarbageCollector.cs new file mode 100644 index 0000000..206cf26 --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Models/GarbageCollector.cs @@ -0,0 +1,33 @@ +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models +{ + public class GarbageCollector : AGarbageCollector, IDrawables + { + public GarbageCollector(Coords c, List l, int rows, int cols) : base(c,l,rows,cols) + { + } + + public void Draw(ContentManager content, SpriteBatch batch,int size) + { + batch.Draw(content.Load("collector"), new Rectangle(Coords.X*500/size, Coords.Y*500/size, 500/size, 500/size), Color.White); + } + + + public override object Clone(ContentManager content) + { + var cloneList = new List(); + return new GarbageCollector(new Coords(Coords.X,Coords.Y), cloneList, rows,columns); + } + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageCollectorContainer.cs b/Trunk/MonoGameView/DataModels/Models/GarbageCollectorContainer.cs similarity index 52% rename from Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageCollectorContainer.cs rename to Trunk/MonoGameView/DataModels/Models/GarbageCollectorContainer.cs index 9b095ea..7f0fbc3 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageCollectorContainer.cs +++ b/Trunk/MonoGameView/DataModels/Models/GarbageCollectorContainer.cs @@ -1,7 +1,7 @@ -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models { public class GarbageCollectorContainer : AGarbageCollectorContainer { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageLocalization.cs b/Trunk/MonoGameView/DataModels/Models/GarbageLocalization.cs similarity index 65% rename from Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageLocalization.cs rename to Trunk/MonoGameView/DataModels/Models/GarbageLocalization.cs index 29f38a8..ca22d01 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageLocalization.cs +++ b/Trunk/MonoGameView/DataModels/Models/GarbageLocalization.cs @@ -3,11 +3,11 @@ 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.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models { public class GarbageLocalization : IGarbageLocalization { diff --git a/Trunk/MonoGameView/DataModels/Models/Grass.cs b/Trunk/MonoGameView/DataModels/Models/Grass.cs new file mode 100644 index 0000000..d450ab9 --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Models/Grass.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace MonoGameView.DataModels.Models +{ + public class Grass : IDrawables + { + private Coords Coords; + + public Grass(Coords coords) + { + Coords = coords; + } + + public void Draw(ContentManager content, SpriteBatch batch, int size) + { + batch.Draw(content.Load("grass"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, 500 / size, 500 / size), Color.White); + } + } +} diff --git a/Trunk/MonoGameView/DataModels/Models/House.cs b/Trunk/MonoGameView/DataModels/Models/House.cs new file mode 100644 index 0000000..66fe936 --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Models/House.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models +{ + public class House : IDrawables + { + private Coords Coords; + + public House(Coords coords) + { + Coords = coords; + } + public void Draw(ContentManager content, SpriteBatch batch, int size) + { + batch.Draw(content.Load("house"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, 500 / size, 500 / size), Color.White); + } + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Map.cs b/Trunk/MonoGameView/DataModels/Models/Map.cs similarity index 77% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Models/Map.cs rename to Trunk/MonoGameView/DataModels/Models/Map.cs index 3cd1057..b117992 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Map.cs +++ b/Trunk/MonoGameView/DataModels/Models/Map.cs @@ -4,9 +4,10 @@ using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using Microsoft.Xna.Framework; -namespace CzokoŚmieciarka.DataModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models { public class Map { diff --git a/Trunk/MonoGameView/DataModels/Models/Road1.cs b/Trunk/MonoGameView/DataModels/Models/Road1.cs new file mode 100644 index 0000000..399dbec --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Models/Road1.cs @@ -0,0 +1,27 @@ +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models +{ + public class Road1 :IRoad1 + { + private Coords Coords; + + public Road1(Coords coords) + { + Coords = coords; + } + + public void Draw(ContentManager content, SpriteBatch batch, int size) + { + batch.Draw(content.Load("grass"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, 500 / size, 500 / size), Color.White); + } + } +} diff --git a/Trunk/MonoGameView/DataModels/Models/Road2.cs b/Trunk/MonoGameView/DataModels/Models/Road2.cs new file mode 100644 index 0000000..1838d6b --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Models/Road2.cs @@ -0,0 +1,13 @@ +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models +{ + public class Road2 : IRoad2 + { + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/CollectStep.cs b/Trunk/MonoGameView/DataModels/Models/Steps/CollectStep.cs similarity index 64% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/CollectStep.cs rename to Trunk/MonoGameView/DataModels/Models/Steps/CollectStep.cs index 48d5a81..75ebfe7 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/CollectStep.cs +++ b/Trunk/MonoGameView/DataModels/Models/Steps/CollectStep.cs @@ -3,26 +3,24 @@ 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.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; -namespace CzokoŚmieciarka.DataModels.Models.Steps +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models.Steps { public class CollectStep : IStep { - public CollectStep(IGarbageCollector garbageCollector, IGarbageLocalization garbageLocalization, ITypeOfGarbage typeOfGarbage) + public CollectStep(ITypeOfGarbage typeOfGarbage) { - this._garbageCollector = garbageCollector; - this._garbageLocalization = garbageLocalization; this._typeOfGarbage = typeOfGarbage; } - private IGarbageCollector _garbageCollector; private ITypeOfGarbage _typeOfGarbage; - private IGarbageLocalization _garbageLocalization; - public void Invoke() + public void Invoke(IGarbageCollector garbageCollector, object [,] grid) { + /* if(_garbageCollector.Coords != _garbageLocalization.Coords) throw new WrongPositionException("Śmieciarka nie jest w miejscu oderbania śmieci"); @@ -33,6 +31,7 @@ namespace CzokoŚmieciarka.DataModels.Models.Steps throw new TrashContainerNotFound($"Nie znaleziono kontenera na {_typeOfGarbage.GarbageType}."); _garbageCollector.TrashContainers.First(t => t.TypeOfGarbage == _typeOfGarbage).AddGarbage(garbage); + */ } } } diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/MoveStep.cs b/Trunk/MonoGameView/DataModels/Models/Steps/MoveStep.cs similarity index 52% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/MoveStep.cs rename to Trunk/MonoGameView/DataModels/Models/Steps/MoveStep.cs index 49ffe36..6f377fa 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/MoveStep.cs +++ b/Trunk/MonoGameView/DataModels/Models/Steps/MoveStep.cs @@ -3,25 +3,27 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Enums; -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Enums; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; -namespace CzokoŚmieciarka.DataModels.Models.Steps +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models.Steps { public class MoveStep : IStep { - public MoveStep(Direction direction, IGarbageCollector garbageCollector) + public MoveStep(Direction direction) { - this._garbageCollector = garbageCollector; this._direction = direction; } private Direction _direction; private IGarbageCollector _garbageCollector; - public void Invoke() + public void Invoke(IGarbageCollector _garbageCollector, object[,] grid) { + if(grid[_garbageCollector.Coords.X, _garbageCollector.Coords.Y] is Road1) + grid[_garbageCollector.Coords.X, _garbageCollector.Coords.Y] = new Road2(); switch (_direction) { case Direction.Up: _garbageCollector.MoveUp(); break; diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/SpillStep.cs b/Trunk/MonoGameView/DataModels/Models/Steps/SpillStep.cs similarity index 67% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/SpillStep.cs rename to Trunk/MonoGameView/DataModels/Models/Steps/SpillStep.cs index a9d8cb9..d259717 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/SpillStep.cs +++ b/Trunk/MonoGameView/DataModels/Models/Steps/SpillStep.cs @@ -3,26 +3,23 @@ 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.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; -namespace CzokoŚmieciarka.DataModels.Models.Steps +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models.Steps { public class SpillStep : IStep { - public SpillStep(IGarbageCollector garbageCollector, ADump dump, ITypeOfGarbage typeOfGarbage) + public SpillStep(ITypeOfGarbage typeOfGarbage) { - this._garbageCollector = garbageCollector; - this._dump = dump; this._typeOfGarbage = typeOfGarbage; } - - private IGarbageCollector _garbageCollector; - private ADump _dump; + private ITypeOfGarbage _typeOfGarbage; - public void Invoke() - { + public void Invoke(IGarbageCollector garbageCollector, object [,] grid) + {/* if(_garbageCollector.Coords != _dump.Coords) throw new WrongPositionException("Śmieciarka nie na terenie podanego wyspiska"); @@ -36,7 +33,7 @@ namespace CzokoŚmieciarka.DataModels.Models.Steps .Select(t => t.TakeGarbage()) .Aggregate((a, b) => a + b); - _dump.AddGarbage(garbage); + _dump.AddGarbage(garbage);*/ } } } diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/TrashCan.cs b/Trunk/MonoGameView/DataModels/Models/TrashCan.cs similarity index 61% rename from Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/TrashCan.cs rename to Trunk/MonoGameView/DataModels/Models/TrashCan.cs index c42c7ef..74a0637 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/TrashCan.cs +++ b/Trunk/MonoGameView/DataModels/Models/TrashCan.cs @@ -1,7 +1,7 @@ -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models { public class TrashCan : ATrashCan { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/TypeOfGarbage.cs b/Trunk/MonoGameView/DataModels/Models/TypeOfGarbage.cs similarity index 71% rename from Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/TypeOfGarbage.cs rename to Trunk/MonoGameView/DataModels/Models/TypeOfGarbage.cs index 38f6415..c942553 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/TypeOfGarbage.cs +++ b/Trunk/MonoGameView/DataModels/Models/TypeOfGarbage.cs @@ -1,7 +1,7 @@ -using CzokoŚmieciarka.DataModels.Enums; -using CzokoŚmieciarka.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Enums; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models { public class TypeOfGarbage : ITypeOfGarbage { diff --git a/Trunk/MonoGameView/Game1.cs b/Trunk/MonoGameView/Game1.cs new file mode 100644 index 0000000..1426aba --- /dev/null +++ b/Trunk/MonoGameView/Game1.cs @@ -0,0 +1,146 @@ +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using System; +using System.Collections.Generic; +using System.Linq; +using CzokoŚmieciarka.MonoGameView.Algorithms; +using MonoGameView.DataModels; + +namespace CzokoŚmieciarka.MonoGameView +{ + /// + /// This is the main type for your game. + /// + public class Game1 : Game + { + private static int size; + GraphicsDeviceManager graphics; + SpriteBatch spriteBatch; + Texture2D road1; + Texture2D road2; + Texture2D grass; + Texture2D house; + MapLoader mapLoader = new MapLoader(); + Vector2 roadPos; + float timer; + const float TIMER = 0.2f; + int stepN; + List steps; + GarbageCollector collector; + object[,] grid; + public Game1() + { + graphics = new GraphicsDeviceManager(this); + Content.RootDirectory = "Content"; + graphics.PreferredBackBufferWidth = 500; + graphics.PreferredBackBufferHeight = 500; + } + + + + /// + /// 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. + /// + protected override void Initialize() + { + // TODO: Add your initialization logic here + roadPos = new Vector2(0, 0); + timer = 0.2f; + + mapLoader.Load(out size,out grid,"map.xml"); + collector = new GarbageCollector(new Coords(0, 0), new List(), size, size); + + + stepN = 0; + var dfs = new DFS(); + steps = dfs.BestPath(Content, collector, grid); + + base.Initialize(); + } + + /// + /// LoadContent will be called once per game and is the place to load + /// all of your content. + /// + protected override void LoadContent() + { + // Create a new SpriteBatch, which can be used to draw textures. + spriteBatch = new SpriteBatch(GraphicsDevice); + road1 = Content.Load("road1"); + road2 = Content.Load("road2"); + grass = Content.Load("grass"); + house = Content.Load("house"); + // TODO: use this.Content to load your game content here + } + + /// + /// UnloadContent will be called once per game and is the place to unload + /// game-specific content. + /// + protected override void UnloadContent() + { + Content.Unload(); + // TODO: Unload any non ContentManager content here + } + + /// + /// Allows the game to run logic such as updating the world, + /// checking for collisions, gathering input, and playing audio. + /// + /// Provides a snapshot of timing values. + protected override void Update(GameTime gameTime) + { + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) + Exit(); + var elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; + timer -= elapsed; + if (timer<0) + { + timer = TIMER; + if (steps.Any()) + { + steps.First().Invoke(collector, grid); + steps.RemoveAt(0); + } + } + // TODO: Add your update logic here + + base.Update(gameTime); + } + + /// + /// This is called when the game should draw itself. + /// + /// Provides a snapshot of timing values. + protected override void Draw(GameTime gameTime) + { + GraphicsDevice.Clear(Color.CornflowerBlue); + spriteBatch.Begin(); + + for (int x = 0; x < size; x++) + { + for (int y = 0; y < size; y++) + { + if (grid[x, y] is Road1) spriteBatch.Draw(road1, new Rectangle(x*500 / size, y*500 / size, 500/size, 500/size),Color.White); + else if (grid[x,y] is Road2) spriteBatch.Draw(road2, new Rectangle(x * 500 / size, y * 500 / size, 500 / size, 500 / size), Color.White); + else if (grid[x, y] is House) spriteBatch.Draw(house, new Rectangle(x * 500 / size, y * 500 / size, 500 / size, 500 / size), Color.White); + else spriteBatch.Draw(grass, new Rectangle(x * 500 / size, y * 500 / size, 500 / size, 500 / size), Color.White); + } + } + collector.Draw(Content, spriteBatch, size); + + spriteBatch.End(); + // TODO: Add your drawing code here + + base.Draw(gameTime); + } + } +} diff --git a/Trunk/MonoGameView/Icon.ico b/Trunk/MonoGameView/Icon.ico new file mode 100644 index 0000000..7d9dec1 Binary files /dev/null and b/Trunk/MonoGameView/Icon.ico differ diff --git a/Trunk/MonoGameView/MonoGameView.csproj b/Trunk/MonoGameView/MonoGameView.csproj new file mode 100644 index 0000000..3c34106 --- /dev/null +++ b/Trunk/MonoGameView/MonoGameView.csproj @@ -0,0 +1,111 @@ + + + + + Debug + x86 + 8.0.30703 + 2.0 + {EBE9431C-9B66-4300-B288-7A0F7B899415} + WinExe + Properties + MonoGameView + MonoGameView + 512 + Windows + v4.6.1 + + + + x86 + true + full + false + bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ + DEBUG;TRACE;WINDOWS + prompt + 4 + + + x86 + pdbonly + true + bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ + TRACE;WINDOWS + prompt + 4 + + + Icon.ico + + + app.manifest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Trunk/MonoGameView/Program.cs b/Trunk/MonoGameView/Program.cs new file mode 100644 index 0000000..ce4ea53 --- /dev/null +++ b/Trunk/MonoGameView/Program.cs @@ -0,0 +1,22 @@ +using System; + +namespace CzokoŚmieciarka.MonoGameView +{ +#if WINDOWS || LINUX + /// + /// The main class. + /// + public static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + using (var game = new Game1()) + game.Run(); + } + } +#endif +} diff --git a/Trunk/MonoGameView/Properties/AssemblyInfo.cs b/Trunk/MonoGameView/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..434fec3 --- /dev/null +++ b/Trunk/MonoGameView/Properties/AssemblyInfo.cs @@ -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("MonoGameView")] +[assembly: AssemblyProduct("MonoGameView")] +[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("0ff0f801-46a1-4452-8feb-12cb0986ff52")] + +// 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")] diff --git a/Trunk/MonoGameView/app.config b/Trunk/MonoGameView/app.config new file mode 100644 index 0000000..d405098 --- /dev/null +++ b/Trunk/MonoGameView/app.config @@ -0,0 +1,3 @@ + + + diff --git a/Trunk/MonoGameView/app.manifest b/Trunk/MonoGameView/app.manifest new file mode 100644 index 0000000..86e21ed --- /dev/null +++ b/Trunk/MonoGameView/app.manifest @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true/pm + + + +