Пример #1
0
 public void EnableLightsLayer()
 {
     RedrawGrid(1, 1);
     if (selected != null)
     {
         selected.Deselect();
         selected = null;
     }
     foreach (DraggableGridSnapper control in floorLayer)
     {
         control.Disable();
     }
     foreach (DraggableGridSnapper control in wallLayer)
     {
         control.Disable();
     }
     foreach (DraggableGridSnapper control in stuffLayer)
     {
         control.Disable();
     }
     foreach (DraggableGridSnapper control in lightsLayer)
     {
         control.Enable();
     }
 }
Пример #2
0
 public void Select(DraggableGridSnapper control)
 {
     if (selected != null)
     {
         selected.Deselect();
     }
     selected = control;
     selected.Select();
     dragging = control;
 }
Пример #3
0
        protected override void OnMouseUp(MouseButtonEventArgs e)
        {
            if (dragging != null)
            {
                ((DraggableGridSnapper)dragging).OnMouseUp_(e);
            }

            if (selected != null)
            {
                selected.Deselect();
                selected = null;
            }
        }
Пример #4
0
        private void Window_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Delete)
            {
                if (selected != null)
                {
                    if (selected is PatrolPoint)
                    {
                        (selected as PatrolPoint).Delete();
                    }

                    floorLayer.Remove(selected);
                    wallLayer.Remove(selected);
                    stuffLayer.Remove(selected);
                    lightsLayer.Remove(selected);
                    canvasRoom.Children.Remove(selected);
                    selected.SafeDelete();
                    selected = null;
                }
            }
            if (e.Key == Key.R)
            {
                if (selected != null)
                {
                    (selected.RenderTransform as RotateTransform).Angle += 90.0;
                    if (selected.snapMode == DraggableGridSnapper.SnapMode.HorizontalLineSnap)
                    {
                        selected.snapMode = DraggableGridSnapper.SnapMode.VerticalLineSnap;
                    }
                    else if (selected.snapMode == DraggableGridSnapper.SnapMode.VerticalLineSnap)
                    {
                        selected.snapMode = DraggableGridSnapper.SnapMode.HorizontalLineSnap;
                    }
                    selected.SnapToGrid();
                }
            }
            if (e.Key == Key.W)
            {
                if (selected != null)
                {
                    DraggableGridSnapper d = selected.Clone(this);
                    if (d != null && selected != null)
                    {
                        selected.Deselect();
                        selected = d;
                        d.Select();
                        d.SnapToGrid();
                    }
                }
            }
        }
Пример #5
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (dragging != null)
            {
                //Check if the user released the mouse button while outside the window...
                if (e.LeftButton != MouseButtonState.Pressed)
                {
                    dragging.Deselect();
                    dragging = null;
                }
                else
                {
                    ((DraggableGridSnapper)dragging).OnMouseMove_(e);
                }
            }
        }
Пример #6
0
        private void btnFloor_Click(object sender, RoutedEventArgs e)
        {
            Mesh f = MeshFactory.MakeFloor(this);

            canvasRoom.Children.Add(f);
            floorLayer.Add(f);
            if (!(bool)radFloor.IsChecked)
            {
                EnableFloorLayer();
                radFloor.IsChecked = true;
            }
            if (selected != null)
            {
                selected.Deselect();
            }
            selected = f;
            f.Select();
            f.SnapToGrid();
        }
Пример #7
0
        private void btnLight_Click(object sender, RoutedEventArgs e)
        {
            Light l = new Light();

            l.Init(this);
            canvasRoom.Children.Add(l);
            lightsLayer.Add(l);
            if (!(bool)radLights.IsChecked)
            {
                EnableLightsLayer();
                radLights.IsChecked = true;
            }
            if (selected != null)
            {
                selected.Deselect();
            }
            selected = l;
            l.Select();
            l.SnapToGrid();
        }
