Ejemplo n.º 1
0
        private void AddColumnToMapGrid()
        {
            for (int iRowIndex = 0; iRowIndex < _iMapRowCount; iRowIndex++)
              {
            for (int iColumnIndex = _iPrevMapColumnCount; iColumnIndex < _iMapColumnCount; iColumnIndex++)
            {
              TileSheetPictureBox pbMapTile = new TileSheetPictureBox();
              pnlTileMap.Controls.Add(pbMapTile);

              pbMapTile.ContextMenuStrip = cmsMapMenu;
              pbMapTile.Size = new Size(_iMapTileWidth, _iMapTileHeight);
              pbMapTile.SizeMode = PictureBoxSizeMode.StretchImage;
              pbMapTile.BorderStyle = BorderStyle.FixedSingle;
              pbMapTile.Padding = new Padding(0);

              pbMapTile.Location = new Point((iColumnIndex * _iMapTileWidth) + 3, (iRowIndex * _iMapTileHeight) + 3);
              pbMapTile.MapRowIndex = iRowIndex;
              pbMapTile.MapColumnIndex = iColumnIndex;

              pbMapTile.Click += pbMapTile_Click;
            }
              }
        }
Ejemplo n.º 2
0
        private void MoveTileSheetTile(Globals.TileType newType)
        {
            int iControlIndex = 0;
              for (iControlIndex = 0; iControlIndex < _pbTileActionPending.Parent.Controls.Count; iControlIndex++)
              {
            if (Control.Equals(_pbTileActionPending.Parent.Controls[iControlIndex], _pbTileActionPending))
            {
              break;
            }
              }

              UpdateMapTileType(newType);

              TileSheetPictureBox pbNewTile = new TileSheetPictureBox();
              pbNewTile.Size = new Size(64, 64);
              pbNewTile.SizeMode = PictureBoxSizeMode.StretchImage;
              pbNewTile.Tag = ((TileSheetPictureBox)_pbTileActionPending.Parent.Controls[iControlIndex]).Tag;
              pbNewTile.Image = _pbTileActionPending.Image;
              pbNewTile.TileType = newType;
              pbNewTile.TileSheetColumnIndex = ((TileSheetPictureBox)_pbTileActionPending.Parent.Controls[iControlIndex]).TileSheetColumnIndex;
              pbNewTile.TileSheetRowIndex = ((TileSheetPictureBox)_pbTileActionPending.Parent.Controls[iControlIndex]).TileSheetRowIndex;
              pbNewTile.ContextMenuStrip = cmsTileSheetMenu;

              _pbTileActionPending.Parent.Controls.RemoveAt(iControlIndex);

              switch (newType)
              {
            case Globals.TileType.Regular:
              pbNewTile.Click += pbRegularTile_Click;
              flpRegularTiles.Controls.Add(pbNewTile);
              break;

            case Globals.TileType.Solid:
              pbNewTile.Click += pbSolidTile_Click;
              flpSolidTiles.Controls.Add(pbNewTile);
              break;

            case Globals.TileType.Overlay:
              pbNewTile.Click += pbOverlayTile_Click;
              flpOverlayTiles.Controls.Add(pbNewTile);
              break;
              }
        }
