Skip to main content

ChunkContentManager

An abstract class in Root.Township, Alta.Chunks.

Base for what loads and unloads a chunk's contents. Tracks the wanted state and runs one load or unload at a time; subclasses include server, client, static and dynamic managers.

Constructors​

MemberWhat it is
ChunkContentManager(Chunk chunk)Creates a ChunkContentManager from chunk.

Fields​

MemberWhat it is
protected Task loadTaskThe running load task, or null.
protected Task unloadTaskThe running unload task, or null.

Properties​

MemberWhat it is
Chunk Chunk { get; private set; }The chunk whose contents this manages.
ContentState CurrentProcess { get; protected set; }The state the manager is working towards or has reached.
ContentState DesiredState { get; private set; }The state last asked for with Load or Unload.
virtual bool IsAllowingUnload { get; }Whether the contents may be unloaded now. True by default.
bool IsTransitioning { get; }True while a load or unload task is running.

Events​

MemberWhat it is
event Action<Chunk> LoadedRaised when loading finishes and loaded is still the wanted state.
event Action<Chunk> UnloadedRaised when unloading finishes and unloaded is still the wanted state.

Methods​

MemberWhat it is
virtual async Task Clear()Clears the contents. Does nothing by default.
async Task Load()Loads the contents, waiting for a running unload first. Raises Loaded if still wanted when done.
virtual Task Save()Saves the contents. Does nothing by default.
async Task Unload()Unloads the contents, waiting for a running load first. Raises Unloaded if still wanted when done.
virtual void UpdateIdentifier()Hook for when the chunk's identifier changes. Does nothing by default.
protected virtual async Task LoadInternal()Does the actual loading. Override in subclasses.
protected virtual async Task UnloadInternal()Does the actual unloading. Override in subclasses.
protected virtual void WaitingToLoadForUnload()Hook for subclasses; does nothing by default.

Used in​

Members of other types that take, return or hold a ChunkContentManager: