PostboxManager
A class in Root.Township, the global namespace.
Server: the per-player manager that loads and saves each player's postbox contents (PlayerPostboxStorage). Reach it through PerPlayerManager<PostboxManager, PlayerPostboxStorage, PlayerPostboxStorageFileFormat>.Instance. It also collects trade vendor refunds during a wipe and posts them afterwards.
- Listed in Global namespace: P
- Inherits or implements
PerPlayerManager<PostboxManager, PlayerPostboxStorage, PlayerPostboxStorageFileFormat> - Derived types
PostboxManager - Nested types
TradeVendorData - Documented in Trading
Constructors
| Member | What it is |
|---|---|
PostboxManager() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
| Member | What it is |
|---|---|
private PlayerPostboxStorage.InitialContent[] initialContent | Items a player's postbox starts with the first time it's created. |
private static Logger logger | NLog logger for this class. |
private Dictionary<int, PostboxManager.TradeVendorData> wipeData | Refunds collected during a wipe, keyed by player identifier. |
Methods
| Member | What it is |
|---|---|
async void ConcludeWipe() | Server: after a wipe finishes, pushes each player's collected wipe refunds (coins as a coin or pouch, plus items) into their postbox. |
override async Task<PlayerPostboxStorage> GetContentAsync(IPlayer player) | Server: loads a player's postbox storage and fills it with initialContent if it's new. |
override void InitializeAsServer(SpawnData spawnData) | Server: sets up the wipe data and hooks ConcludeWipe to ServerWipeManager.WipeOperationsFinished. |
static async void PostToPlayer(int playerIdentifier, NetworkPrefab prefab) | Server: saves a prefab, destroys it in the world and pushes the save into the given player's postbox, saving if they're offline. |
void TradeWipe(int playerIdentifier, int coinCount, NetworkEntity dockedItem) | Server: records coins and a docked item from a trade vendor to refund to a player once the wipe ends. Destroys the item. |