Пример #8
0
        private void btnPatrolPoint_Click(object sender, RoutedEventArgs e)
        {
            PatrolPoint pp = new PatrolPoint();

            pp.Init(this);
            canvasRoom.Children.Add(pp);
            stuffLayer.Add(pp);
            if (!(bool)radStuff.IsChecked)
            {
                EnableStuffLayer();
                radStuff.IsChecked = true;
            }
            if (selected != null)
            {
                selected.Deselect();
            }
            selected = pp;
            pp.Select();
            pp.SnapToGrid();
        }
Пример #9
0
        private void btnItem_Click(object sender, RoutedEventArgs e)
        {
            Item i = new Item();

            i.Init(this);
            canvasRoom.Children.Add(i);
            stuffLayer.Add(i);
            if (!(bool)radStuff.IsChecked)
            {
                EnableStuffLayer();
                radStuff.IsChecked = true;
            }
            if (selected != null)
            {
                selected.Deselect();
            }
            selected = i;
            i.Select();
            i.SnapToGrid();
        }
Пример #10
0
        private void btnCamera_Click(object sender, RoutedEventArgs e)
        {
            Camera g = new Camera();

            g.Init(this);
            canvasRoom.Children.Add(g);
            stuffLayer.Add(g);
            if (!(bool)radStuff.IsChecked)
            {
                EnableStuffLayer();
                radStuff.IsChecked = true;
            }
            if (selected != null)
            {
                selected.Deselect();
            }
            selected = g;
            g.Select();
            g.SnapToGrid();
        }
Пример #11
0
 private void Clear()
 {
     selected = null;
     dragging = null;
     canvasRoom.Children.Clear();
     floorLayer.Clear();
     wallLayer.Clear();
     stuffLayer.Clear();
     lightsLayer.Clear();
     EnableFloorLayer();
     chkNorth.IsChecked        = false;
     chkEast.IsChecked         = false;
     chkSouth.IsChecked        = false;
     chkWest.IsChecked         = false;
     radFloor.IsChecked        = true;
     cmbRoomType.SelectedIndex = 0;
     cmbRarity.SelectedIndex   = 0;
     patrolRoutes.Clear();
     patrolRouteIndices.Clear();
     canvasRoom.Children.Add(lblInfo);
 }
Пример #12
0
        private void btnWallV_Click(object sender, RoutedEventArgs e)
        {
            Mesh w;

            switch (cmbVWalls.SelectedIndex)
            {
            case 0:
                w = MeshFactory.MakeVerticalWall100(this);
                break;

            case 1:
                w = MeshFactory.MakeVerticalWall200(this);
                break;

            case 2:
                w = MeshFactory.MakeVerticalWall400(this);
                break;

            default:
                w = MeshFactory.MakeVerticalWall100(this);
                break;
            }

            w.Init(this);
            canvasRoom.Children.Add(w);
            wallLayer.Add(w);
            if (!(bool)radWalls.IsChecked)
            {
                EnableWallsLayer();
                radWalls.IsChecked = true;
            }
            if (selected != null)
            {
                selected.Deselect();
            }
            selected = w;
            w.Select();
            w.SnapToGrid();
        }
Пример #13
0
        private void btnCreateStaticObject_Click(object sender, RoutedEventArgs e)
        {
            if (cmbObjects.SelectedItem == null)
            {
                return;
            }

            Mesh obj = MeshFactory.MakeCustomMesh((CustomMesh)cmbObjects.SelectedItem, this);

            canvasRoom.Children.Add(obj);
            stuffLayer.Add(obj);
            if (!(bool)radStuff.IsChecked)
            {
                EnableStuffLayer();
                radStuff.IsChecked = true;
            }
            if (selected != null)
            {
                selected.Deselect();
            }
            selected = obj;
            obj.Select();
            obj.SnapToGrid();
        }
Пример #14
0
 public void EndDrag()
 {
     dragging = null;
 }