Пример #1
0
        /// <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);
        }
Пример #2
0
    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);
        }
    }
Пример #3
0
 public void Undo()
 {
     undo.Undo();
     UpdateScoreText();
 }