Ejemplo n.º 1
0
 private void ServerToClientEventReceived(ServerToClient.Data data)
 {
     if (ServerToClientCallbacks.ContainsKey(data.EventName))
     {
         ServerToClientCallbacks[data.EventName].ForEach((action) => action?.Invoke(data.Sender, data.EventData));
     }
 }
Ejemplo n.º 2
0
        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);
        }