Ejemplo n.º 3
0
        private void MoveSingleMapTile(Globals.TileType newType)
        {
            FlowLayoutPanel flpTileSheetParent = null;

              int iMapControlIndex = -1;
              int iTileSheetControlIndex = -1;

              foreach (TileSheetPictureBox pbMapTile in _pbTileActionPending.Parent.Controls)
              {
            if (Control.Equals(pbMapTile, _pbTileActionPending))
            {
              iMapControlIndex = _pbTileActionPending.Parent.Controls.IndexOf(pbMapTile);

              switch (pbMapTile.TileType)
              {
            case Globals.TileType.Regular:
              flpTileSheetParent = flpRegularTiles;
              break;

            case Globals.TileType.Solid:
              flpTileSheetParent = flpSolidTiles;
              break;

            case Globals.TileType.Overlay:
              flpTileSheetParent = flpOverlayTiles;
              break;
              }

              pbMapTile.TileType = newType;
              break;
            }
              }

              foreach (TileSheetPictureBox pbTileSheetTile in flpTileSheetParent.Controls)
              {
            if (pbTileSheetTile.TileSheetColumnIndex == ((TileSheetPictureBox)_pbTileActionPending.Parent.Controls[iMapControlIndex]).TileSheetColumnIndex && pbTileSheetTile.TileSheetRowIndex == ((TileSheetPictureBox)_pbTileActionPending.Parent.Controls[iMapControlIndex]).TileSheetRowIndex)
            {
              iTileSheetControlIndex = flpTileSheetParent.Controls.IndexOf(pbTileSheetTile);
              break;
            }
              }

              UpdateMapTileType(flpTileSheetParent, iTileSheetControlIndex, newType);

              TileSheetPictureBox pbNewTile = new TileSheetPictureBox();
              pbNewTile.Size = new Size(64, 64);
              pbNewTile.SizeMode = PictureBoxSizeMode.StretchImage;
              pbNewTile.Tag = ((TileSheetPictureBox)_pbTileActionPending.Parent.Controls[iMapControlIndex]).Tag;
              pbNewTile.Image = _pbTileActionPending.Image;
              pbNewTile.TileType = newType;
              pbNewTile.TileSheetColumnIndex = ((TileSheetPictureBox)_pbTileActionPending.Parent.Controls[iMapControlIndex]).TileSheetColumnIndex;
              pbNewTile.TileSheetRowIndex = ((TileSheetPictureBox)_pbTileActionPending.Parent.Controls[iMapControlIndex]).TileSheetRowIndex;
              pbNewTile.ContextMenuStrip = cmsTileSheetMenu;

              flpTileSheetParent.Controls.RemoveAt(iTileSheetControlIndex);

              pbNewTile.Click += pbRegularTile_Click;
              flpRegularTiles.Controls.Add(pbNewTile);

              switch (newType)
              {
            case Globals.TileType.Regular:
              pbNewTile.Click += pbRegularTile_Click;
              flpRegularTiles.Controls.Add(pbNewTile);
              break;

            case Globals.TileType.Solid:
              pbNewTile.Click += pbSolidTile_Click;
              flpSolidTiles.Controls.Add(pbNewTile);
              break;

            case Globals.TileType.Overlay:
              pbNewTile.Click += pbOverlayTile_Click;
              flpOverlayTiles.Controls.Add(pbNewTile);
              break;
              }
        }
Ejemplo n.º 4
0
        private void MoveMultipleMapTiles(Globals.TileType newType)
        {
            FlowLayoutPanel flpTileSheetParent = null;
              TileSheetPictureBox pbMapTile;
              List<string> lsTileSheetRowColumnIndicesMoved = new List<string>();

              foreach (int iSelectedIndex in _liSelectedMapTileIndices)
              {
            int iTileSheetControlIndex = -1;

            pbMapTile = (TileSheetPictureBox)pnlTileMap.Controls[iSelectedIndex];

            if (lsTileSheetRowColumnIndicesMoved.Contains(String.Format("{0}|{1}", pbMapTile.TileSheetColumnIndex.ToString(), pbMapTile.TileSheetRowIndex.ToString())))
            {
              continue;
            }

            lsTileSheetRowColumnIndicesMoved.Add(String.Format("{0}|{1}", pbMapTile.TileSheetColumnIndex.ToString(), pbMapTile.TileSheetRowIndex.ToString()));

            switch (pbMapTile.TileType)
            {
              case Globals.TileType.Regular:
            flpTileSheetParent = flpRegularTiles;
            break;

              case Globals.TileType.Solid:
            flpTileSheetParent = flpSolidTiles;
            break;

              case Globals.TileType.Overlay:
            flpTileSheetParent = flpOverlayTiles;
            break;
            }

            pbMapTile.TileType = newType;

            foreach (TileSheetPictureBox pbTileSheetTile in flpTileSheetParent.Controls)
            {
              if (pbTileSheetTile.TileSheetColumnIndex == pbMapTile.TileSheetColumnIndex && pbTileSheetTile.TileSheetRowIndex == pbMapTile.TileSheetRowIndex)
              {
            iTileSheetControlIndex = flpTileSheetParent.Controls.IndexOf(pbTileSheetTile);
            break;
              }
            }

            UpdateMapTileType(flpTileSheetParent, iTileSheetControlIndex, newType);

            TileSheetPictureBox pbNewTile = new TileSheetPictureBox();
            pbNewTile.Size = new Size(64, 64);
            pbNewTile.SizeMode = PictureBoxSizeMode.StretchImage;
            pbNewTile.Tag = pbMapTile.Tag;
            pbNewTile.Image = pbMapTile.Image;
            pbNewTile.TileType = newType;
            pbNewTile.TileSheetColumnIndex = pbMapTile.TileSheetColumnIndex;
            pbNewTile.TileSheetRowIndex = pbMapTile.TileSheetRowIndex;
            pbNewTile.ContextMenuStrip = cmsTileSheetMenu;

            flpTileSheetParent.Controls.RemoveAt(iTileSheetControlIndex);

            switch (newType)
            {
              case Globals.TileType.Regular:
            pbNewTile.Click += pbRegularTile_Click;
            flpRegularTiles.Controls.Add(pbNewTile);
            break;

              case Globals.TileType.Solid:
            pbNewTile.Click += pbSolidTile_Click;
            flpSolidTiles.Controls.Add(pbNewTile);
            break;

              case Globals.TileType.Overlay:
            pbNewTile.Click += pbOverlayTile_Click;
            flpOverlayTiles.Controls.Add(pbNewTile);
            break;
            }
              }
        }
