private void EditorLoadLayoutButton_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog { Filter = "Binaries | *.bin", Title = "Open custom dungeon layout", RestoreDirectory = true }; if (openFileDialog.ShowDialog() == DialogResult.OK) { Stream fs = openFileDialog.OpenFile(); byte[] data = new byte[1536]; fs.Read(data, 0, 1536); for (int i = 0; i < data.Length; i++) { Vector2 pos = new Vector2(i % 32, (int)Math.Floor((double)i / 32)); //32 is the width of the grid pos.x *= 2; Tile.DomainTileTypeOld tileType = Tile.DomainTileTypeOld.Empty; tileType = (Tile.DomainTileTypeOld)data[i].GetRightNiblet(); EditorLayoutRendererOld.UpdateTile(pos, tileType); pos += Vector2.Right; tileType = (Tile.DomainTileTypeOld)data[i].GetLeftNiblet(); EditorLayoutRendererOld.UpdateTile(pos, tileType); } fs.Close(); fs.Dispose(); } }
private void PlaceTileOrObjectAtGridPosition(Vector2 gridPos) { EditorLayoutRendererOld.UpdateTile(gridPos, DigimonWorld2ToolForm.EditorSelectedTileType); }