Automatyczne dumpy
This commit is contained in:
parent
7d4bdd1dfa
commit
865921411e
@ -18,6 +18,13 @@ namespace MapEditor
|
|||||||
var bitmap = (Bitmap)Bitmap.FromFile(Config.ImageFilePath);
|
var bitmap = (Bitmap)Bitmap.FromFile(Config.ImageFilePath);
|
||||||
var fieldInfos = GetFieldInfos(bitmap);
|
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))
|
if(GenerateXML(fieldInfos))
|
||||||
Console.WriteLine("Done.");
|
Console.WriteLine("Done.");
|
||||||
else
|
else
|
||||||
@ -44,6 +51,7 @@ namespace MapEditor
|
|||||||
}
|
}
|
||||||
private static bool GenerateXML(IEnumerable<FieldInfo> fieldInfos)
|
private static bool GenerateXML(IEnumerable<FieldInfo> fieldInfos)
|
||||||
{
|
{
|
||||||
|
var dumpNumber = 0;
|
||||||
var random = new Random();
|
var random = new Random();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -121,6 +129,27 @@ namespace MapEditor
|
|||||||
xmlWriter.WriteEndElement();
|
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();
|
||||||
}
|
}
|
||||||
xmlWriter.WriteEndElement();
|
xmlWriter.WriteEndElement();
|
||||||
|
Loading…
Reference in New Issue
Block a user