コード例 #1
0
        public bool MouseLeave()
        {
            // Avoid showing a tooltip outside the MapControl
            Map.StopTooltip();

            return(CurrentManipulator.MouseLeave());
        }
コード例 #2
0
        public bool MouseMove(MouseEventArgs e)
        {
            Point   game    = Map.Display.GetGameLocation(e.Location);
            Village village = World.Default.GetVillage(game);
            Point   map     = Map.Display.GetMapLocation(game);

            // Display village tooltip
            if (village != null)
            {
                if (ActiveVillage != village.Location)
                {
                    LastActiveVillage = ActiveVillage;
                    ActiveVillage     = village.Location;
                    CurrentManipulator.ShowTooltip(village);
                }
            }
            else
            {
                Map.StopTooltip();
            }

            // Invoke the MouseMoved delegate each time the current mouse location is different from the last location
            if (_mouseMoved != null && ActiveLocation != game)
            {
                ActiveLocation = game;
                _mouseMoved(e, map, village, ActiveLocation, ActiveVillage);
            }

            return(CurrentManipulator.MouseMoveCore(new MapMouseMoveEventArgs(e, map, village)));
        }
コード例 #3
0
        public bool MouseDown(MouseEventArgs e, Village village)
        {
            bool redraw = false;

            if (village != null && e.Button == MouseButtons.Left)
            {
                redraw = CurrentManipulator.OnVillageClickCore(new MapVillageEventArgs(e, village));
            }
            return(CurrentManipulator.MouseDownCore(new MapMouseEventArgs(e, village)) ||
                   redraw);
        }
コード例 #4
0
        /// <summary>
        /// Changes the active manipulatormanager
        /// </summary>
        public void SetManipulator(ManipulatorManagerTypes manipulator)
        {
            if (manipulator != ManipulatorManagerTypes.Default)
            {
                _previousType = manipulator;
            }

            Map.EventPublisher.Deselect(this);

            CurrentManipulator = _manipulators[manipulator];
            CurrentManipulator.Initialize();
            Map.EventPublisher.ChangeManipulator(this, new ManipulatorEventArgs(manipulator));
        }
コード例 #5
0
ファイル: Editor.cs プロジェクト: DuckMonster/Time-Dash-Re
        public void Draw()
        {
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            GL.DepthFunc(DepthFunction.Lequal);
            program["view"].SetValue(camera.ViewMatrix);

            background.Draw();

            foreach (Layer l in layerList)
            {
                if (l != ActiveLayer || preview)
                {
                    l.Draw();
                }
            }
            if (!preview)
            {
                ActiveLayer.Draw();
            }

            if (selectionBox != null)
            {
                selectionBox.Draw();
            }

            if (showGrid && !layerCreator.Active)
            {
                gridMesh.Draw();
                originMesh.Draw();
            }

            templateMenu.Draw();
            CurrentManipulator.Draw();
            templateCreator.Draw();

            layerCreator.Draw();
        }
