public override bool OnMouseEvent(Editor.MouseEvent mouseEvent, MouseEventArgs mouseEventArgs) { if ((Control.ModifierKeys & Keys.Control) == Keys.None) { this.m_picking = false; return(base.OnMouseEvent(mouseEvent, mouseEventArgs)); } switch (mouseEvent) { case Editor.MouseEvent.MouseDown: if (!this.m_picking) { this.m_picking = true; this.UpdatePicking(); } break; case Editor.MouseEvent.MouseUp: this.m_picking = false; break; case Editor.MouseEvent.MouseMove: if (this.m_picking) { this.UpdatePicking(); } break; } return(false); }
public bool OnMouseEvent(Editor.MouseEvent mouseEvent, MouseEventArgs mouseEventArgs) { switch (mouseEvent) { case Editor.MouseEvent.MouseDown: if (mouseEventArgs.Button == MouseButtons.Left) { this.m_painting = true; UndoManager.RecordUndo(); this.OnMouseMove(mouseEventArgs); } break; case Editor.MouseEvent.MouseUp: if (this.m_painting) { this.m_painting = false; UndoManager.CommitUndo(); } break; case Editor.MouseEvent.MouseMove: this.OnMouseMove(mouseEventArgs); break; } return(false); }
public static void OnMouseEvent(Editor.MouseEvent mouseEvent, MouseEventArgs mouseEventArgs) { foreach (IInputSink current in Editor.GetInputs()) { if (current.OnMouseEvent(mouseEvent, mouseEventArgs)) { break; } } }
public bool OnMouseEvent(Editor.MouseEvent mouseEvent, MouseEventArgs mouseEventArgs) { switch (mouseEvent) { case Editor.MouseEvent.MouseUp: if (mouseEventArgs.Button == MouseButtons.Left && this.m_cursorValid) { Navmesh.RegenerateTileAt(this.m_cursorPos.XY, true); this.m_regenerateTile.Checked = false; } break; case Editor.MouseEvent.MouseMove: this.m_cursorValid = Editor.RayCastTerrainFromMouse(out this.m_cursorPos); break; } return(false); }
public override bool OnMouseEvent(Editor.MouseEvent mouseEvent, MouseEventArgs mouseEventArgs) { if (mouseEvent == Editor.MouseEvent.MouseUp && this.m_painting == ToolPaint.PaintingMode.None) { if (!this.m_rampStarted) { this.m_rampStarted = Editor.RayCastTerrainFromMouse(out this.m_rampStart); } else { Vec3 vec; if (Editor.RayCastTerrainFromMouse(out vec)) { UndoManager.RecordUndo(); TerrainManipulator.Ramp(this.m_rampStart.XY, vec.XY, this.m_radius.Value, this.m_hardness.Value); UndoManager.CommitUndo(); this.m_rampStarted = false; } } } return(base.OnMouseEvent(mouseEvent, mouseEventArgs)); }
public virtual bool OnMouseEvent(Editor.MouseEvent mouseEvent, MouseEventArgs mouseEventArgs) { return(false); }
public virtual bool OnMouseEvent(Editor.MouseEvent mouseEvent, MouseEventArgs mouseEventArgs) { switch (mouseEvent) { case Editor.MouseEvent.MouseDown: if ((Control.ModifierKeys & Keys.Shift) == Keys.None) { Vec3 cursorPos; if (Editor.RayCastTerrainFromMouse(out cursorPos)) { this.UpdateCursorPos(cursorPos); this.OnBeginPaint(); } } else { this.m_painting = ToolPaintStrict.PaintingMode.Shortcut; } if (this.m_painting != ToolPaintStrict.PaintingMode.None) { Editor.Viewport.CaptureMouse = true; Editor.Viewport.CameraEnabled = false; } break; case Editor.MouseEvent.MouseUp: if (this.m_painting != ToolPaintStrict.PaintingMode.None) { switch (this.m_painting) { case ToolPaintStrict.PaintingMode.Plus: case ToolPaintStrict.PaintingMode.Minus: this.OnEndPaint(); break; } this.m_cursorPos.Z = TerrainManager.GetHeightAtWithWater(this.m_cursorPos.XY); Vec2 captureMousePos; if (Editor.GetScreenPointFromWorldPos(this.m_cursorPos, out captureMousePos, true)) { Editor.Viewport.CaptureMousePos = captureMousePos; } Editor.Viewport.CaptureMouse = false; Editor.Viewport.CameraEnabled = true; this.m_painting = ToolPaintStrict.PaintingMode.None; } break; case Editor.MouseEvent.MouseMove: switch (this.m_painting) { case ToolPaintStrict.PaintingMode.None: case ToolPaintStrict.PaintingMode.Plus: case ToolPaintStrict.PaintingMode.Minus: { Vec3 cursorPos2; this.m_cursorValid = Editor.RayCastTerrainFromMouse(out cursorPos2); this.UpdateCursorPos(cursorPos2); break; } } break; case Editor.MouseEvent.MouseMoveDelta: switch (this.m_painting) { case ToolPaintStrict.PaintingMode.Plus: case ToolPaintStrict.PaintingMode.Minus: { Vec3 cursorPos3 = this.m_cursorPos; Editor.ApplyScreenDeltaToWorldPos(new Vec2((float)mouseEventArgs.X / (float)Editor.Viewport.Width, (float)mouseEventArgs.Y / (float)Editor.Viewport.Height), ref cursorPos3); cursorPos3.Z = TerrainManager.GetHeightAtWithWater(cursorPos3.XY); this.UpdateCursorPos(cursorPos3); break; } case ToolPaintStrict.PaintingMode.Shortcut: { float delta; if (Math.Abs(mouseEventArgs.X) > Math.Abs(mouseEventArgs.Y)) { delta = (float)mouseEventArgs.X; } else { delta = (float)(-(float)mouseEventArgs.Y); } this.OnShortcutDelta(delta); break; } } break; } return(false); }
public bool OnMouseEvent(Editor.MouseEvent mouseEvent, MouseEventArgs mouseEventArgs) { switch (mouseEvent) { case Editor.MouseEvent.MouseDown: if (this.m_spline.IsValid) { UndoManager.RecordUndo(); switch (this.m_paramEditTool.Value) { case ToolSpline.EditTool.Select: if ((Control.ModifierKeys & Keys.Control) != Keys.None) { this.StartDrag(SplineController.SelectMode.Toggle); } else { if ((Control.ModifierKeys & Keys.Shift) != Keys.None) { this.StartDrag(SplineController.SelectMode.Add); } else { if (this.TestPoints()) { if (!this.m_splineController.IsSelected(this.m_hitPoint)) { this.m_splineController.ClearSelection(); this.m_splineController.SetSelected(this.m_hitPoint, true); } this.m_state = ToolSpline.State.Moving; } else { this.StartDrag(SplineController.SelectMode.Replace); } } } break; case ToolSpline.EditTool.Paint: case ToolSpline.EditTool.Add: { this.m_hitPoint = -1; this.m_hitDelta = new Vec2(0f, 0f); Vec3 vec; if (this.m_spline.Count < 100 && Editor.RayCastTerrainFromMouse(out vec)) { if (this.m_spline.Count <= 1) { if (this.m_spline.Count < 1) { this.m_spline.AddPoint(vec.XY); } this.m_spline.AddPoint(vec.XY); this.m_hitPoint = 1; } else { if (this.TestPoints()) { if (this.m_hitPoint == 0) { this.m_spline.InsertPoint(vec.XY, 0); } else { if (this.m_hitPoint == this.m_spline.Count - 1) { this.m_spline.InsertPoint(vec.XY, this.m_hitPoint + 1); this.m_hitPoint++; } } } else { if (this.TestSegments()) { this.m_hitPoint++; this.m_spline.InsertPoint(vec.XY, this.m_hitPoint); } } } if (this.m_hitPoint != -1) { this.m_splineController.ClearSelection(); this.m_splineController.SetSelected(this.m_hitPoint, true); this.m_spline.UpdateSpline(); if (this.m_paramEditTool.Value == ToolSpline.EditTool.Paint) { this.m_state = ToolSpline.State.Drawing; if (this.m_hitPoint == 0) { this.m_forward = false; } else { if (this.m_hitPoint == this.m_spline.Count - 1) { this.m_forward = true; } else { this.m_state = ToolSpline.State.Moving; } } } else { this.m_state = ToolSpline.State.Moving; } } } break; } case ToolSpline.EditTool.Remove: this.RemovePointUnderMouse(); this.m_state = ToolSpline.State.Removing; break; } if (this.m_state != ToolSpline.State.None) { MainForm.Instance.EnableShortcuts = false; } else { UndoManager.CommitUndo(); } } break; case Editor.MouseEvent.MouseUp: if (this.m_spline.IsValid && this.m_state != ToolSpline.State.None) { UndoManager.CommitUndo(); switch (this.m_state) { case ToolSpline.State.Dragging: { RectangleF dragRectangle = this.DragRectangle; this.m_splineController.SelectFromScreenRect(dragRectangle, 0.015f, this.m_dragMode); break; } case ToolSpline.State.Drawing: { bool flag = false; if (this.m_forward && this.m_hitPoint >= 1) { flag = this.m_spline.OptimizePoint(this.m_hitPoint - 1); } else { if (!this.m_forward && this.m_hitPoint < this.m_spline.Count - 1) { flag = this.m_spline.OptimizePoint(this.m_hitPoint + 1); } } if (flag) { this.m_spline.UpdateSpline(); } break; } } if (this.m_spline.RemoveSimilarPoints()) { this.m_spline.UpdateSpline(); this.m_splineController.ClearSelection(); } if (this.m_state != ToolSpline.State.None) { this.m_spline.FinalizeSpline(); MainForm.Instance.EnableShortcuts = true; } this.m_hitPoint = -1; this.m_state = ToolSpline.State.None; } break; case Editor.MouseEvent.MouseMove: if (this.m_spline.IsValid) { switch (this.m_state) { case ToolSpline.State.Moving: this.MovePointsToMouse(false); break; case ToolSpline.State.Drawing: this.MovePointsToMouse(true); break; case ToolSpline.State.Removing: this.RemovePointUnderMouse(); break; } } break; } return(false); }