public void PressDown() { if (command != null) { command.Undo(); } }
//Выполняет введенную команду public void ExecuteCommand(string input) { if (input.Length == 1) { char commandDirection = input[0]; //Отмена последней команды if (commandDirection == 'c') { //Если стек команд не пуст if (rover._commands.Count != 0) { //Взять и удалить последнюю команду из стека ICommand c = rover._commands.Pop(); //Отменить эту команду c.Undo(); } } else { //Создать новую команду на передвижение var command = new RoverCommand(commandDirection, rover); //Выполнить ее command.Execute(); } } }
/// <summary> /// Rollback the commands that have been executed already. /// </summary> public void Rollback() { if (!_contextRolledback) { ProcessorContext.Rollback(); _contextRolledback = true; } while (_stack.Count > 0) { ICommand command = _stack.Pop(); try { command.Undo(); } catch (Exception e) { Platform.Log(LogLevel.Error, e, "Unexpected exception rolling back command {0}", command.Description); } var aggregateCommand = command as IAggregateCommand; if (aggregateCommand != null) { RollbackAggregateCommand(aggregateCommand); } } }
void SetHideFlags() { SyncColliderWithRectTransform scwrt = target as SyncColliderWithRectTransform; if (!scwrt.SyncedCollider) { return; } if (SHF != null) { SHF.Undo(); } SHF = new UnityCommands.SetHideFlags(scwrt.SyncedCollider, HideFlags.NotEditable); SHF.Execute(); }
public void Undo() { // Undo is not supported for player units. // We may want to consider splitting this command in two: Spawn initial unit / Spawn unit if (_data.unitCommandData.UnitType == UnitType.Player) { _logger.Log(LoggedFeature.Replays, "Not undoing command since unit type is player."); return; } // Despawn pets first. // We need to directly run the command since these are children of the parent spawn unit command, // and should never be ran as standalone for (var i = 0; i < _data.unitCommandData.pets.Length; i++) { ICommand petSpawnCommand = _commandFactory.Create(typeof(SpawnUnitCommand), typeof(SpawnUnitData), new SpawnUnitData(_data.unitCommandData.pets[i], _data.tileCoords, _data.isInitialSpawn)); petSpawnCommand.Undo(); } // Now the unit itself. IUnit unit = _unitRegistry.GetUnit(_data.unitCommandData.unitId); _unitPool.Despawn(unit.UnitId); _gridUnitManager.RemoveUnit(unit); }
public void Undo() { ICommand cmd = StackRedo.Pop(); cmd.Undo(); StackRedo.Push(cmd); }
public void Undo() { if (history.Count > 0) { ICommand recent = history.Pop(); recent.Undo(); redos.Push(recent); if (history.PeekTop() is Move topAsMove) { //After we undo, lets re-collect items or get killed by lasers or whatever, if that was where we were. if (topAsMove.executedValidAndComplete) { _puzzleManager.preMoveComplete?.Invoke(topAsMove); _puzzleManager.postMoveComplete?.Invoke(topAsMove); } } if (!recent.HistoryPoint) { Undo(); //recursive loop! } } _puzzleManager.TurnCounter.RemoveTurn(); _puzzleManager.TriggerMachine(); OnUndo?.Invoke(); }
public override void Undo() { if (_command != null) { _command.Undo(); } }
private void UndoMostRecentCommand() { ICommand command = _history.PopCommand(); command.Undo(); Refresh(); }
private void Undo() { if (_commandMemoryList.Count == 0) { return; } var command = _commandMemoryList[_commandMemoryList.Count - 1]; switch (command.Type) { case CommandType.None: break; case CommandType.MoveRight: _moveRightCommand.Undo(_actor); break; case CommandType.MoveLeft: _moveLeftCommand.Undo(_actor); break; default: throw new ArgumentOutOfRangeException(); } _commandMemoryList.RemoveAt(_commandMemoryList.Count - 1); }
/// <summary>clears queued commands</summary> public void Undo() { _currentCommand.Undo(); _currentCommand = null; _commands.Clear(); }
public void StopProject() { if (command != null) { command.Undo(); } }
public void Cancel() { if (preparing != null) { preparing.Undo(); preparing = null; } }
/// <summary> /// Executes Undo of the current command from the list. /// </summary> public void Undo() { ICommand command = commandsList[currentCommandIndex] as ICommand; command.Undo(); currentCommandIndex -= 1; SetUndoRedoMessages(); }
public void Undo() { if (commandsHistory.Count > 0) { ICommand undoCommand = commandsHistory.Pop(); undoCommand.Undo(); } }
public void Undo() { ICommand com = undoStack[undoStack.Count - 1]; com.Undo(); undoStack.Remove(com); redoStack.Add(com); }
public void Undo() { if (commandStack.Count > 0) { ICommand cmd = (ICommand)commandStack.Pop(); cmd.Undo(); } }
void SetHideFlags() { PathPosition pathPosition = target as PathPosition; //don't hide transform if there is no path yet if (!pathPosition.Path) { return; } if (SHF != null) { SHF.Undo(); } SHF = new UnityCommands.SetHideFlags(pathPosition.transform, HideFlags.NotEditable); SHF.Execute(); }
public void PressUndoButton() { if (_commandsHistory.Count > 0) { ICommand command = _commandsHistory.Pop(); command.Undo(); } }
public void Undo() { while (_commands.Count > 0) { ICommand command = _commands.Pop(); command.Undo(); } }
public void Undo() { while (_cmdStack.Count > 0) { ICommand cmd = _cmdStack.Pop(); cmd.Undo(); } }
public void Undo() { if (CanUndo()) { ICommand <TItem> command = Commands.Pop(); command.Undo(Items); } }
public void PressUndoButton() { if (commandsHistory.Count > 0) { ICommand undoCommand = commandsHistory.Pop(); undoCommand.Undo(); } }
public void Undo() { if (_currentCommandNum > 0) { _currentCommandNum--; ICommand command = commands[_currentCommandNum]; command.Undo(); } }
public void Undo() { if (historyUndo.Count > 0) { ICommand command = historyUndo.Pop(); historyRedo.Push(command); command.Undo(); } }
public void OnClick(ref Context context) { if (context.undoStack.Count > 0) { ICommand c = context.undoStack.Pop(); context.redoStack.Push(c); c.Undo(ref context); } }
protected override void OnConditionNotMet() { if (_wasPassageAllowed) { _command.Undo(); NotifyOnNext(new EventPuzzle(PuzzleStatus.NotSolved, outOfPathBlock.name)); } _wasPassageAllowed = false; }
public void CancelCommand() { if (_currentcommand != null && _currentcommand.Count > 0) { _currentcommand.Undo(); } _commandtype = CommandTypes.None; _currentcommand = null; }
/// <summary> /// Executes Undo of the current command from the list. /// </summary> public void Undo() { ICommand command = this.commandsList[this.currentCommandIndex] as ICommand; command.Undo(); this.currentCommandIndex -= 1; this.SetUndoRedoMessages(); }
public string Undo(int number) { if (commandsHistory.Count > 0) { ICommand undoCommand = commandsHistory.Pop(); return(undoCommand.Undo()); } return("No any past state"); }
public void Undo(ICommand command) { if (CanUndo(command)) { undoStack.Pop(); command.Undo(); redoStack.Push(command); } }
protected virtual bool DoUnexecute(ICommand command) { try { command.Undo(); return true; } catch (CommandExecutionCancelledException) { return false; } }
public void UndoButtonPressed(ICommand command) { command.Undo(); }
void Undo(ICommand c) { c.Undo(this); redoStack.Push(c); UndoCapabilityChanged(); }