This commit is contained in:
ryuga4 2019-05-13 13:40:55 +02:00
commit e861f1fa7b
4 changed files with 208 additions and 1 deletions

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MonoGameView.DataModels
{
public class Displayer
{
public Dictionary<string,string> Content { get; set; }
}
}

View File

@ -6,6 +6,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input;
using System; using System;
using System.CodeDom;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using CzokoŚmieciarka.MonoGameView.Algorithms; using CzokoŚmieciarka.MonoGameView.Algorithms;
@ -37,6 +38,9 @@ namespace CzokoŚmieciarka.MonoGameView
List<IStep> steps; List<IStep> steps;
GarbageCollector collector; GarbageCollector collector;
IDrawables[,] grid; IDrawables[,] grid;
Displayer displayer = new Displayer(){Content = new Dictionary<string, string>()};
public Game1() public Game1()
{ {
graphics = new GraphicsDeviceManager(this); graphics = new GraphicsDeviceManager(this);
@ -169,8 +173,26 @@ namespace CzokoŚmieciarka.MonoGameView
} }
} }
collector.Draw(spriteBatch, size); collector.Draw(spriteBatch, size);
Display(new Dictionary<string, string>(){["Dupa"] = "123", ["Stefan"] = "555", ["Dupa1"] = "123", ["Stefan1"] = "555", ["Dupa2"] = "123", ["Stefan2"] = "555"}); displayer.Content = new Dictionary<string, string>();
try
{
foreach (var item in grid)
{
if (item is House)
{
var house = item as House;
displayer.Content.Add(house.Coords.X.ToString() + ":" + house.Coords.Y.ToString() + house.TrashCans.ElementAtOrDefault(0).Garbage.TypeOfGarbage.GarbageType.ToString(), house.TrashCans.ElementAtOrDefault(0).Garbage.Volume.ToString());
displayer.Content.Add(house.Coords.X.ToString() + ":" + house.Coords.Y.ToString() + house.TrashCans.ElementAtOrDefault(1).Garbage.TypeOfGarbage.GarbageType.ToString(), house.TrashCans.ElementAtOrDefault(1).Garbage.Volume.ToString());
displayer.Content.Add(house.Coords.X.ToString() + ":" + house.Coords.Y.ToString() + house.TrashCans.ElementAtOrDefault(2).Garbage.TypeOfGarbage.GarbageType.ToString(), house.TrashCans.ElementAtOrDefault(2).Garbage.Volume.ToString());
displayer.Content.Add(house.Coords.X.ToString() + ":" + house.Coords.Y.ToString() + house.TrashCans.ElementAtOrDefault(3).Garbage.TypeOfGarbage.GarbageType.ToString(), house.TrashCans.ElementAtOrDefault(3).Garbage.Volume.ToString());
}
}
}
catch
{
}
Display(displayer.Content);
spriteBatch.End(); spriteBatch.End();
// TODO: Add your drawing code here // TODO: Add your drawing code here

View File

@ -41,9 +41,13 @@
<PropertyGroup> <PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Algorithms\BFS.cs" /> <Compile Include="Algorithms\BFS.cs" />
<Compile Include="Algorithms\DFS.cs" /> <Compile Include="Algorithms\DFS.cs" />
<Compile Include="DataModels\Displayer.cs" />
<Compile Include="DataModels\Enums\Directions.cs" /> <Compile Include="DataModels\Enums\Directions.cs" />
<Compile Include="DataModels\Enums\GarbageTypes.cs" /> <Compile Include="DataModels\Enums\GarbageTypes.cs" />
<Compile Include="DataModels\Exceptions\Exceptions.cs" /> <Compile Include="DataModels\Exceptions\Exceptions.cs" />

View File

@ -174,6 +174,48 @@
100 100
</Volume> </Volume>
</Can> </Can>
<Can>
<GarbageType>
Organic
</GarbageType>
<Density>
1
</Density>
<ProcessingTimePerUnit>
1
</ProcessingTimePerUnit>
<Volume>
100
</Volume>
</Can>
<Can>
<GarbageType>
Paper
</GarbageType>
<Density>
1
</Density>
<ProcessingTimePerUnit>
1
</ProcessingTimePerUnit>
<Volume>
100
</Volume>
</Can>
<Can>
<GarbageType>
PlasticMetal
</GarbageType>
<Density>
1
</Density>
<ProcessingTimePerUnit>
1
</ProcessingTimePerUnit>
<Volume>
100
</Volume>
</Can>
</TrashCans> </TrashCans>
</Object> </Object>
<Object> <Object>
@ -280,6 +322,48 @@
<Volume> <Volume>
100 100
</Volume> </Volume>
</Can>
<Can>
<GarbageType>
Organic
</GarbageType>
<Density>
1
</Density>
<ProcessingTimePerUnit>
1
</ProcessingTimePerUnit>
<Volume>
100
</Volume>
</Can>
<Can>
<GarbageType>
Paper
</GarbageType>
<Density>
1
</Density>
<ProcessingTimePerUnit>
1
</ProcessingTimePerUnit>
<Volume>
100
</Volume>
</Can>
<Can>
<GarbageType>
PlasticMetal
</GarbageType>
<Density>
1
</Density>
<ProcessingTimePerUnit>
1
</ProcessingTimePerUnit>
<Volume>
100
</Volume>
</Can> </Can>
</TrashCans> </TrashCans>
</Object> </Object>
@ -1171,6 +1255,48 @@
<Volume> <Volume>
100 100
</Volume> </Volume>
</Can>
<Can>
<GarbageType>
Organic
</GarbageType>
<Density>
1
</Density>
<ProcessingTimePerUnit>
1
</ProcessingTimePerUnit>
<Volume>
100
</Volume>
</Can>
<Can>
<GarbageType>
Paper
</GarbageType>
<Density>
1
</Density>
<ProcessingTimePerUnit>
1
</ProcessingTimePerUnit>
<Volume>
100
</Volume>
</Can>
<Can>
<GarbageType>
PlasticMetal
</GarbageType>
<Density>
1
</Density>
<ProcessingTimePerUnit>
1
</ProcessingTimePerUnit>
<Volume>
100
</Volume>
</Can> </Can>
</TrashCans> </TrashCans>
</Object> </Object>
@ -1278,6 +1404,48 @@
<Volume> <Volume>
100 100
</Volume> </Volume>
</Can>
<Can>
<GarbageType>
Organic
</GarbageType>
<Density>
1
</Density>
<ProcessingTimePerUnit>
1
</ProcessingTimePerUnit>
<Volume>
100
</Volume>
</Can>
<Can>
<GarbageType>
Paper
</GarbageType>
<Density>
1
</Density>
<ProcessingTimePerUnit>
1
</ProcessingTimePerUnit>
<Volume>
100
</Volume>
</Can>
<Can>
<GarbageType>
PlasticMetal
</GarbageType>
<Density>
1
</Density>
<ProcessingTimePerUnit>
1
</ProcessingTimePerUnit>
<Volume>
100
</Volume>
</Can> </Can>
</TrashCans> </TrashCans>
</Object> </Object>