Loading...
Searching...
No Matches
CityBuilderCore.UndoRedoActionBase Class Referenceabstract

Detailed Description

abstract base class for IUndoRedoAction that provides default implementations for some functions

Inheritance diagram for CityBuilderCore.UndoRedoActionBase:
CityBuilderCore.IUndoRedoAction CityBuilderCore.ISaveData CityBuilderCore.RoadNetwork.UndoRedoRoadBase CityBuilderCore.StructureCollectionFloat.UndoRedoStructureCollectionFloatBase CityBuilderCore.StructureTerrainTreeVariants.UndoRedoStructureTerrainTreeVariantsBase CityBuilderCore.StructureTerrainTrees.UndoRedoStructureTerrainTreesBase CityBuilderCore.UndoRedoActionBuildingBase CityBuilderCore.UndoRedoActionStructureBase CityBuilderCore.UndoRedoGlobalItems CityBuilderCore.RoadNetwork.RoadAddition CityBuilderCore.RoadNetwork.RoadRemoval CityBuilderCore.StructureCollectionFloat.StructureCollectionFloatAddition CityBuilderCore.StructureCollectionFloat.StructureCollectionFloatRemoval CityBuilderCore.StructureTerrainTreeVariants.StructureTerrainTreeVariantsAddition CityBuilderCore.StructureTerrainTreeVariants.StructureTerrainTreeVariantsRemoval CityBuilderCore.StructureTerrainTrees.StructureTerrainTreesAddition CityBuilderCore.StructureTerrainTrees.StructureTerrainTreesRemoval CityBuilderCore.BuildingAddition CityBuilderCore.BuildingRemoval CityBuilderCore.StructureAddition CityBuilderCore.StructureRemoval

Public Member Functions

void Undo ()
 undoes the action
 
void Redo ()
 redoes the action after it has been undone
 
virtual IEnumerable< Vector2Int > GetPoints ()
 determines and returns the map points affected by this action
used, for example, to spawn particles at these points
 
string SaveData ()
 serializes the objects state(usually to json) and returns it
 
void LoadData (string json)
 deserializes the serialized json data and loads the data as its new state
 

Properties

string Name [get]
 name of the action to be displayed in the ui(tooltip)
 
virtual bool CanUndo [get]
 whether the action is currently valid to be undone
for example building a hut cannot be undone if that hut has since been destroyed
 
virtual bool CanRedo [get]
 whether the action is currently valid to be redone
 
- Properties inherited from CityBuilderCore.IUndoRedoAction

Member Function Documentation

◆ GetPoints()

virtual IEnumerable< Vector2Int > CityBuilderCore.UndoRedoActionBase.GetPoints ( )
virtual

◆ LoadData()

void CityBuilderCore.UndoRedoActionBase.LoadData ( string json)
abstract

deserializes the serialized json data and loads the data as its new state

Parameters
json

Implements CityBuilderCore.ISaveData.

◆ Redo()

void CityBuilderCore.UndoRedoActionBase.Redo ( )
abstract

redoes the action after it has been undone

Implements CityBuilderCore.IUndoRedoAction.

◆ SaveData()

string CityBuilderCore.UndoRedoActionBase.SaveData ( )
abstract

serializes the objects state(usually to json) and returns it

Returns
serialized save data

Implements CityBuilderCore.ISaveData.

◆ Undo()

void CityBuilderCore.UndoRedoActionBase.Undo ( )
abstract

undoes the action

Implements CityBuilderCore.IUndoRedoAction.

Property Documentation

◆ CanRedo

virtual bool CityBuilderCore.UndoRedoActionBase.CanRedo
get

whether the action is currently valid to be redone

Implements CityBuilderCore.IUndoRedoAction.

◆ CanUndo

virtual bool CityBuilderCore.UndoRedoActionBase.CanUndo
get

whether the action is currently valid to be undone
for example building a hut cannot be undone if that hut has since been destroyed

Implements CityBuilderCore.IUndoRedoAction.

◆ Name

string CityBuilderCore.UndoRedoActionBase.Name
getabstract

name of the action to be displayed in the ui(tooltip)

Implements CityBuilderCore.IUndoRedoAction.