コード例 #1
0
        private void lnkAdd_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            frmAnimatedTile dialog = new frmAnimatedTile(this.map, this.tilesheet);
            DialogResult result = dialog.ShowDialog(this);

            if(result == DialogResult.OK)
            {
                int tileID = ((dialog.Tile.InitialFrameRect.Y / this.map.TileSize) * this.map.TilesPerRow + dialog.Tile.InitialFrameRect.X);

                this.map.AnimatedTiles.Add(tileID, dialog.Tile);
            }

            this.BuildTileList();
        }
コード例 #2
0
        private void lstAnimatedTiles_ItemActivate(object sender, EventArgs e)
        {
            ListViewItem item = this.lstAnimatedTiles.SelectedItems[0];

            var tile = (FrameAnimation)item.Tag;
            int tileID = ((tile.InitialFrameRect.Y / this.map.TileSize) * this.map.TilesPerRow + tile.InitialFrameRect.X);

            frmAnimatedTile dialog = new frmAnimatedTile(this.map, this.tilesheet, tile);
            dialog.ShowDialog(this);

            int newtileID = ((tile.InitialFrameRect.Y / this.map.TileSize) * this.map.TilesPerRow + tile.InitialFrameRect.X);

            //// Remove old, add new. Solves problem of automatically creating new dictionary items
            //// If the key doesn't exist
            this.map.AnimatedTiles.Remove(tileID);
            this.map.AnimatedTiles.Add(newtileID, dialog.Tile);

            this.BuildTileList();
        }