コード例 #6
0
ファイル: Editor.cs プロジェクト: DuckMonster/Time-Dash-Re
        public void Logic()
        {
            CalculateDelta();
            UpdateEditMode();

            tilesetList.Logic();
            templateCreator.Logic();
            templateMenu.Logic();
            layerCreator.Logic();

            camera.Logic();

            CurrentManipulator.Logic();

            if (!Paused)
            {
                {
                    float mousex = MouseInput.Current.Position.X;
                    float mousey = MouseInput.Current.Position.Y;

                    mousex = (float)Math.Round(mousex);
                    mousey = (float)Math.Round(mousey);

                    Console.Clear();
                    Console.WriteLine(mousex + ", " + mousey);
                }

                if (KeyboardInput.Current[Key.LControl])
                {
                    if (KeyboardInput.KeyPressed(Key.Z))
                    {
                        Undo();
                    }

                    if (KeyboardInput.KeyPressed(Key.Y))
                    {
                        Redo();
                    }

                    if (KeyboardInput.KeyPressed(Key.D))
                    {
                        DuplicateSelected();
                    }

                    if (KeyboardInput.KeyPressed(Key.B))
                    {
                        background.LoadTexture();
                    }

                    if (KeyboardInput.KeyPressed(Key.Delete) && MessageBox.Show("Are you sure you want to delete this layer?", "Please confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        DeleteLayer(ActiveLayer);
                    }
                }
                else
                {
                    if (KeyboardInput.KeyPressed(Key.G))
                    {
                        showGrid = !showGrid;
                    }

                    if (KeyboardInput.KeyPressed(Key.B))
                    {
                        background.show = !background.show;
                    }

                    if (KeyboardInput.KeyPressed(Key.L))
                    {
                        preview = !preview;
                    }

                    if (KeyboardInput.KeyPressed(Key.H))
                    {
                        hideVertices = !hideVertices;
                    }

                    if (KeyboardInput.KeyPressed(Key.Z))
                    {
                        hideSolids = !hideSolids;
                    }

                    if (KeyboardInput.KeyPressed(Key.F1))
                    {
                        if (dataForm == null)
                        {
                            dataForm = new LevelDataForm(this);
                            dataForm.Show();
                        }
                        else
                        {
                            dataForm.Dispose();
                            dataForm = null;
                        }
                    }

                    if (KeyboardInput.KeyPressed(Key.F2))
                    {
                        List <EventObject> events = new List <EventObject>();

                        foreach (EditorObject o in ActiveObjects)
                        {
                            if ((o is EventObject) && o.Selected)
                            {
                                events.Add(o as EventObject);
                            }
                        }

                        if (events.Count > 0)
                        {
                            new EventForm(events.ToArray()).Show();
                        }
                    }

                    if (KeyboardInput.KeyPressed(Key.Delete))
                    {
                        DeleteSelected();
                    }
                }

                if (KeyboardInput.KeyPressed(Key.Minus))
                {
                    MoveSelected(1);
                }
                if (KeyboardInput.KeyPressed(Key.Slash))
                {
                    MoveSelected(-1);
                }

                if (MouseInput.ButtonPressed(MouseButton.Right))
                {
                    DeselectAll();
                }
                if (MouseInput.ButtonPressed(MouseButton.Left) && !CurrentManipulator.Hovered && !templateMenu.Hovered)
                {
                    Vertex       v     = GetVertexAt(MouseInput.Current.Position);
                    EditorObject obj   = GetObjectAt(MouseInput.Current.Position);
                    Layer        layer = GetHoveredLayer();

                    if (layer != null)
                    {
                        SetActiveLayer(layer);
                    }
                    if (v != null)
                    {
                        Select(v);
                    }
                    else if (obj != null)
                    {
                        obj.Select();
                    }
                    else
                    {
                        selectionBox = new SelectionBox(MouseInput.Current.Position, this);
                    }
                }

                if (MouseInput.ButtonReleased(MouseButton.Left) && selectionBox != null)
                {
                    if (KeyboardInput.Current[Key.LControl])
                    {
                        Deselect(selectionBox.GetObjects().ToArray());
                    }
                    else
                    {
                        Select(selectionBox.GetObjects().ToArray());
                    }

                    selectionBox.Dispose();
                    selectionBox = null;
                }

                if (selectionBox != null)
                {
                    selectionBox.Logic();
                }

                ActiveLayer.Logic();
            }
        }
コード例 #7
0
 public bool MouseWheel(MouseEventArgs e)
 {
     return(CurrentManipulator.MouseWheel(e));
 }
コード例 #8
0
        public bool MouseUp(MouseEventArgs e, Village village)
        {
            bool redraw = CurrentManipulator.MouseUpCore(new MapMouseEventArgs(e, village));

            return(redraw);
        }
コード例 #9
0
 public bool OnVillageDoubleClick(MouseEventArgs e, Village village)
 {
     return(CurrentManipulator.OnVillageDoubleClickCore(new MapVillageEventArgs(e, village)));
 }
コード例 #10
0
 public bool KeyUp(KeyEventArgs e)
 {
     return(CurrentManipulator.OnKeyUpCore(new MapKeyEventArgs(e)));
 }