A class in Root.Township, Alta.Utilities.Profiling.
Client live data display showing the transport ping to the server and the game-level ping from PingMessage.
Constructors
| Member | What it is |
|---|
PingDisplay() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private const int DecimalPlaces | Constant 4, the rounding used in the output. |
private float gamePing | Last game ping from PingMessage.LastPingInSeconds. |
private const string GamePingTitle | Label for the game ping line. |
private bool? isLocalPlayer | Cached once from PlayerController.Current; pinging only runs when true. |
private float ping | Last transport ping result. |
Properties
| Member | What it is |
|---|
override string Output { get; } | Both ping lines. Both say ms, but the game ping comes from PingMessage.LastPingInSeconds. |
protected override string Title { get; } | "Ping". |
Methods
| Member | What it is |
|---|
override void InternalUpdate(LiveDataDisplayView coroutineRunner) | For the local player, pings the first socket connection and sends a Ping message to all, then reads the last game ping. |
protected override string GetData() | Returns null; Output is overridden instead. |
3 private and internal methods
| Member | What it is |
|---|
private string CustomOutput() | Formats both ping values to 4 decimal places. |
private void Ping(MonoBehaviour coroutineRunner) | Starts a ping coroutine on the first connection of the current socket. |
private void UpdatePing(float ping) | Callback that stores the transport ping result. |