Ejemplo n.º 5
0
        private void CopyTileSheetTile(Globals.TileType newType)
        {
            int iControlIndex = 0;
              for (iControlIndex = 0; iControlIndex < _pbTileActionPending.Parent.Controls.Count; iControlIndex++)
              {
            if (Control.Equals(_pbTileActionPending.Parent.Controls[iControlIndex], _pbTileActionPending))
            {
              break;
            }
              }

              TileSheetPictureBox pbNewTile = new TileSheetPictureBox();
              pbNewTile.Size = new Size(64, 64);
              pbNewTile.SizeMode = PictureBoxSizeMode.StretchImage;
              pbNewTile.Image = _pbTileActionPending.Image;

              _iTileSheetColumnIndex++;

              if ((_iTileSheetColumnIndex * _iTileSheetTileWidth) >= MAX_TILE_SHEET_WIDTH)
              {
            _iTileSheetColumnCount = _iTileSheetColumnIndex - 1;

            /* Reset the column index */
            _iTileSheetColumnIndex = 0;
            _iTileSheetRowIndex++;
              }

              if ((_iTileSheetRowIndex * _iTileSheetTileHeight) > MAX_TILE_SHEET_HEIGHT)
              {
            throw new ArgumentOutOfRangeException("Tile Sheet exceeds maximum size.");
              }

              pbNewTile.Tag = new Rectangle((_iTileSheetColumnIndex * _iTileSheetTileWidth), (_iTileSheetRowIndex * _iTileSheetTileHeight), _iTileSheetTileWidth, _iTileSheetTileHeight);
              pbNewTile.TileSheetColumnIndex = _iTileSheetColumnIndex;
              pbNewTile.TileSheetRowIndex = _iTileSheetRowIndex;

              pbNewTile.ContextMenuStrip = cmsTileSheetMenu;
              pbNewTile.TileType = newType;

              switch (newType)
              {
            case Globals.TileType.Regular:
              pbNewTile.Click += pbRegularTile_Click;
              flpRegularTiles.Controls.Add(pbNewTile);
              break;

            case Globals.TileType.Solid:
              pbNewTile.Click += pbSolidTile_Click;
              flpSolidTiles.Controls.Add(pbNewTile);
              break;

            case Globals.TileType.Overlay:
              pbNewTile.Click += pbOverlayTile_Click;
              flpOverlayTiles.Controls.Add(pbNewTile);
              break;
              }
        }
