public void OnReceivedSubscribe(MessageType type, ServerOnMessageReceivedDelegate callback) { if (onMessageReceivedDelegates.ContainsKey(type)) { onMessageReceivedDelegates[type] += callback; } else if (SHOW_LOGS) { string msgType = Enum.GetName(typeof(MessageType), type); string logMsg = String.Format("No delegate found for onReceived MessageType.{0}", msgType); Debug.Log(logMsg); } }
protected void AddMessageDelegate(MessageType type, ServerOnMessageReceivedDelegate handler) { if (onMessageReceivedDelegates.ContainsKey(type) == false) { onMessageReceivedDelegates.Add(type, handler); } else if (SHOW_LOGS) { string msgType = Enum.GetName(typeof(MessageType), type); string logMsg = String.Format("OnReceivedHandler already registered for this message : {0}", msgType); Debug.LogError(logMsg); } }