private void ServerToClientEventReceived(ServerToClient.Data data) { if (ServerToClientCallbacks.ContainsKey(data.EventName)) { ServerToClientCallbacks[data.EventName].ForEach((action) => action?.Invoke(data.Sender, data.EventData)); } }
public void RegisterServerToClientCallback(string eventName, Action <NetworkPlayer, string> callback) { if (!ServerToClientCallbacks.ContainsKey(eventName)) { ServerToClientCallbacks.Add(eventName, new List <Action <NetworkPlayer, string> >()); } ServerToClientCallbacks[eventName].Add(callback); }