Make PingList work again

This commit is contained in:
Sofia 2020-08-08 20:45:59 +03:00
parent 717f558a9e
commit 5ad92d9a9e
2 changed files with 8 additions and 4 deletions

View File

@ -14,7 +14,7 @@ namespace NeonTea.Quakeball.Networking.Instances {
private Connection Server;
private Dictionary<ulong, NetPlayer> Players = new Dictionary<ulong, NetPlayer>();
public Dictionary<ulong, NetPlayer> Players { get; private set; } = new Dictionary<ulong, NetPlayer>();
private bool SelfIdentified = false;
public float Ping { get; private set; }
@ -143,6 +143,7 @@ namespace NeonTea.Quakeball.Networking.Instances {
} else {
Ping = Instances.Server.PingInterval + 0.001f;
}
LocalPlayer.Ping = Ping;
UpdatePingBias();
}
} else if (packet is PingListPckt) {

View File

@ -92,13 +92,16 @@ namespace NeonTea.Quakeball.Networking {
return false;
}
if (Net.Singleton.Instance is Client) {
int ping = (int)(((Client)Net.Singleton.Instance).Ping * 1000);
Terminal.Println($"Ping: {ping}ms");
Client c = (Client)Net.Singleton.Instance;
foreach (NetPlayer p in c.Players.Values) {
int ping = (int)(p.Ping * 1000);
Terminal.Println($"{p.Nick}: {ping}ms");
}
} else if (Net.Singleton.Instance is Server) {
Server s = (Server)Net.Singleton.Instance;
foreach (NetPlayer p in s.PlayerList) {
int ping = (int)(p.Ping * 1000);
Terminal.Println($"Ping for {p.Id}: {ping}ms");
Terminal.Println($"{p.Nick}: {ping}ms");
}
}
return true;