private void Save(String filePath = "") { if (filePath == "") { filePath = GetSaveDestination(); if (filePath == "") { return; } } ChunkConnector[][] connectors = new ChunkConnector[4][]; for (int i = 0; i < 4; ++i) { connectors[i] = new ChunkConnector[myConArrows[i].Count]; for (int j = 0; j < myConArrows[i].Count; ++j) { connectors[i][j] = myConArrows[i][j].ConnectorInfo; } } ChunkTemplate temp = new ChunkTemplate(myCurrentMap.Chunk, connectors, myMapTypes); temp.SaveToFile(filePath); myLastSavePath = filePath; Text = "Lewt Chunk Editor - " + filePath; }
public EditorMap(bool interior, ChunkTemplate template) : base(interior) { AlwaysPlaceEntities = true; Chunk = new Chunk(0, 0, template, this); Chunks.Add(Chunk); Chunk.PostWorldInitialize(true); }
private void Open(String filePath = "") { if (filePath == "") { filePath = GetLoadDestination(); } if (filePath == "") { return; } ChunkTemplate temp = new ChunkTemplate(filePath); myLastSavePath = filePath; Text = "Lewt Chunk Editor - " + filePath; if (myCurrentMap != null) { myCurrentMap.Dispose(); } myCurrentMap = new EditorMap(true, temp); myMapTypes = temp.MapTypes; myConArrows = new List <ConnectorArrow>[] { new List <ConnectorArrow>(), new List <ConnectorArrow>(), new List <ConnectorArrow>(), new List <ConnectorArrow>() }; for (int i = 0; i < 4; ++i) { ChunkConnector[] cons = temp.GetConnectors((ConnectorFace)i); foreach (ChunkConnector con in cons) { myConArrows[i].Add(new ConnectorArrow(con.X, con.Y, con.Horizontal, con.Size)); } } CurToolGB.Enabled = true; TilePropsGB.Enabled = true; ChunkViewGB.Enabled = true; RenderMap(); }