PlayerMessageDisplay
A class in Root.Township, the global namespace.
Client text shown in front of the player's view, such as login errors. Messages queue and fade in and out.
- Listed in Global namespace: P
- Inherits or implements
MonoBehaviour,IBuildRendererBakeable,IBuildBakeable
Constructors
| Member | What it is |
|---|---|
PlayerMessageDisplay() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
8 private and internal fields
| Member | What it is |
|---|---|
private TextRenderer androidOnScreenText | Android text renderer; not used by this code. |
private static Logger logger | NLog logger; logs each message shown. |
private AltaCoroutine messageDisplayCoroutine | The running queue coroutine. |
private List<DisplayMessage> messageQueue | Messages waiting; the first is the one shown. Capped at about 1000. |
private Text onScreenText | UI text that shows the message. |
private PlayerController playerController | The owning player controller. |
private Vector3 positionFromHead | Offset from the head; not used by this code. |
private Quaternion rotationFromHead | Rotation from the head; not used by this code. |
Properties
1 private and internal property
Methods
| Member | What it is |
|---|---|
void Bake(bool isSaving) | Empty build step. |
void Display(string message, float duration = 2, DisplayMessageType type = 2) | Shows a message. By default it replaces the current one; it can also queue or go next. |
void Display(DisplayMessage message, DisplayMessageType type = 2) | Shows a message. By default it replaces the current one; it can also queue or go next. |
6 private and internal methods
| Member | What it is |
|---|---|
private void IBuildRendererBakeable.Clean() | Empty. |
private IEnumerator DisplayMessageQueue() (iterator) | Coroutine: shows each queued message with its fade in, duration and fade out, then hides the text. |
private IEnumerator DisplayTextDelayedCoroutine(float time, string message, float textFadeOutDuration = 5) (iterator) | Coroutine: after a delay, shows text and fades it out. Nothing in this code starts it. |
private void OnDestroy() | Unhooks the login failure event. |
private void OnLoginAttemptFailed(string message) | Shows the failed login message in red. |
private void Start() | Hooks LoginManager.LoginAttemptFailed. |
Used in
Members of other types that take, return or hold a PlayerMessageDisplay: