Class PlayerPrefsSaveStore
- Namespace
- TDMaker.Unity.Campaign
- Assembly
- TDMaker.Unity.dll
Store in UnityEngine.PlayerPrefs (browser storage in WebGL builds): one string per slot under prefix + slot number.
Unreadable content is copied to key.bak before the slot is cleared. Flushes with UnityEngine.PlayerPrefs.Save() on every write.
public sealed class PlayerPrefsSaveStore : TextSaveStore, ISaveStore
- Inheritance
-
PlayerPrefsSaveStore
- Implements
- Inherited Members
Constructors
PlayerPrefsSaveStore(string, int)
Creates a store using keys keyPrefix1, 2, ...
public PlayerPrefsSaveStore(string keyPrefix = "TDMaker.Save.Slot", int slots = 3)
Parameters
Properties
KeyPrefix
Key prefix.
public string KeyPrefix { get; }
Property Value
Methods
Backup(int, string)
Moves unreadable slot content out of the way, keeping it. Returns where it went (for the warning).
protected override string Backup(int slot, string text)
Parameters
Returns
DeleteText(int)
Removes a slot.
protected override void DeleteText(int slot)
Parameters
slotint
HasText(int)
Whether a slot holds text.
protected override bool HasText(int slot)
Parameters
slotint
Returns
KeyOf(int)
PlayerPrefs key of slot.
public string KeyOf(int slot)
Parameters
slotint
Returns
ReadText(int)
Reads the raw text of a slot, or null when it is empty.
protected override string ReadText(int slot)
Parameters
slotint
Returns
WriteText(int, string)
Writes the raw text of a slot.
protected override void WriteText(int slot, string text)