Class BinaryStateStore<TState>
- Namespace
- Backdash.Synchronizing.State.Stores
- Assembly
- Backdash.dll
Binary store for temporary save and restore game states using IBinarySerializer<T>.
public sealed class BinaryStateStore<TState> : IStateStore<TState>, IDisposable where TState : notnull, new()
Type Parameters
TState
- Inheritance
-
BinaryStateStore<TState>
- Implements
-
IStateStore<TState>
- Inherited Members
Constructors
BinaryStateStore(IBinarySerializer<TState>, int)
Binary store for temporary save and restore game states using IBinarySerializer<T>.
public BinaryStateStore(IBinarySerializer<TState> serializer, int hintSize = 128)
Parameters
serializer
IBinarySerializer<TState>state serializer
hintSize
intinitial memory used for infer the state size
Methods
Dispose()
public void Dispose()
GetCurrent()
Returns current SavedFrame<TState>.
public ref TState GetCurrent()
Returns
- TState
Initialize(int)
Initialize the state buffer with capacity of saveCount
public void Initialize(int saveCount)
Parameters
saveCount
int
Last()
Returns last SavedFrame<TState>.
public ref readonly SavedFrame<TState> Last()
Returns
- SavedFrame<TState>
Load(Frame)
Returns a SavedFrame<TState> for frame
.
public ref readonly SavedFrame<TState> Load(Frame frame)
Parameters
frame
FrameFrame to load.
Returns
- SavedFrame<TState>
SaveCurrent(in Frame, in int)
public ref readonly SavedFrame<TState> SaveCurrent(in Frame frame, in int checksum)
Parameters
Returns
- SavedFrame<TState>