From 865921411e30faf142798a378afc8ee3098887f0 Mon Sep 17 00:00:00 2001 From: Bartosz Chyzy Date: Tue, 14 May 2019 23:04:07 +0200 Subject: [PATCH] Automatyczne dumpy --- .../MapEditor/MapEditor/Program.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Trunk/Helper Programs/MapEditor/MapEditor/Program.cs b/Trunk/Helper Programs/MapEditor/MapEditor/Program.cs index 49be9c8..1094a2d 100644 --- a/Trunk/Helper Programs/MapEditor/MapEditor/Program.cs +++ b/Trunk/Helper Programs/MapEditor/MapEditor/Program.cs @@ -18,6 +18,13 @@ namespace MapEditor var bitmap = (Bitmap)Bitmap.FromFile(Config.ImageFilePath); var fieldInfos = GetFieldInfos(bitmap); + if (fieldInfos.Count(x => x.FieldType == FieldType.Dump) != 4) + { + Console.WriteLine("Na mapie nie znajdują się 4 wysypiska!"); + Console.ReadKey(); + return; + } + if(GenerateXML(fieldInfos)) Console.WriteLine("Done."); else @@ -44,6 +51,7 @@ namespace MapEditor } private static bool GenerateXML(IEnumerable fieldInfos) { + var dumpNumber = 0; var random = new Random(); try { @@ -121,6 +129,27 @@ namespace MapEditor xmlWriter.WriteEndElement(); } + if (fieldInfo.FieldType == FieldType.Dump) + { + xmlWriter.WriteStartElement("Garbage"); + + if (dumpNumber == 0) + xmlWriter.WriteElementString("GarbageType","Paper"); + + if (dumpNumber == 1) + xmlWriter.WriteElementString("GarbageType", "Glass"); + + if (dumpNumber == 2) + xmlWriter.WriteElementString("GarbageType", "Organic"); + + if (dumpNumber == 3) + xmlWriter.WriteElementString("GarbageType", "PlasticMetal"); + + dumpNumber++; + + xmlWriter.WriteEndElement(); + } + xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement();