From 1aa5affaf35052128a88be911cb92e1dc3555fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dulski?= Date: Mon, 13 May 2019 17:19:02 +0200 Subject: [PATCH] =?UTF-8?q?Wy=C5=9Bwietlanie=20pask=C3=B3w=20=C5=9Bmieci?= =?UTF-8?q?=20przy=20domkach?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Trunk/MonoGameView/Content/Content.mgcb | 48 ++++++++++++++++++ Trunk/MonoGameView/Content/glassBar.png | Bin 0 -> 197 bytes Trunk/MonoGameView/Content/organicBar.png | Bin 0 -> 196 bytes Trunk/MonoGameView/Content/paperBar.png | Bin 0 -> 196 bytes .../MonoGameView/Content/plasticMetalBar.png | Bin 0 -> 194 bytes Trunk/MonoGameView/DataModels/Models/House.cs | 5 ++ .../DataModels/Models/ImageContainer.cs | 5 +- Trunk/MonoGameView/Game1.cs | 45 +++++----------- 8 files changed, 70 insertions(+), 33 deletions(-) create mode 100644 Trunk/MonoGameView/Content/glassBar.png create mode 100644 Trunk/MonoGameView/Content/organicBar.png create mode 100644 Trunk/MonoGameView/Content/paperBar.png create mode 100644 Trunk/MonoGameView/Content/plasticMetalBar.png diff --git a/Trunk/MonoGameView/Content/Content.mgcb b/Trunk/MonoGameView/Content/Content.mgcb index ece1dae..342e371 100644 --- a/Trunk/MonoGameView/Content/Content.mgcb +++ b/Trunk/MonoGameView/Content/Content.mgcb @@ -44,6 +44,18 @@ /processorParam:TextureFormat=Color /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 /importer:TextureImporter /processor:TextureProcessor @@ -80,6 +92,18 @@ /processorParam:TextureFormat=Color /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 /importer:TextureImporter /processor:TextureProcessor @@ -92,6 +116,18 @@ /processorParam:TextureFormat=Color /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 /importer:TextureImporter /processor:TextureProcessor @@ -104,6 +140,18 @@ /processorParam:TextureFormat=Color /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 /importer:TextureImporter /processor:TextureProcessor diff --git a/Trunk/MonoGameView/Content/glassBar.png b/Trunk/MonoGameView/Content/glassBar.png new file mode 100644 index 0000000000000000000000000000000000000000..a16870383e8b8344a8666213b7c3f9fe755c74a0 GIT binary patch literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=1SBWM%0B~AoCO|{#S9F3${@^GvDCf{D9B#o z>Fdh=n3b2$TGHg?zso=&$r9Iy66gHf+|;}h2Ir#G#FEq$h4Rdj3^TgFN@qk=A{$3{MlPezl2O7oT M>FVdQ&MBb@0OtZaUH||9 literal 0 HcmV?d00001 diff --git a/Trunk/MonoGameView/Content/organicBar.png b/Trunk/MonoGameView/Content/organicBar.png new file mode 100644 index 0000000000000000000000000000000000000000..a740f94324e781f541690a89fc88d24991f7e336 GIT binary patch literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=1SBWM%0B~AoCO|{#S9F3${@^GvDCf{D9B#o z>Fdh=n3b2GK~Zt{VJD!FWQl7;iF1B#Zfaf$gL6@8Vo7R>LV0FMhJw4NZ$Nk>pEyvF zou`XqNW|f{=L{Jc3^*7RV!5JcT)OA|;5{SfiI-i~adVa|#SOOpOypuTNW15D185S1 Mr>mdKI;Vst07hp(IsgCw literal 0 HcmV?d00001 diff --git a/Trunk/MonoGameView/Content/paperBar.png b/Trunk/MonoGameView/Content/paperBar.png new file mode 100644 index 0000000000000000000000000000000000000000..7aca2319d02f88d4c9f7926651b6eb11742d2f0c GIT binary patch literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=1SBWM%0B~AoCO|{#S9F3${@^GvDCf{D9B#o z>Fdh=n3b2Gfmb+r{X(FSWQl7;iF1B#Zfaf$gL6@8Vo7R>LV0FMhJw4NZ$Nk>pEyvF zou`XqNW|f{=L{Jc3^gTe~DWM4f=oUoi literal 0 HcmV?d00001 diff --git a/Trunk/MonoGameView/Content/plasticMetalBar.png b/Trunk/MonoGameView/Content/plasticMetalBar.png new file mode 100644 index 0000000000000000000000000000000000000000..b0da35ab201a576971f233a0b7992889bd0bc62b GIT binary patch literal 194 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=1SBWM%0B~AoCO|{#S9F3${@^GvDCf{D9B#o z>Fdh=n3b2$+HAhW;Vz(%WQl7;iF1B#Zfaf$gL6@8Vo7R>LV0FMhJw4NZ$Nk>pEyvF zji-xaNW|f{=L{Jc7&w>}w$}SJ-#AdsuCkzf*(a5GTkrrm_SrU!K5d_NlmpFS@O1Ta JS?83{1OOLYKso>b literal 0 HcmV?d00001 diff --git a/Trunk/MonoGameView/DataModels/Models/House.cs b/Trunk/MonoGameView/DataModels/Models/House.cs index 5568c56..8e9e1e6 100644 --- a/Trunk/MonoGameView/DataModels/Models/House.cs +++ b/Trunk/MonoGameView/DataModels/Models/House.cs @@ -25,6 +25,11 @@ namespace CzokoŚmieciarka.MonoGameView.DataModels.Models 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("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() diff --git a/Trunk/MonoGameView/DataModels/Models/ImageContainer.cs b/Trunk/MonoGameView/DataModels/Models/ImageContainer.cs index 7382ae8..3f8ac65 100644 --- a/Trunk/MonoGameView/DataModels/Models/ImageContainer.cs +++ b/Trunk/MonoGameView/DataModels/Models/ImageContainer.cs @@ -25,7 +25,10 @@ namespace MonoGameView.DataModels.Models _container.Images.Add("Paper", content.Load("paper")); _container.Images.Add("PlasticMetal", content.Load("plasticmetal")); _container.Images.Add("Organic", content.Load("organic")); - + _container.Images.Add("GlassBar", content.Load("glassBar")); + _container.Images.Add("PaperBar", content.Load("paperBar")); + _container.Images.Add("PlasticMetalBar", content.Load("plasticMetalBar")); + _container.Images.Add("OrganicBar", content.Load("organicBar")); } public static Texture2D GetImage(string s) diff --git a/Trunk/MonoGameView/Game1.cs b/Trunk/MonoGameView/Game1.cs index acda59b..048cb3f 100644 --- a/Trunk/MonoGameView/Game1.cs +++ b/Trunk/MonoGameView/Game1.cs @@ -173,26 +173,7 @@ namespace CzokoŚmieciarka.MonoGameView } } collector.Draw(spriteBatch, size); - displayer.Content = new Dictionary(); - 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(); // TODO: Add your drawing code here @@ -203,18 +184,18 @@ namespace CzokoŚmieciarka.MonoGameView /// /// /// - public void Display(Dictionary info) - { - int x = 510; - int y = 10; - foreach (KeyValuePair 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 info) + //{ + // int x = 510; + // int y = 10; + // foreach (KeyValuePair 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; - } - } + // } + //} } }