private void loadToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog openfile = new OpenFileDialog();
//savefile.InitialDirectory = "../Tilesets";
openfile.Filter = "XML Document (*.xml)|*.xml";
openfile.Title = "Save map";
if (openfile.ShowDialog() == DialogResult.OK)
{
Players.Clear();
tileMap = new TileMap.TileMap(1, 1);
tileMap = tileMap.opentilemap(openfile.FileName);
//load Collisionmap
PathfindingNodeManager.GetInstance().ClearNodes();
CollisionMap = new CollisionMap(GraphicsDevice, tileMap.MapWidth * Engine.TileWidth, tileMap.MapHeight * Engine.TileHeight, true, Util.GetQuadDepth(tileMap.MapWidth));
CollisionMap.LoadMap(openfile.FileName.Substring(0, openfile.FileName.LastIndexOf('\\')), openfile.FileName.Substring(openfile.FileName.LastIndexOf('\\')).Replace(".xml", ""));
PathfindingNodeManager.GetInstance().ClearNodes();
Util.LoadNodes(openfile.FileName, GraphicsDevice);
Util.LoadPlayers(openfile.FileName);
CollisionData = new int[(tileMap.MapWidth * Engine.TileWidth) * (tileMap.MapHeight * Engine.TileHeight)];
currentLayer = tileMap.layers[0];
}
}