示例#1
0
        private void Viewport_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
            {
                waterMode = true;

                Point  mousePosition = e.GetPosition(viewportGrid);
                double x             = Math.Round(2 * mousePosition.X / mainDataContext.BlockSize) / 2.0;
                double y             = Math.Round(2 * mousePosition.Y / mainDataContext.BlockSize) / 2.0;

                upperLeftCoords = new Point(x, y);
            }
            else if (mainDataContext.CurrentEditingMode == EditingMode.Selection)
            {
                LevelObject levelObject = mainDataContext.GetObjectAtCurrentPosition();

                if (levelObject != null)
                {
                    if (e.RightButton == MouseButtonState.Pressed)
                    {
                        mainDataContext.RemoveObject(levelObject);
                    }
                    else if (e.ClickCount == 2)
                    {
                        var propertiesWindow = new PropertiesWindow(levelObject, mainDataContext);
                        propertiesWindow.ShowDialog();
                    }
                    else
                    {
                        mainDataContext.SelectObjectAtCurrentPosition();
                    }
                }
            }
            else if (mainDataContext.CurrentEditingMode == EditingMode.BlockPlacement)
            {
                if (e.LeftButton == MouseButtonState.Pressed)
                {
                    mainDataContext.PlaceBlockAtCurrentPosition();
                }
                else if (e.RightButton == MouseButtonState.Pressed)
                {
                    mainDataContext.RemoveBlockAtCurrentPosition();
                }
            }
            else if (mainDataContext.CurrentEditingMode == EditingMode.ListenerPlacement)
            {
                if (e.LeftButton == MouseButtonState.Pressed)
                {
                    mainDataContext.PlaceListenerAtCurrentPosition();
                }
                else if (e.RightButton == MouseButtonState.Pressed)
                {
                    mainDataContext.NextDirection();
                }
            }
        }
示例#2
0
        private void Properties_Click(object sender, RoutedEventArgs e)
        {
            var propertiesWindow = new PropertiesWindow(mainDataContext.CurrentSelectionObject, mainDataContext);

            propertiesWindow.ShowDialog();
        }