/// <summary> /// Performs an undo action. /// </summary> /// <returns> /// Returns true if the undo action succeeds; otherwise, returns false. /// </returns> public bool Undo() { bool flag = true; if (AllowUndo && CanUndo) { IUndo undo = UndoList.Peek() as IUndo; try { if ((undo != null) && undo.CanUndo) { flag = undo.Undo(Context); } } catch { flag = false; } if (Context is Excel excel) { excel.ResumeInvalidate(); } if (flag) { RedoList.Push(UndoList.Pop()); RaiseChanged(UndoRedoOperation.Undo, undo.ToString()); } } return(flag); }
void Update() { if (Input.GetKeyDown(KeyCode.Z) || Input.GetMouseButtonDown(1)) { undoHandler.Undo(); } if (Input.GetKeyDown(KeyCode.R)) { undoHandler.UndoAll(); } Card card; if (HasClickedOnCard(out card)) { game.ClickCard(card); } }
public void Undo() { undo.Undo(); UpdateScoreText(); }