Class CampaignSaveSlots

Namespace
TDMaker.Unity.Campaign
Assembly
TDMaker.Unity.dll

Save slots of one campaign over an ISaveStore: summaries for the slot picker, opening a slot (creating a fresh profile for an empty or unreadable one), saving the active slot and deleting slots. App settings are not stored here.

public sealed class CampaignSaveSlots
Inheritance
CampaignSaveSlots
Inherited Members

Constructors

CampaignSaveSlots(CampaignAsset, ISaveStore)

Creates the slot set.

public CampaignSaveSlots(CampaignAsset campaign, ISaveStore store)

Parameters

campaign CampaignAsset
store ISaveStore

Properties

Active

Progress of the open slot, or null.

public CampaignProgress Active { get; }

Property Value

CampaignProgress

ActiveSlot

The open slot, or -1.

public int ActiveSlot { get; }

Property Value

int

Campaign

The campaign.

public CampaignAsset Campaign { get; }

Property Value

CampaignAsset

LastStatus

Status of the last read of the open slot.

public SaveLoadStatus LastStatus { get; }

Property Value

SaveLoadStatus

SlotCount

Number of slots.

public int SlotCount { get; }

Property Value

int

Store

The storage.

public ISaveStore Store { get; }

Property Value

ISaveStore

Methods

Close()

Closes the open slot without saving.

public void Close()

Delete(int)

Deletes a slot (closing it when it is the open one).

public bool Delete(int slot)

Parameters

slot int

Returns

bool

Open(int)

Opens a slot: loads it (a fresh profile when it is empty or unreadable), opens the levels whose rules hold and saves when that changed anything or the slot was new. Pending victories stay pending until the map applies them. Returns the progress.

public CampaignProgress Open(int slot)

Parameters

slot int

Returns

CampaignProgress

Peek(int)

Reads a slot for the picker (does not open it). Unreadable slots are backed up by the store and show as empty.

public SaveSlotSummary Peek(int slot)

Parameters

slot int

Returns

SaveSlotSummary

SaveActive()

Writes the open slot. Returns false when no slot is open or the write failed.

public bool SaveActive()

Returns

bool

Events

SlotOpened

Raised after a slot was opened.

public event Action<int, CampaignProgress> SlotOpened

Event Type

Action<int, CampaignProgress>