public void Execute() { var canExecute = CanExecute(); if (!canExecute) { throw new InvalidOperationException("Попытка выполнить команду, которую нельзя выполнять в данный момент."); } ExecuteTacticCommand(); if (UpdateGameLoop) { _gameLoop.Update(); } }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.MouseMove"></see> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs"></see> that contains the event data.</param> protected override void OnMouseMove(MouseEventArgs e) { if (DesignView.Context != null) { Size dragBoxSize = SystemInformation.DragSize; CurrentMousePoint = new Point(e.X, e.Y); int dx = CurrentMousePoint.X - FirstMousePoint.X; int dy = CurrentMousePoint.Y - FirstMousePoint.Y; if (!m_dragOverThreshold) { if (Math.Abs(dx) > dragBoxSize.Width || Math.Abs(dy) > dragBoxSize.Height) { m_dragOverThreshold = true; if (m_mouseDownAction == MouseDownAction.Manipulating) { DesignView.Manipulator.OnBeginDrag(this, e.Location); } } } if (m_mouseDownAction == MouseDownAction.Picking) { Invalidate(); } else if (m_mouseDownAction == MouseDownAction.ControllingCamera) { CameraController.MouseMove(this, e); } else if (m_mouseDownAction == MouseDownAction.Manipulating) { if (m_dragOverThreshold) { DesignView.Manipulator.OnDragging(this, e.Location); GameLoop.Update(); GameLoop.Render(); if (m_propEditor == null) { m_propEditor = Globals.MEFContainer.GetExportedValue <PropertyEditor>(); } m_propEditor.PropertyGrid.RefreshProperties(); } } else if (DesignView.Manipulator != null) { bool picked = DesignView.Manipulator.Pick(this, e.Location) != ManipulatorPickResult.Miss; this.Cursor = picked ? Cursors.SizeAll : Cursors.Default; DesignView.InvalidateViews(); } else if (this.Cursor != Cursors.Default) { this.Cursor = Cursors.Default; } } if (m_dragOverThreshold) { m_hitIndex = -1; } base.OnMouseMove(e); }
// Update is called once per frame void Update() { m_GameLoop?.Update(); }
public void Update() { _gameLoop.Update(); }