Ejemplo n.º 6
0
        private void LoadTileSheet(string fileName)
        {
            ClearTileSheetTiles();
              _sTileSheetFilePath = fileName;
              System.Drawing.Image imgTileSheet = Bitmap.FromFile(_sTileSheetFilePath);

              int iRowCount = imgTileSheet.Height / _iTileSheetTileHeight;
              int iColumnCount = imgTileSheet.Width / _iTileSheetTileWidth;

              nudTileSheetRowCount.Value = iRowCount;
              nudTileSheetColumnCount.Value = iColumnCount;

              _iTileSheetRowIndex = iRowCount;
              _iTileSheetColumnIndex = iColumnCount;

              for (int iRowIndex = 0; iRowIndex < iRowCount; iRowIndex++)
              {
            for (int iColumnIndex = 0; iColumnIndex < iColumnCount; iColumnIndex++)
            {
              TileSheetPictureBox pbRegularTile = new TileSheetPictureBox();
              Rectangle rectCroppedImage = new Rectangle(0, 0, _iTileSheetTileWidth, _iTileSheetTileHeight);
              Rectangle rectSource = new Rectangle((iColumnIndex * _iTileSheetTileWidth), (iRowIndex * _iTileSheetTileHeight), _iTileSheetTileWidth, _iTileSheetTileHeight);

              Bitmap target = new Bitmap(_iTileSheetTileWidth, _iTileSheetTileHeight);

              using (Graphics g = Graphics.FromImage(target))
              {
            g.DrawImage(imgTileSheet, rectCroppedImage, rectSource, GraphicsUnit.Pixel);
              }

              pbRegularTile.Size = new Size(64, 64);
              pbRegularTile.SizeMode = PictureBoxSizeMode.StretchImage;
              pbRegularTile.Image = target;
              pbRegularTile.Tag = rectSource;
              pbRegularTile.TileSheetColumnIndex = iColumnIndex;
              pbRegularTile.TileSheetRowIndex = iRowIndex;

              flpRegularTiles.Controls.Add(pbRegularTile);

              pbRegularTile.Click += pbRegularTile_Click;
              pbRegularTile.ContextMenuStrip = cmsTileSheetMenu;
            }
              }
        }
Ejemplo n.º 7
0
        private void CopySingleMapTile(Globals.TileType newType)
        {
            FlowLayoutPanel flpTileSheetParent = null;

              int iMapControlIndex = -1;
              int iTileSheetControlIndex = -1;

              foreach (TileSheetPictureBox pbMapTile in _pbTileActionPending.Parent.Controls)
              {
            if (Control.Equals(pbMapTile, _pbTileActionPending))
            {
              iMapControlIndex = _pbTileActionPending.Parent.Controls.IndexOf(pbMapTile);

              switch (pbMapTile.TileType)
              {
            case Globals.TileType.Regular:
              flpTileSheetParent = flpRegularTiles;
              break;

            case Globals.TileType.Solid:
              flpTileSheetParent = flpSolidTiles;
              break;

            case Globals.TileType.Overlay:
              flpTileSheetParent = flpOverlayTiles;
              break;
              }

              pbMapTile.TileType = newType;
              break;
            }
              }

              foreach (TileSheetPictureBox pbTileSheetTile in flpTileSheetParent.Controls)
              {
            if (pbTileSheetTile.TileSheetColumnIndex == ((TileSheetPictureBox)_pbTileActionPending.Parent.Controls[iMapControlIndex]).TileSheetColumnIndex && pbTileSheetTile.TileSheetRowIndex == ((TileSheetPictureBox)_pbTileActionPending.Parent.Controls[iMapControlIndex]).TileSheetRowIndex)
            {
              iTileSheetControlIndex = flpTileSheetParent.Controls.IndexOf(pbTileSheetTile);
              break;
            }
              }

              TileSheetPictureBox pbNewTile = new TileSheetPictureBox();
              pbNewTile.Size = new Size(64, 64);
              pbNewTile.SizeMode = PictureBoxSizeMode.StretchImage;
              pbNewTile.Image = _pbTileActionPending.Image;

              _iTileSheetColumnIndex++;

              if ((_iTileSheetColumnIndex * _iTileSheetTileWidth) >= MAX_TILE_SHEET_WIDTH)
              {
            _iTileSheetColumnCount = _iTileSheetColumnIndex - 1;

            _iTileSheetColumnIndex = 0;
            _iTileSheetRowIndex++;
              }

              if ((_iTileSheetRowIndex * _iTileSheetTileHeight) > MAX_TILE_SHEET_HEIGHT)
              {
            throw new ArgumentOutOfRangeException("Tile Sheet exceeds maximum size.");
              }

              pbNewTile.Tag = new Rectangle((_iTileSheetColumnIndex * _iTileSheetTileWidth), (_iTileSheetRowIndex * _iTileSheetTileHeight), _iTileSheetTileWidth, _iTileSheetTileHeight);
              pbNewTile.TileSheetColumnIndex = _iTileSheetColumnIndex;
              pbNewTile.TileSheetRowIndex = _iTileSheetRowIndex;

              pbNewTile.ContextMenuStrip = cmsTileSheetMenu;
              pbNewTile.TileType = newType;

              switch (newType)
              {
            case Globals.TileType.Regular:
              pbNewTile.Click += pbRegularTile_Click;
              flpRegularTiles.Controls.Add(pbNewTile);
              break;

            case Globals.TileType.Solid:
              pbNewTile.Click += pbSolidTile_Click;
              flpSolidTiles.Controls.Add(pbNewTile);
              break;

            case Globals.TileType.Overlay:
              pbNewTile.Click += pbOverlayTile_Click;
              flpOverlayTiles.Controls.Add(pbNewTile);
              break;
              }
        }
