Wyświetlanie ilości śmieci w śmieciarce

This commit is contained in:
Michał Dulski 2019-05-13 19:22:46 +02:00
parent 1aa5affaf3
commit 091b11445e

View File

@ -148,7 +148,15 @@ namespace CzokoŚmieciarka.MonoGameView
}
*/
// TODO: Add your update logic here
var collectorDictionary = new Dictionary<string, string>
{
{"Garbage Collector Info", ""},
{collector.TrashContainers.ElementAtOrDefault(0).TypeOfGarbage.GarbageType.ToString(), collector.TrashContainers.ElementAtOrDefault(0).Garbage.Weight.ToString()},
{collector.TrashContainers.ElementAtOrDefault(1).TypeOfGarbage.GarbageType.ToString(), collector.TrashContainers.ElementAtOrDefault(1).Garbage.Weight.ToString()},
{collector.TrashContainers.ElementAtOrDefault(2).TypeOfGarbage.GarbageType.ToString(), collector.TrashContainers.ElementAtOrDefault(2).Garbage.Weight.ToString()},
{collector.TrashContainers.ElementAtOrDefault(3).TypeOfGarbage.GarbageType.ToString(), collector.TrashContainers.ElementAtOrDefault(3).Garbage.Weight.ToString()}
};
displayer.Content = collectorDictionary;
base.Update(gameTime);
}
@ -165,15 +173,11 @@ namespace CzokoŚmieciarka.MonoGameView
{
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);
grid[x, y].Draw(spriteBatch, size);
}
}
collector.Draw(spriteBatch, size);
Display(displayer.Content);
spriteBatch.End();
// TODO: Add your drawing code here
@ -184,18 +188,18 @@ namespace CzokoŚmieciarka.MonoGameView
///
/// </summary>
/// <param name="info"></param>
//public void Display(Dictionary<string, string> info)
//{
// int x = 510;
// int y = 10;
// foreach (KeyValuePair<string, string> item in info)
// {
// spriteBatch.DrawString(font, item.Key, new Vector2(x, y),Color.Black);
// y += 15;
// spriteBatch.DrawString(font, item.Value, new Vector2(x, y), Color.White);
// y += 30;
public void Display(Dictionary<string, string> info)
{
int x = 510;
int y = 10;
foreach (KeyValuePair<string, string> item in info)
{
spriteBatch.DrawString(font, item.Key, new Vector2(x, y), Color.Black);
y += 15;
spriteBatch.DrawString(font, item.Value, new Vector2(x, y), Color.White);
y += 30;
// }
//}
}
}
}
}