|
@@ -1,6 +1,7 @@
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using UnityEngine;
|
|
|
+using KairoEngine.Core;
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
|
|
namespace KairoEngine.Multiplayer
|
|
@@ -19,6 +20,7 @@ namespace KairoEngine.Multiplayer
|
|
|
[ReadOnly] public int clientCount;
|
|
|
[ReadOnly] public int maxClients;
|
|
|
[ReadOnly] public float uptime = 0;
|
|
|
+ [ReadOnly] public int tick = 0;
|
|
|
[ReadOnly] public string ipAddress;
|
|
|
[ReadOnly] public int packetsSent;
|
|
|
[ReadOnly] public int packetsReceived;
|
|
@@ -30,6 +32,7 @@ namespace KairoEngine.Multiplayer
|
|
|
NetMsgEvents.StartListening($"{server.eventStreamName}_ClientDisconnect", OnReceivePacket);
|
|
|
NetMsgEvents.StartListening($"{server.eventStreamName}_HandshakeReceived", OnReceivePacket);
|
|
|
NetMsgEvents.StartListening($"{server.eventStreamName}_AcceptingHandshake", OnSentPacket);
|
|
|
+ GenericEvents.StartListening($"{server.eventStreamName}_OnTick", OnTick);
|
|
|
}
|
|
|
|
|
|
private void OnDisable()
|
|
@@ -39,6 +42,7 @@ namespace KairoEngine.Multiplayer
|
|
|
NetMsgEvents.StopListening($"{server.eventStreamName}_ClientDisconnect", OnReceivePacket);
|
|
|
NetMsgEvents.StopListening($"{server.eventStreamName}_HandshakeReceived", OnReceivePacket);
|
|
|
NetMsgEvents.StopListening($"{server.eventStreamName}_AcceptingHandshake", OnSentPacket);
|
|
|
+ GenericEvents.StopListening($"{server.eventStreamName}_OnTick", OnTick);
|
|
|
}
|
|
|
|
|
|
private void Update()
|
|
@@ -67,5 +71,7 @@ namespace KairoEngine.Multiplayer
|
|
|
private void OnSentPacket(string text, int clientId, uint code, NetMsg netMsg) => packetsSent += 1;
|
|
|
|
|
|
private void OnReceivePacket(string text, int clientId, uint code, NetMsg netMsg) => packetsReceived += 1;
|
|
|
+
|
|
|
+ private void OnTick(int newTick) => tick = newTick;
|
|
|
}
|
|
|
}
|