Ejemplo n.º 8
0
        private void CopyMultipleMapTiles(Globals.TileType newType)
        {
            FlowLayoutPanel flpTileSheetParent = null;
              TileSheetPictureBox pbMapTile;
              List<string> lsTileSheetRowColumnIndicesMoved = new List<string>();

              foreach (int iSelectedIndex in _liSelectedMapTileIndices)
              {
            int iTileSheetControlIndex = -1;

            pbMapTile = (TileSheetPictureBox)pnlTileMap.Controls[iSelectedIndex];

            if (lsTileSheetRowColumnIndicesMoved.Contains(String.Format("{0}|{1}", pbMapTile.TileSheetColumnIndex.ToString(), pbMapTile.TileSheetRowIndex.ToString())))
            {
              /* We still want to update any tiles that have been selected */
              pbMapTile.TileType = newType;
              continue;
            }

            lsTileSheetRowColumnIndicesMoved.Add(String.Format("{0}|{1}", pbMapTile.TileSheetColumnIndex.ToString(), pbMapTile.TileSheetRowIndex.ToString()));

            switch (pbMapTile.TileType)
            {
              case Globals.TileType.Regular:
            flpTileSheetParent = flpRegularTiles;
            break;

              case Globals.TileType.Solid:
            flpTileSheetParent = flpSolidTiles;
            break;

              case Globals.TileType.Overlay:
            flpTileSheetParent = flpOverlayTiles;
            break;
            }

            pbMapTile.TileType = newType;

            foreach (TileSheetPictureBox pbTileSheetTile in flpTileSheetParent.Controls)
            {
              if (pbTileSheetTile.TileSheetColumnIndex == pbMapTile.TileSheetColumnIndex && pbTileSheetTile.TileSheetRowIndex == pbMapTile.TileSheetRowIndex)
              {
            iTileSheetControlIndex = flpTileSheetParent.Controls.IndexOf(pbTileSheetTile);
            break;
              }
            }

            TileSheetPictureBox pbNewTile = new TileSheetPictureBox();
            pbNewTile.Size = new Size(64, 64);
            pbNewTile.SizeMode = PictureBoxSizeMode.StretchImage;
            pbNewTile.Image = pbMapTile.Image;

            _iTileSheetColumnIndex++;

            if ((_iTileSheetColumnIndex * _iTileSheetTileWidth) >= MAX_TILE_SHEET_WIDTH)
            {
              _iTileSheetColumnCount = _iTileSheetColumnIndex - 1;

              _iTileSheetColumnIndex = 0;
              _iTileSheetRowIndex++;
            }

            if ((_iTileSheetRowIndex * _iTileSheetTileHeight) > MAX_TILE_SHEET_HEIGHT)
            {
              throw new ArgumentOutOfRangeException("Tile Sheet exceeds maximum size.");
            }

            pbNewTile.Tag = new Rectangle((_iTileSheetColumnIndex * _iTileSheetTileWidth), (_iTileSheetRowIndex * _iTileSheetTileHeight), _iTileSheetTileWidth, _iTileSheetTileHeight);
            pbNewTile.TileSheetColumnIndex = _iTileSheetColumnIndex;
            pbNewTile.TileSheetRowIndex = _iTileSheetRowIndex;

            pbNewTile.ContextMenuStrip = cmsTileSheetMenu;
            pbNewTile.TileType = newType;

            pbNewTile.Click += pbRegularTile_Click;
            flpRegularTiles.Controls.Add(pbNewTile);

            switch (newType)
            {
              case Globals.TileType.Regular:
            pbNewTile.Click += pbRegularTile_Click;
            flpRegularTiles.Controls.Add(pbNewTile);
            break;

              case Globals.TileType.Solid:
            pbNewTile.Click += pbSolidTile_Click;
            flpSolidTiles.Controls.Add(pbNewTile);
            break;

              case Globals.TileType.Overlay:
            pbNewTile.Click += pbOverlayTile_Click;
            flpOverlayTiles.Controls.Add(pbNewTile);
            break;
            }
              }
        }
