Get CLI to a base state

This commit is contained in:
derek.holloway committed 2026-08-07 13:20:32 -07:00
1 parent 068c88de4b
commit c8a0aef289
2 files changed
+28 -13

No files matched your search

+16 -11
View File
@@ -6,6 +6,7 @@ using System.Net.Sockets;
using System.Numerics;
using System.Threading;
using System.Threading.Tasks;
using MessagePack.Formatters;
using Mistox.ResevedPackets;
namespace Mistox.Client {
@@ -95,13 +96,17 @@ namespace Mistox.Client {
if (!clientConnections.ContainsKey(remoteHost)) {
mUDPClient newConnection = new mUDPClient(this, remoteHost);
clientConnections[remoteHost] = newConnection;
InvokeOnUserJoined(newConnection);
}
}
// Remove users that left
foreach (IPEndPoint key in clientConnections.Keys) {
if (!activeIps.Contains(key.Address)) {
clientConnections.TryRemove(key, out _);
mUDPClient? user;
clientConnections.TryRemove(key, out user);
if (user == null) return;
InvokeOnUserLeft(user);
}
}
@@ -155,15 +160,15 @@ namespace Mistox.Client {
}
// When any user connects to the server (self) hasn't seen yet
public event Action<string> onUserJoined;
public void InvokeOnUserJoined(string UserName){
onUserJoined?.Invoke(UserName);
public event Action<mUDPClient> onUserJoined;
public void InvokeOnUserJoined(mUDPClient User){
onUserJoined?.Invoke(User);
}
// When user is within range of (self) and network rendering starts
public event Action<mUDPClient> onUserConnected;
public void InvokeOnUserConnected(mUDPClient ConnectedUser){
onUserConnected?.Invoke(ConnectedUser);
public void InvokeOnUserConnected(mUDPClient User){
onUserConnected?.Invoke(User);
}
// When generic data is received
@@ -189,14 +194,14 @@ namespace Mistox.Client {
// When user is no longer in range of (self) and network rendering stops
public event Action<mUDPClient> onUserDisconnected;
public void InvokeOnUserDisconnected(mUDPClient DisconnectedUser){
onUserDisconnected?.Invoke(DisconnectedUser);
public void InvokeOnUserDisconnected(mUDPClient User){
onUserDisconnected?.Invoke(User);
}
// When any user disconnects from the server that isn't (self)
public event Action<string> onUserLeft;
public void InvokeOnUserLeft(string UserName){
onUserLeft?.Invoke(UserName);
public event Action<mUDPClient> onUserLeft;
public void InvokeOnUserLeft(mUDPClient User){
onUserLeft?.Invoke(User);
}
// When (self) disconnects to the server