public void On(string eventName, Action <string> callback) { if (SystemEventHelper.IsSystemEvent(eventName)) { Debug.LogErrorFormat("{0} is reserved as the system event and not allowed to use", eventName); return; } if (!_handlers.ContainsKey(eventName)) { _handlers.Add(eventName, callback); } else { _handlers[eventName] = callback; } }
public void Off(string eventName) { var @event = SystemEventHelper.FromString(eventName); if (@event != SystemEvents.Max) { Off(@event); } else { if (!_handlers.ContainsKey(eventName)) { Debug.LogErrorFormat("{0} is not assigned anywhere (Maybe mistyping eventName??)", eventName); } else { _handlers.Remove(eventName); } } }
public void On(string eventName, Action <Exception> callback) { On(SystemEventHelper.FromString(eventName), callback); }