Ejemplo n.º 9
0
        private void cmsTileSheetMenu_Opening(object sender, CancelEventArgs e)
        {
            _pbTileActionPending = (TileSheetPictureBox)((ContextMenuStrip)sender).SourceControl;
              switch (_pbTileActionPending.TileType)
              {
            case Globals.TileType.Regular:
              tsmiMoveToRegular.Enabled = false;
              tsmiMoveToSolid.Enabled = true;
              tsmiMoveToOverlay.Enabled = true;

              tsmiCopyToRegular.Enabled = false;
              tsmiCopyToSolid.Enabled = true;
              tsmiCopyToOverlay.Enabled = true;

              break;
            case Globals.TileType.Solid:
              tsmiMoveToRegular.Enabled = true;
              tsmiMoveToSolid.Enabled = false;
              tsmiMoveToOverlay.Enabled = true;

              tsmiCopyToRegular.Enabled = true;
              tsmiCopyToSolid.Enabled = false;
              tsmiCopyToOverlay.Enabled = true;

              break;
            case Globals.TileType.Overlay:
              tsmiMoveToRegular.Enabled = true;
              tsmiMoveToSolid.Enabled = true;
              tsmiMoveToOverlay.Enabled = false;

              tsmiCopyToRegular.Enabled = true;
              tsmiCopyToSolid.Enabled = true;
              tsmiCopyToOverlay.Enabled = false;

              break;
              }
        }
