Wire up the event handlers

This commit is contained in:
derek committed 2026-07-03 11:37:41 -07:00
1 parent a04516c470
commit a689f2656f
11 files changed
+90 -76

No files matched your search

@@ -3,21 +3,37 @@
namespace Mistox.Client {
public class MistoxServerClient {
public string ServerName { get; set; } = ""; // The Name of the server
public bool Alive { get; set; } = true; // Is the server running
public int Port { get; set; } = 9126; // What Port to bind on
public event EventHandler onUserConnected;
public event Action onServerConnected;
public void InvokeOnServerConnected(){
Alive = true;
onServerConnected?.Invoke();
}
public event Action<UDPEndpoint> onUserConnected;
public void InvokeOnUserConnected(UDPEndpoint ConnectedUser){
onUserConnected?.Invoke(ConnectedUser, new EventArgs());
onUserConnected?.Invoke(ConnectedUser);
}
public event EventHandler onReceived;
public event Action<dynamic> onDataReceived;
public void InvokeOnReceived(dynamic DataPacket){
onReceived?.Invoke(DataPacket, new EventArgs());
onDataReceived?.Invoke(DataPacket);
}
public event EventHandler onUserDisconnected;
public event Action<UDPEndpoint> onUserDisconnected;
public void InvokeOnUserDisconnected(UDPEndpoint DisconnectedUser){
onUserDisconnected?.Invoke(DisconnectedUser, new EventArgs());
onUserDisconnected?.Invoke(DisconnectedUser);
}
public event Action onServerDisconnected;
public void InvokeOnServerDisconnected(){
Alive = false;
onServerDisconnected?.Invoke();
}
}