InfoBoard
A class in Root.Township, Alta.Map.
A board that shows server-set text. The server reads the text from a file named by the board's identifier in the save's InfoBoard folder and syncs it to players.
- Listed in World, chunks and saving
- Inherits or implements
NetworkEntityBehaviour,ISavable<InfoBoardSaveData>,ISavableSave<InfoBoardSaveData>,ISavableSaveBase - Derived types
InfoBoardSaveData
Constructors
| Member | What it is |
|---|---|
InfoBoard() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|---|
private InfoBoardSaveData data | The saved board data, mainly the identifier that names its text file. |
private TextRenderer renderer | The TextRenderer the text is shown on. Not touched on headless servers. |
private MethodSync sync | Method sync used to send the text to players. |
private string value | The current board text, or null before a file is loaded. |
Events
1 private and internal event
Methods
| Member | What it is |
|---|---|
static void ForceRefresh(string identifier) | Server: tells every board with this identifier to reload its file. Called by the infoboard console command after it writes new text. |
override void Initialize() | Sets up the sync method sync on the BookSync message type. |
override void InitializeAsServer(SpawnData spawnData) | Server: loads the text file and starts listening for ForceRefresh. |
override void OnConnected(Player player) | Server: sends the current text to a player who joins, if any text is loaded. |
4 private and internal methods
| Member | What it is |
|---|---|
private void CheckRefresh(string identifier) | Reloads the text file if the refreshed identifier matches this board's. |
private async void LoadFromFile() | Server: reads InfoBoard/<identifier> from the save folder if it exists, stores the text and sends it to the chunk's players. |
private void OnDestroy() | Stops listening for ForceRefresh. |
private void Sync(IPlayer player, Stream stream) | Writes the text on the server; on clients reads it and shows it on renderer. |