Ejemplo n.º 10
0
        private void cmsMapMenu_Opening(object sender, CancelEventArgs e)
        {
            if (_liSelectedMapTileIndices.Count > 0)
              {
            bool fMoveMapTileToRegularEnabled = true;
            bool fMoveMapTileToSolidEnabled = true;
            bool fMoveMapTileToOverlayEnabled = true;

            bool fCopyMapTileToRegularEnabled = true;
            bool fCopyMapTileToSolidEnabled = true;
            bool fCopyMapTileToOverlayEnabled = true;

            TileSheetPictureBox pbMapTile;
            foreach (int iSelectedIndex in _liSelectedMapTileIndices)
            {
              pbMapTile = (TileSheetPictureBox)pnlTileMap.Controls[iSelectedIndex];

              switch (pbMapTile.TileType)
              {
            case Globals.TileType.Regular:
              fMoveMapTileToRegularEnabled = false;
              fCopyMapTileToRegularEnabled = false;
              break;

            case Globals.TileType.Solid:
              fMoveMapTileToSolidEnabled = false;
              fCopyMapTileToSolidEnabled = false;
              break;

            case Globals.TileType.Overlay:
              fMoveMapTileToOverlayEnabled = false;
              fCopyMapTileToOverlayEnabled = false;
              break;

            default:
              throw new ArgumentOutOfRangeException("TileType not currently supported.");
              }
            }

            tsmiMoveMapTileToRegular.Enabled = fMoveMapTileToRegularEnabled;
            tsmiMoveMapTileToSolid.Enabled = fMoveMapTileToSolidEnabled;
            tsmiMoveMapTileToOverlay.Enabled = fMoveMapTileToOverlayEnabled;

            tsmiCopyMapTileToRegular.Enabled = fCopyMapTileToRegularEnabled;
            tsmiCopyMapTileToSolid.Enabled = fCopyMapTileToSolidEnabled;
            tsmiCopyMapTileToOverlay.Enabled = fCopyMapTileToOverlayEnabled;
              }
              else
              {
            _pbTileActionPending = (TileSheetPictureBox)((ContextMenuStrip)sender).SourceControl;
            switch (_pbTileActionPending.TileType)
            {
              case Globals.TileType.Regular:
            tsmiMoveMapTileToRegular.Enabled = false;
            tsmiMoveMapTileToSolid.Enabled = true;
            tsmiMoveMapTileToOverlay.Enabled = true;

            tsmiCopyMapTileToRegular.Enabled = false;
            tsmiCopyMapTileToSolid.Enabled = true;
            tsmiCopyMapTileToOverlay.Enabled = true;

            break;
              case Globals.TileType.Solid:
            tsmiMoveMapTileToRegular.Enabled = true;
            tsmiMoveMapTileToSolid.Enabled = false;
            tsmiMoveMapTileToOverlay.Enabled = true;

            tsmiCopyMapTileToRegular.Enabled = true;
            tsmiCopyMapTileToSolid.Enabled = false;
            tsmiCopyMapTileToOverlay.Enabled = true;

            break;
              case Globals.TileType.Overlay:
            tsmiMoveMapTileToRegular.Enabled = true;
            tsmiMoveMapTileToSolid.Enabled = true;
            tsmiMoveMapTileToOverlay.Enabled = false;

            tsmiCopyMapTileToRegular.Enabled = true;
            tsmiCopyMapTileToSolid.Enabled = true;
            tsmiCopyMapTileToOverlay.Enabled = false;

            break;
            }
              }
        }
Ejemplo n.º 11
0
        private void AddImageToTileSheet(System.Drawing.Image img, ref Rectangle tag, ref int rowIndex, ref int columnIndex)
        {
            TileSheetPictureBox pbRegularTile = new TileSheetPictureBox();

              pbRegularTile.Size = new Size(64, 64);
              pbRegularTile.SizeMode = PictureBoxSizeMode.StretchImage;
              pbRegularTile.Image = img;

              /* Reset the Tag property to match the tile sheet source rectangle */
              tag = new Rectangle((columnIndex * _iTileSheetTileWidth), (rowIndex * _iTileSheetTileHeight), _iTileSheetTileWidth, _iTileSheetTileHeight);
              pbRegularTile.Tag = tag;

              pbRegularTile.TileSheetColumnIndex = columnIndex;
              pbRegularTile.TileSheetRowIndex = rowIndex;

              flpRegularTiles.Controls.Add(pbRegularTile);

              pbRegularTile.Click += pbRegularTile_Click;
              pbRegularTile.ContextMenuStrip = cmsTileSheetMenu;

              columnIndex++;

              if ((columnIndex * _iTileSheetTileWidth) >= MAX_TILE_SHEET_WIDTH)
              {
            _iTileSheetColumnCount = columnIndex - 1;

            /* Reset the column index */
            columnIndex = 0;
            rowIndex++;

            _iTileSheetRowCount++;
              }

              if ((rowIndex * _iTileSheetTileHeight) > MAX_TILE_SHEET_HEIGHT)
              {
            _iTileSheetRowCount--;
            throw new ArgumentOutOfRangeException("Tile Sheet exceeds maximum size.");
              }
        }