Wyświetlanie pasków śmieci przy domkach

This commit is contained in:
Michał Dulski 2019-05-13 17:19:02 +02:00
parent a70153a4d3
commit 1aa5affaf3
8 changed files with 70 additions and 33 deletions

View File

@ -44,6 +44,18 @@
/processorParam:TextureFormat=Color /processorParam:TextureFormat=Color
/build:glass.png /build:glass.png
#begin glassBar.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:glassBar.png
#begin grass.png #begin grass.png
/importer:TextureImporter /importer:TextureImporter
/processor:TextureProcessor /processor:TextureProcessor
@ -80,6 +92,18 @@
/processorParam:TextureFormat=Color /processorParam:TextureFormat=Color
/build:organic.png /build:organic.png
#begin organicBar.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:organicBar.png
#begin paper.png #begin paper.png
/importer:TextureImporter /importer:TextureImporter
/processor:TextureProcessor /processor:TextureProcessor
@ -92,6 +116,18 @@
/processorParam:TextureFormat=Color /processorParam:TextureFormat=Color
/build:paper.png /build:paper.png
#begin paperBar.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:paperBar.png
#begin plasticmetal.png #begin plasticmetal.png
/importer:TextureImporter /importer:TextureImporter
/processor:TextureProcessor /processor:TextureProcessor
@ -104,6 +140,18 @@
/processorParam:TextureFormat=Color /processorParam:TextureFormat=Color
/build:plasticmetal.png /build:plasticmetal.png
#begin plasticMetalBar.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:plasticMetalBar.png
#begin road1.png #begin road1.png
/importer:TextureImporter /importer:TextureImporter
/processor:TextureProcessor /processor:TextureProcessor

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

View File

@ -25,6 +25,11 @@ namespace CzokoŚmieciarka.MonoGameView.DataModels.Models
public void Draw(SpriteBatch batch, int size) public void Draw(SpriteBatch batch, int size)
{ {
batch.Draw(ImageContainer.GetImage("house"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, 500 / size, 500 / size), Color.White); batch.Draw(ImageContainer.GetImage("house"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, 500 / size, 500 / size), Color.White);
batch.Draw(ImageContainer.GetImage("GlassBar"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, (int)Math.Round(TrashCans.ElementAtOrDefault(0).FillPercent*500) / size, 50 / size), Color.White);
batch.Draw(ImageContainer.GetImage("PaperBar"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size + 5, (int)Math.Round(TrashCans.ElementAtOrDefault(1).FillPercent * 500) / size, 50 / size), Color.White);
batch.Draw(ImageContainer.GetImage("PlasticMetalBar"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size + 10, (int)Math.Round(TrashCans.ElementAtOrDefault(2).FillPercent * 500) / size, 50 / size), Color.White);
batch.Draw(ImageContainer.GetImage("OrganicBar"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size + 15, (int)Math.Round(TrashCans.ElementAtOrDefault(3).FillPercent * 500) / size, 50 / size), Color.White);
} }
public object Clone() public object Clone()

View File

@ -25,7 +25,10 @@ namespace MonoGameView.DataModels.Models
_container.Images.Add("Paper", content.Load<Texture2D>("paper")); _container.Images.Add("Paper", content.Load<Texture2D>("paper"));
_container.Images.Add("PlasticMetal", content.Load<Texture2D>("plasticmetal")); _container.Images.Add("PlasticMetal", content.Load<Texture2D>("plasticmetal"));
_container.Images.Add("Organic", content.Load<Texture2D>("organic")); _container.Images.Add("Organic", content.Load<Texture2D>("organic"));
_container.Images.Add("GlassBar", content.Load<Texture2D>("glassBar"));
_container.Images.Add("PaperBar", content.Load<Texture2D>("paperBar"));
_container.Images.Add("PlasticMetalBar", content.Load<Texture2D>("plasticMetalBar"));
_container.Images.Add("OrganicBar", content.Load<Texture2D>("organicBar"));
} }
public static Texture2D GetImage(string s) public static Texture2D GetImage(string s)

View File

@ -173,26 +173,7 @@ namespace CzokoŚmieciarka.MonoGameView
} }
} }
collector.Draw(spriteBatch, size); collector.Draw(spriteBatch, size);
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
@ -203,18 +184,18 @@ namespace CzokoŚmieciarka.MonoGameView
/// ///
/// </summary> /// </summary>
/// <param name="info"></param> /// <param name="info"></param>
public void Display(Dictionary<string, string> info) //public void Display(Dictionary<string, string> info)
{ //{
int x = 510; // int x = 510;
int y = 10; // int y = 10;
foreach (KeyValuePair<string, string> item in info) // foreach (KeyValuePair<string, string> item in info)
{ // {
spriteBatch.DrawString(font, item.Key, new Vector2(x, y),Color.Black); // spriteBatch.DrawString(font, item.Key, new Vector2(x, y),Color.Black);
y += 15; // y += 15;
spriteBatch.DrawString(font, item.Value, new Vector2(x, y), Color.White); // spriteBatch.DrawString(font, item.Value, new Vector2(x, y), Color.White);
y += 30; // y += 30;
} // }
} //}
} }
} }