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
campaignCampaignAssetstoreISaveStore
Properties
Active
Progress of the open slot, or null.
public CampaignProgress Active { get; }
Property Value
ActiveSlot
The open slot, or -1.
public int ActiveSlot { get; }
Property Value
Campaign
The campaign.
public CampaignAsset Campaign { get; }
Property Value
LastStatus
Status of the last read of the open slot.
public SaveLoadStatus LastStatus { get; }
Property Value
SlotCount
Number of slots.
public int SlotCount { get; }
Property Value
Store
The storage.
public ISaveStore Store { get; }
Property Value
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
slotint
Returns
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
slotint
Returns
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
slotint
Returns
SaveActive()
Writes the open slot. Returns false when no slot is open or the write failed.
public bool SaveActive()
Returns
Events
SlotOpened
Raised after a slot was opened.
public event Action<int, CampaignProgress> SlotOpened