zalążek wyświetlania info o domkach

This commit is contained in:
Michał Dulski 2019-05-11 16:03:29 +02:00
parent b192473972
commit 0d840d4a77
3 changed files with 34 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.Input;
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;
using CzokoŚmieciarka.MonoGameView.Algorithms;
@ -37,6 +38,9 @@ namespace CzokoŚmieciarka.MonoGameView
List<IStep> steps;
GarbageCollector collector;
IDrawables[,] grid;
Displayer displayer = new Displayer(){Content = new Dictionary<string, string>()};
public Game1()
{
graphics = new GraphicsDeviceManager(this);
@ -169,8 +173,23 @@ namespace CzokoŚmieciarka.MonoGameView
}
}
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.LastOrDefault().FillPercent.ToString());
}
}
}
catch
{
}
Display(displayer.Content);
spriteBatch.End();
// TODO: Add your drawing code here

View File

@ -47,6 +47,7 @@
<ItemGroup>
<Compile Include="Algorithms\BFS.cs" />
<Compile Include="Algorithms\DFS.cs" />
<Compile Include="DataModels\Displayer.cs" />
<Compile Include="DataModels\Enums\Directions.cs" />
<Compile Include="DataModels\Enums\GarbageTypes.cs" />
<Compile Include="DataModels\Exceptions\Exceptions.cs" />