Exemple #1
0
 protected internal virtual bool OnKeyUpCore(MapKeyEventArgs e)
 {
     return false;
 }
        /// <summary>
        /// Grow or shrink the ActiveRectangle.
        /// Stop the Tooltip.
        /// </summary>
        protected internal override bool OnKeyDownCore(MapKeyEventArgs e)
        {
            Point? keyMove = new KeyboardInputToMovementConverter(e.KeyEventArgs.KeyData).GetKeyMove();
            if (keyMove.HasValue)
            {
                _activeRectangle.Width += keyMove.Value.X;
                _activeRectangleSize.Width += keyMove.Value.X;
                _activeRectangleSize.Height -= keyMove.Value.Y;
                _activeRectangle.Height -= keyMove.Value.Y;
                return true;
            }
            else
            {
                const int step = 5;
                const int largeStep = 20;
                switch (e.KeyEventArgs.KeyData)
                {
                    case Keys.Subtract | Keys.Control:
                        InflateActiveRectangle(-largeStep);
                        return true;

                    case Keys.Add | Keys.Control:
                        InflateActiveRectangle(largeStep);
                        return true;

                    case Keys.Add:
                        InflateActiveRectangle(step);
                        return true;

                    case Keys.Subtract:
                        InflateActiveRectangle(-step);
                        return true;

                    case Keys.S:
                        _showHelpTooltip = false;
                        return true;
                }
            }
            return false;
        }
        protected internal override bool OnKeyDownCore(MapKeyEventArgs e)
        {
            switch (e.KeyEventArgs.KeyCode)
            {
                case Keys.Delete:
                    if (ActiveAttacker != null)
                    {
                        _map.EventPublisher.AttackUpdateTarget(this, AttackUpdateEventArgs.DeleteAttackFrom(ActiveAttacker));
                    }
                    else if (ActivePlan != null)
                    {
                        _map.EventPublisher.AttackRemoveTarget(this, ActivePlan);
                    }
                    break;
            }

            return false;
        }
        /// <summary>
        /// Handles keypresses on the map
        /// </summary>
        protected internal override bool OnKeyDownCore(MapKeyEventArgs e)
        {
            if (ActivePolygon != null)
            {
                if (e.KeyEventArgs.KeyCode == Keys.Delete)
                {
                    Delete(ActivePolygon);
                    return true;
                }

                if (!ActivePolygon.Drawing)
                {
                    var polygonMove = new KeyboardInputToMovementConverter(e.KeyEventArgs.KeyData, 1, 5).GetKeyMove();
                    if (polygonMove.HasValue)
                    {
                        ActivePolygon.Move(polygonMove.Value);
                        return true;
                    }
                }
            }
            return false;
        }
 protected internal override bool OnKeyDownCore(MapKeyEventArgs e)
 {
     if (e.KeyEventArgs.KeyData == Keys.L && _pinPointedVillage != null)
     {
         _lockPinpointedVillage = !_lockPinpointedVillage;
     }
     return false;
 }
        protected internal override bool OnKeyDownCore(MapKeyEventArgs e)
        {
            if (ArrowsToMove)
            {
                Point? keyMove = new KeyboardInputToMovementConverter(e.KeyEventArgs.KeyData).GetKeyMove();
                if (keyMove.HasValue)
                {
                    return MoveMap(keyMove.Value);
                }
                else
                {
                    switch (e.KeyEventArgs.KeyData)
                    {
                        case Keys.Home:
                            _map.GoHome();
                            return true;

                        case Keys.Add:
                            _map.IncreaseZoomLevel(1);
                            return true;

                        case Keys.Subtract:
                            _map.IncreaseZoomLevel(-1);
                            return true;
                    }
                }
            }
            return false;
        }
 public bool OnKeyUpCore(MapKeyEventArgs e)
 {
     if (_fullControllManipulator != null)
     {
         return _fullControllManipulator.OnKeyUpCore(e);
     }
     else
     {
         bool redraw = false;
         foreach (ManipulatorBase m in _manipulators) redraw |= m.OnKeyUpCore(e);
         return redraw;
     }
 }
        public bool OnKeyDownCore(MapKeyEventArgs e)
        {
            switch (e.KeyEventArgs.KeyCode)
            {
                case Keys.T:
                    TooltipActive = !TooltipActive;
                    return false;

                case Keys.D:
                    if (e.KeyEventArgs.Modifiers.HasFlag(Keys.Alt))
                    {
                        _map.SwitchDisplay();
                    }
                    return false;

                case Keys.Back:
                    break;
            }

            if (_fullControllManipulator != null)
            {
                return _fullControllManipulator.OnKeyDownCore(e);
            }
            else
            {
                bool redraw = false;
                foreach (ManipulatorBase m in _manipulators) redraw |= m.OnKeyDownCore(e);
                return redraw;
            }
        }