An abstract class in Root.Township, the global namespace.
Component front for an undo and redo history, raising bool events when undo or redo becomes possible or not, for buttons.
Constructors
| Member | What it is |
|---|
protected HistoryAccess() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|
private bool cacheRedoPossible | Last known redo state. |
private bool cacheUndoPossible | Last known undo state. |
private BoolEvent redoPossibleChanged | Event raised with whether redo is now possible. |
private BoolEvent undoPossibleChanged | Event raised with whether undo is now possible. |
Properties
| Member | What it is |
|---|
abstract IHistoryManager History { get; } | The history this component drives. |
bool IsRedoPossible { get; } | Whether there is something to redo. |
bool IsUndoPossible { get; } | Whether there is something to undo. |
Events
| Member | What it is |
|---|
event Action ItemPushed | Raised when a new item is added to the history. |
Methods
| Member | What it is |
|---|
void Clear() | Clears the history. |
void Redo() | Redoes the last undone item. |
void Undo() | Undoes the last item. |
protected virtual void Awake() | Listens for new history items. |
2 private and internal methods
| Member | What it is |
|---|
private void OnItemPushed() | Updates the undo and redo state and raises ItemPushed when the history gets a new action. |
private void UpdateCache() | Raises the undo and redo events when either becomes possible or impossible. |