示例#1
0
        private void BlsBlocks_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control)
            {
                copyBlock = BlsBlocks.SelectedBlock;
            }

            else if (e.KeyCode == Keys.V && (e.Modifiers & Keys.Control) > Keys.None)
            {
                if (copyBlock == null)
                {
                    return;
                }
                if ((e.Modifiers & Keys.Shift) == Keys.None)
                {
                    BlvCurrent.SetTile(0, 0, copyBlock[0, 0]);
                    BlvCurrent.SetTile(1, 0, copyBlock[1, 0]);
                    BlvCurrent.SetTile(0, 1, copyBlock[0, 1]);
                    BlvCurrent.SetTile(1, 1, copyBlock[1, 1]);
                    BlockDescription.Text = BlvCurrent.CurrentBlock.Description = copyBlock.Description;
                }

                BlvCurrent.CurrentBlock.BlockProperty = copyBlock.BlockProperty;
                BlsBlocks_SelectionChanged(null, null);
            }
        }
示例#2
0
        private void BlsBlocks_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Middle)
            {
                Block copyBlock = Block.Deserialize(Clipboard.GetText());
                {
                    if (copyBlock != null)
                    {
                        BlvCurrent.SetTile(0, 0, copyBlock[0, 0]);
                        BlvCurrent.SetTile(1, 0, copyBlock[1, 0]);
                        BlvCurrent.SetTile(0, 1, copyBlock[0, 1]);
                        BlvCurrent.SetTile(1, 1, copyBlock[1, 1]);
                        BlockDescription.Text = BlvCurrent.CurrentBlock.Description = copyBlock.Description;
                        BlvCurrent.CurrentBlock.BlockProperty = copyBlock.BlockProperty;
                    }

                    BlsBlocks_SelectionChanged(null, null);

                    Clipboard.Clear();
                }
            }
            else if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                if (BlsBlocks.SelectedBlock != null)
                {
                    Clipboard.SetText(Block.Serialize(BlsBlocks.SelectedBlock));
                }
            }
        }
示例#3
0
        private void BlvCurrent_MouseDown(object sender, MouseEventArgs e)
        {
            int x = e.X / 16;
            int y = e.Y / 16;

            if (x < 0 || y < 0 || x > 2 || y > 2)
            {
                return;
            }
            BlvCurrent.SetTile(x, y, (byte)PtvTable.SelectedIndex);
            BlvCurrent.Focus();
            BlsBlocks.UpdateSelection();
        }