コード例 #1
0
        /// <summary>
        /// Restores an older or newer state.
        /// </summary>
        /// <param name="direction">The direction to restore in. If less than 0, an older state will be used. If greater than 0, a newer state will be used.</param>
        public void RestoreState(int direction)
        {
            if (bulkChangesStarted > 0)
            {
                return;
            }

            if (savedStates.Count == 0)
            {
                return;
            }

            int newState = Math.Clamp(currentState + direction, 0, savedStates.Count - 1);

            if (currentState == newState)
            {
                return;
            }

            isRestoring = true;

            patcher.Patch(savedStates[currentState], savedStates[newState]);
            currentState = newState;

            isRestoring = false;
        }
コード例 #2
0
        /// <summary>
        /// Restores an older or newer state.
        /// </summary>
        /// <param name="direction">The direction to restore in. If less than 0, an older state will be used. If greater than 0, a newer state will be used.</param>
        public void RestoreState(int direction)
        {
            if (TransactionActive)
            {
                return;
            }

            if (savedStates.Count == 0)
            {
                return;
            }

            int newState = Math.Clamp(currentState + direction, 0, savedStates.Count - 1);

            if (currentState == newState)
            {
                return;
            }

            isRestoring = true;

            patcher.Patch(savedStates[currentState], savedStates[newState]);
            currentState = newState;

            isRestoring = false;

            OnStateChange?.Invoke();
            updateBindables();
        }