コード例 #1
0
ファイル: Form1.cs プロジェクト: SuperTux/cobble
        private void searchAndReplaceTilesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (currentSector == null)
            {
                return;
            }
            int oldId;

            try {
                oldId = int.Parse(slTileId.Text);
            }
            catch (Exception) {
                oldId = 0;
            }
            int newId = currentTileId;

            TileSearchDialog tsd = new TileSearchDialog(oldId, newId);

            if (tsd.ShowDialog() == DialogResult.OK)
            {
                foreach (Tilemap tilemap in currentSector.tilemaps)
                {
                    tilemap.Replace(tsd.OldId, tsd.NewId);
                }
                cbSector_SelectedIndexChanged(sender, e);
            }
        }
コード例 #2
0
        private void searchAndReplaceTilesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (currentSector == null) return;
            int oldId;
            try {
                oldId = int.Parse(slTileId.Text);
            }
            catch(Exception) {
                oldId = 0;
            }
            int newId = currentTileId;

            TileSearchDialog tsd = new TileSearchDialog(oldId, newId);

            if (tsd.ShowDialog() == DialogResult.OK) {
                foreach (Tilemap tilemap in currentSector.tilemaps) {
                    tilemap.Replace(tsd.OldId, tsd.NewId);
                }
                cbSector_SelectedIndexChanged(sender, e);
            }
        }