コード例 #1
0
        private void Canvas_MouseMove(object sender, MouseEventArgs e)
        {
            Vector blockPos;

            switch (StageEditorOperator.paletteMode)
            {
            case PaletteMode.Player:
                Point point = e.GetPosition(mainCanvas);

                if (point.X < 1024 - 32)
                {
                    Canvas.SetLeft(StageEditorOperator.imgEditorPlayer, point.X);
                    mouseMainCanvasPosition.X = point.X;
                }
                else
                {
                    Canvas.SetLeft(StageEditorOperator.imgEditorPlayer, 1024 - 32);
                    mouseMainCanvasPosition.X = 1024 - 32;
                }

                if (point.Y < 768 - 64)
                {
                    Canvas.SetTop(StageEditorOperator.imgEditorPlayer, point.Y);
                    mouseMainCanvasPosition.Y = point.Y;
                }
                else
                {
                    Canvas.SetTop(StageEditorOperator.imgEditorPlayer, 768 - 64);
                    mouseMainCanvasPosition.Y = 768 - 64;
                }
                break;

            case PaletteMode.Block:
                blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas));
                Canvas.SetLeft(StageEditorOperator.imgEditorPointerCursor, (blockPos.X - 1) * 32);
                Canvas.SetTop(StageEditorOperator.imgEditorPointerCursor, (blockPos.Y - 1) * 32);
                break;

            case PaletteMode.Object:
                blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas));
                Canvas.SetLeft(StageEditorOperator.imgEditorPointerCursor, (blockPos.X - 1) * 32);
                Canvas.SetTop(StageEditorOperator.imgEditorPointerCursor, (blockPos.Y - 1) * 32);
                break;

            case PaletteMode.Enemy:
                blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas));
                Canvas.SetLeft(StageEditorOperator.imgEditorPointerCursor, (blockPos.X - 1) * 32);
                Canvas.SetTop(StageEditorOperator.imgEditorPointerCursor, (blockPos.Y - 1) * 32);
                break;

            case PaletteMode.Item:
                blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas));
                Canvas.SetLeft(StageEditorOperator.imgEditorPointerCursor, (blockPos.X - 1) * 32);
                Canvas.SetTop(StageEditorOperator.imgEditorPointerCursor, (blockPos.Y - 1) * 32);
                break;
            }
        }
コード例 #2
0
        private void Canvas_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (!isMouseRightClicked)
            {
                Vector blockPos;
                switch (StageEditorOperator.paletteMode)
                {
                case PaletteMode.Player:

                    StageEditorOperator.imgEditorPlayer.Opacity = 1;

                    Canvas.SetLeft(StageEditorOperator.imgEditorPlayer, StageEditorOperator.memoryPlayerStartPos.X);
                    Canvas.SetTop(StageEditorOperator.imgEditorPlayer, StageEditorOperator.memoryPlayerStartPos.Y);

                    StageEditorOperator.paletteMode         = PaletteMode.None;
                    StageEditorWindow.ctlGridMain.IsEnabled = true;
                    stageEditor.Focus();
                    break;

                case PaletteMode.Block:

                    blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas));
                    StageEditorOperator.EditRemoveBlockOnMainCanvas(blockPos);

                    break;

                case PaletteMode.Object:
                    blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas));
                    StageEditorOperator.EditRemoveObjectOnMainCanvas(blockPos);
                    break;

                case PaletteMode.Enemy:
                    blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas));
                    StageEditorOperator.EditRemoveEnemyOnMainCanvas(blockPos);
                    break;

                case PaletteMode.Item:
                    blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas));
                    StageEditorOperator.EditRemoveItemOnMainCanvas(blockPos);
                    break;
                }

                isMouseRightClicked = true;
            }
        }
コード例 #3
0
        private void Canvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (!isMouseLeftClicked)
            {
                Vector blockPos;

                switch (StageEditorOperator.paletteMode)
                {
                case PaletteMode.Player:

                    StageEditorOperator.EditorPlayerStartPosDecision();
                    break;

                case PaletteMode.Block:

                    blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas));
                    StageEditorOperator.EditSetupBlockOnMainCanvas(blockPos);

                    break;

                case PaletteMode.Object:

                    blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas));
                    StageEditorOperator.EditSetupObjectOnMainCanvas(blockPos);

                    break;

                case PaletteMode.Enemy:
                    blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas));
                    StageEditorOperator.EditSetupEnemyOnMainCanvas(blockPos);
                    break;

                case PaletteMode.Item:
                    blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas));
                    StageEditorOperator.EditSetupItemOnMainCanvas(blockPos);
                    break;
                }


                isMouseLeftClicked = true;
            }
        }