ServerSelector
A class in Root.Township, the global namespace.
Main-menu server list helper: when a server is selected it fills a gauge, then fires the selection finished event; deselecting fades the gauge out.
- Listed in Global namespace: S
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
ServerSelector() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
8 private and internal fields
| Member | What it is |
|---|---|
private Coroutine gaugeAnimation | The running gauge coroutine. |
private float gaugeFadeAwayDuration | Seconds to fade the gauge out. Default 1.5. |
private float gaugeFillDuration | Seconds to fill the gauge. Default 0.8. |
private GaugeProgressBar gaugeProgress | The gauge progress bar. |
private static Logger logger | NLog logger for this class. |
private ServerSelectionMenu menuBoards | The server selection menu whose selection it watches. |
private ServerElementEvent oldElementDeselected | Event fired with the server that was deselected (or null). |
private ServerElementEvent selectionFinished | Event fired with the server once the gauge is full (or null). |
Methods
9 private and internal methods
| Member | What it is |
|---|---|
private IEnumerator AnimateGaugeAlpha(float startAlpha, float targetAlpha) (iterator) | Coroutine that fades the gauge alpha over gaugeFadeAwayDuration. |
private IEnumerator AnimateGaugeProgress(ServerElement selectedServer) (iterator) | Coroutine that fills the gauge over gaugeFillDuration, then finishes the selection. |
private void Deselect() | Deselects with no old element. Called on logout. |
private void NewServerElementSelected(ServerElement oldElement, ServerElement newElement) | Handles a selection change: deselects the old one, then starts the gauge or finishes with null. |
private void OnDestroy() | Unhooks from logout. |
private void OnSelectionFinished(ServerElement selectedServer) | Fires selectionFinished with the server. |
private void OnServerDeselected(ServerElement oldElement) | Fades the gauge out if there was an old element, and fires oldElementDeselected. |
private void OnServerDisplaySettled(ServerElement selectedServer) | Restarts the gauge fill for the newly selected server. |
private void Start() | Hooks logout and the menu's selection change. |