public override bool ExecuteCommand(KeyCommands command, Keys modifierKeys, int x, int y, int pixelsInOne)
        {
            if (SphereBox == SphereBox.Sphere)
            {
                if (command == KeyCommands.MoveSelected)
                {
                    _coordinatesStart.X_Scr = x;
                    _coordinatesStart.Z_Scr = y;
                    _coordinatesEnd.X_Scr   = x;
                    _coordinatesEnd.Z_Scr   = y;
                    return(true);
                }
            }
            else
            {
                if (command == KeyCommands.MoveSelected)
                {
                    _coordinatesStart.X_Scr = x;
                    _coordinatesStart.Z_Scr = y;
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        public bool ExecuteCommand(KeyCommands command, PanelSpaceMapMode mode, Keys modifierKeys, int x, int y, int pixelsInOne)
        {
            if (mode == PanelSpaceMapMode.SingleSpecial)
            {
                return(SelectionSpecial.ExecuteCommand(command, modifierKeys, x, y, pixelsInOne));
            }

            return(false);
        }
        public override bool ExecuteCommand(KeyCommands command, Keys modifierKeys, int x, int y, int pixelsInOne)
        {
            if (command == KeyCommands.MoveSelected)
            {
                _coordinates.X_Scr = x;
                _coordinates.Z_Scr = y;
                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
        public override void ProcessMessage(byte[] received, int offset)
        {
            bool useShift = BitConverter.ToBoolean(received, offset);

            if (useShift)
            {
                KeyCommands.TabShift();
            }
            else
            {
                KeyCommands.Tab();
            }
        }
Ejemplo n.º 5
0
        public override void ProcessMessage(byte[] received, int offset)
        {
            short direction = BitConverter.ToInt16(received, offset);

            switch (direction)
            {
            default:
                KeyCommands.Left();
                break;

            case 1:
                KeyCommands.Up();
                break;

            case 2:
                KeyCommands.Down();
                break;

            case 3:
                KeyCommands.Right();
                break;
            }
        }
 public Task <bool> PersistAsync(string key) => MultiAsync(KeyCommands.Persist(key));
 public Task <long> TtlAsync(string key) => MultiAsync(KeyCommands.Ttl(key));
Ejemplo n.º 8
0
 public override void ProcessMessage(byte[] received, int offset)
 {
     KeyCommands.Esc();
 }
 public Task <bool> PExpireAsync(string key, TimeSpan expiration) => MultiAsync(KeyCommands.PExpire(key, (long)expiration.TotalMilliseconds));
 public bool PExpireAt(string key, DateTime date) => Multi(KeyCommands.PExpireAt(key, date.GetUnixTime()));
 public abstract bool ExecuteCommand(KeyCommands command, Keys modifierKeys, int x, int y, int pixelsInOne);
Ejemplo n.º 12
0
 public bool KeyCommandRequiresFocus(KeyCommands command)
 {
     return !_bindsKeyboardCommandsGlobal.Contains(command);
 }
Ejemplo n.º 13
0
 public bool KeyCommandRequiresFocus(KeyCommands command)
 {
     return(!_bindsKeyboardCommandsGlobal.Contains(command));
 }
 public string RandomKey() => Multi(KeyCommands.RandomKey());
 public Task <string> RandomKeyAsync() => MultiAsync(KeyCommands.RandomKey());
 public Task <bool> PExpireAtAsync(string key, long timestamp) => MultiAsync(KeyCommands.PExpireAt(key, timestamp));
 public bool PExpireAt(string key, long timestamp) => Multi(KeyCommands.PExpireAt(key, timestamp));
 public Task <bool> PExpireAtAsync(string key, DateTime date) => MultiAsync(KeyCommands.PExpireAt(key, date.GetUnixTime()));
Ejemplo n.º 19
0
        public bool ExecuteCommand(KeyCommands command, PanelSpaceMapMode mode, Keys modifierKeys, int x, int y, int pixelsInOne)
        {
            if (mode == PanelSpaceMapMode.SingleSpecial)
                return SelectionSpecial.ExecuteCommand(command, modifierKeys, x, y, pixelsInOne);

            return false;
        }
Ejemplo n.º 20
0
 public KeyCommand(KeyCommands name, KeyValue keyValue)
 {
     this.Name     = name;
     this.KeyValue = keyValue;
 }
 public bool PExpire(string key, TimeSpan expiration) => Multi(KeyCommands.PExpire(key, (long)expiration.TotalMilliseconds));
 public bool PExpire(string key, long milliseconds) => Multi(KeyCommands.PExpire(key, milliseconds));
 public string Rename(string key, string newKey) => Multi(KeyCommands.Rename(key, newKey));
 public Task <bool> PExpireAsync(string key, long milliseconds) => MultiAsync(KeyCommands.PExpire(key, milliseconds));
Ejemplo n.º 25
0
        public void ExecuteCommand(KeyCommands command)
        {
            bool additive = Control.ModifierKeys == Keys.Shift;
            //bool removative = Control.ModifierKeys == Keys.Control; // Not used yet, but in case we ever need it

            //Commands that are same for all modes
            switch (command)
            {
                case KeyCommands.ZoomMinus:
                    if (!_beingSelected && !_beingDragged)
                        ScaleBy(-10, (double)_curPointX / _PSM_p_mapSurface.Width, (double)_curPointY / _PSM_p_mapSurface.Height);
                    break;
                case KeyCommands.ZoomPlus:
                    if (!_beingSelected && !_beingDragged)
                        ScaleBy(10, (double)_curPointX / _PSM_p_mapSurface.Width, (double)_curPointY / _PSM_p_mapSurface.Height);
                    break;
                case KeyCommands.MoveUp:
                    MoveBy(0, -10);
                    break;
                case KeyCommands.MoveDown:
                    MoveBy(0,  10);
                    break;
                case KeyCommands.MoveLeft:
                    MoveBy(-10, 0);
                    break;
                case KeyCommands.MoveRight:
                    MoveBy(10,  0);
                    break;
                case KeyCommands.ResetMap:
                    Reset();
                    break;
                case KeyCommands.FinishEditing:
                    if (!ChangesPending)
                    {
                        _form.DialogResult = DialogResult.No;
                        return;
                    }
                    DialogResult result = MessageBox.Show("Accept changes?", "Finished editing", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);
                    if (result != DialogResult.Cancel)
                        _form.DialogResult = result;
                    break;
                case KeyCommands.FinishEditingForceYes:
                    _form.DialogResult = DialogResult.Yes;
                    break;
                case KeyCommands.FinishEditingForceNo:
                    _form.DialogResult = DialogResult.No;
                    break;
                case KeyCommands.FocusMap:
                    SetFocus();
                    break;
            }

            if (Mode == PanelSpaceMapMode.SingleSpecial)
            {
                if (SpaceMap.ExecuteCommand(command, Mode, Control.ModifierKeys, PointXToSpaceMap(_curPointX), PointZToSpaceMap(_curPointY), (int)Math.Round(1.0 / GetMapScale())))
                    RegisterChange("Executed command "+command);
                return;
            }

            switch (command)
            {
                case KeyCommands.MoveSelectionUp:
                    if (SpaceMap.Selection_MoveBy(0, 0, -100))
                        RegisterChange("Moved selection up by 100");
                    break;
                case KeyCommands.MoveSelectionDown:
                    if (SpaceMap.Selection_MoveBy(0, 0, 100))
                        RegisterChange("Moved selection down by 100");
                    break;
                case KeyCommands.MoveSelectionLeft:
                    if (SpaceMap.Selection_MoveBy(-100, 0, 0))
                        RegisterChange("Moved selection left by 100");
                    break;
                case KeyCommands.MoveSelectionRight:
                    if (SpaceMap.Selection_MoveBy(100, 0, 0))
                        RegisterChange("Moved selection right by 100");
                    break;
                case KeyCommands.MoveSelectionFastUp:
                    if (SpaceMap.Selection_MoveBy(0, 0, -1000))
                        RegisterChange("Moved selection up by 1000");
                    break;
                case KeyCommands.MoveSelectionFastDown:
                    if (SpaceMap.Selection_MoveBy(0, 0, 1000))
                        RegisterChange("Moved selection down by 100");
                    break;
                case KeyCommands.MoveSelectionFastLeft:
                    if (SpaceMap.Selection_MoveBy(-1000, 0, 0))
                        RegisterChange("Moved selection left by 100");
                    break;
                case KeyCommands.MoveSelectionFastRight:
                    if (SpaceMap.Selection_MoveBy(1000, 0, 0))
                        RegisterChange("Moved selection right by 100");
                    break;
                case KeyCommands.AddStation:
                    ExecuteCommand_AddObjectToMap("station", additive);
                    break;
                case KeyCommands.AddPlayer:
                    ExecuteCommand_AddObjectToMap("player", additive);
                    break;
                case KeyCommands.AddNeutral:
                    ExecuteCommand_AddObjectToMap("neutral", additive);
                    break;
                case KeyCommands.AddMonster:
                    ExecuteCommand_AddObjectToMap("monster", additive);
                    break;
                case KeyCommands.AddAnomaly:
                    ExecuteCommand_AddObjectToMap("anomaly", additive);
                    break;
                case KeyCommands.AddBlackHole:
                    ExecuteCommand_AddObjectToMap("blackHole", additive);
                    break;
                case KeyCommands.AddGenericMesh:
                    ExecuteCommand_AddObjectToMap("genericMesh", additive);
                    break;
                case KeyCommands.AddEnemy:
                    ExecuteCommand_AddObjectToMap("enemy", additive);
                    break;
                case KeyCommands.AddWhales:
                    ExecuteCommand_AddObjectToMap("whale", additive);
                    break;
                case KeyCommands.AddNebulas:
                    ExecuteCommand_AddObjectToMap("nebulas", additive);
                    break;
                case KeyCommands.AddAsteroids:
                    ExecuteCommand_AddObjectToMap("asteroids", additive);
                    break;
                case KeyCommands.AddMines:
                    ExecuteCommand_AddObjectToMap("mines", additive);
                    break;
                case KeyCommands.MoveSelected:
                    if (SpaceMap.Selection_MoveTo(
                        PointXToSpaceMap(_curPointX), PointZToSpaceMap(_curPointY)))
                        RegisterChange("Moved selection to cursor");
                    break;
                case KeyCommands.DeleteSelected:
                    if (SpaceMap.Delete_Selected()>0)
                        RegisterChange("Deleted selection");
                    break;
                case KeyCommands.SelectAll:
                    if (SpaceMap.Select_All())
                        RegisterChange("Selected all named objects");
                    break;
                case KeyCommands.SelectNone:
                    if (SpaceMap.Select_None())
                        RegisterChange("Cleared selection");
                    break;
                case KeyCommands.SelectNextNamed:
                    if (SpaceMap.Select_NextNamed())
                        RegisterChange("Selected next named object");
                    break;
                case KeyCommands.SelectPreviousNamed:
                    if (SpaceMap.Select_PreviousNamed())
                        RegisterChange("Selected previous named object");
                    break;
                case KeyCommands.SelectPreviousNameless:
                    if (SpaceMap.Select_PreviousNameless())
                        RegisterChange("Selected previous nameless object");
                    break;
                case KeyCommands.SelectNextNameless:
                    if (SpaceMap.Select_NextNameless())
                        RegisterChange("Selected next nameless object");
                    break;
                case KeyCommands.SetStartAngleNegative:
                    if (SpaceMap.Selection_SetStartEndAngleTo(
                        PointXToSpaceMap(_curPointX), PointZToSpaceMap(_curPointY), true, true))
                        RegisterChange("Changed start angle of nameless object");
                    break;
                case KeyCommands.SetStartAnglePositive:
                    if (SpaceMap.Selection_SetStartEndAngleTo(
                        PointXToSpaceMap(_curPointX), PointZToSpaceMap(_curPointY), true, false))
                        RegisterChange("Changed start angle of nameless object");
                    break;
                case KeyCommands.SetStartAngleNull:
                    if (SpaceMap.Selection_SetStartEndAngleTo(0, 0, true, null))
                        RegisterChange("Set start angle of nameless object to null");
                    break;
                case KeyCommands.SetEndAngleNegative:
                    if (SpaceMap.Selection_SetStartEndAngleTo(
                        PointXToSpaceMap(_curPointX), PointZToSpaceMap(_curPointY), false, true))
                        RegisterChange("Changed end angle of nameless object");
                    break;
                case KeyCommands.SetEndAnglePositive:
                    if (SpaceMap.Selection_SetStartEndAngleTo(
                        PointXToSpaceMap(_curPointX), PointZToSpaceMap(_curPointY), false, false))
                        RegisterChange("Changed end angle of nameless object");
                    break;
                case KeyCommands.SetEndAngleNull:
                    if (SpaceMap.Selection_SetStartEndAngleTo(0, 0, false, null))
                        RegisterChange("Set end angle of nameless object to null");
                    break;
            }
        }
 public Task <string> RenameAsync(string key, string newKey) => MultiAsync(KeyCommands.Rename(key, newKey));
Ejemplo n.º 27
0
 public KeyCommand(KeyCommands name, string value)
 {
     this.Name  = name;
     this.Value = value;
 }
 public bool RenameNx(string key, string newKey) => Multi(KeyCommands.RenameNx(key, newKey));
        public override bool ExecuteCommand(KeyCommands command, Keys modifierKeys, int x, int y, int pixelsInOne)
        {
            if (SphereBox == SphereBox.Sphere)
            {
                if (command == KeyCommands.MoveSelected)
                {
                    _coordinatesStart.X_Scr = x;
                    _coordinatesStart.Z_Scr = y;
                    _coordinatesEnd.X_Scr = x;
                    _coordinatesEnd.Z_Scr = y;
                    return true;
                }
            }
            else
            {
                if (command == KeyCommands.MoveSelected)
                {
                    _coordinatesStart.X_Scr = x;
                    _coordinatesStart.Z_Scr = y;
                    return true;
                }
            }

            return false;
        }
 public Task <bool> RenameNxAsync(string key, string newKey) => MultiAsync(KeyCommands.RenameNx(key, newKey));
        public override bool ExecuteCommand(KeyCommands command, Keys modifierKeys, int x, int y, int pixelsInOne)
        {
            if (command == KeyCommands.MoveSelected)
            {
                _coordinates.X_Scr = x;
                _coordinates.Z_Scr = y;
                return true;
            }

            return false;
        }
 public string Restore(string key, long ttl, string serializedValue) => Multi(KeyCommands.Restore(key, ttl, serializedValue));
 public abstract bool ExecuteCommand(KeyCommands command, Keys modifierKeys, int x, int y, int pixelsInOne);
 public Task <string> RestoreAsync(string key, long ttl, string serializedValue) => MultiAsync(KeyCommands.Restore(key, ttl, serializedValue));
 public long Ttl(string key) => Multi(KeyCommands.Ttl(key));
 public bool Persist(string key) => Multi(KeyCommands.Persist(key));