Esempio 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));
     }
 }
Esempio 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);
        }