public void DispatchCmdEvent(Command cmd) { try { if (_cmd.ContainsKey(cmd.Cmd)) { EventListenerCmd listener = _cmd[cmd.Cmd]; if (listener.Enable) { EventCmd e = new EventCmd(_ctx, cmd.Cmd, cmd.Orgin, cmd.Msg); listener.Handler(e); } } else { //throw new KeyNotFoundException(string.Format("custom not contains {0}", cmd.Cmd)); } } catch (Exception ex) { UnityEngine.Debug.LogException(ex); } }
public void AddCmdEventListener(EventListenerCmd listener) { uint cmd = listener.Cmd; _cmd[cmd] = listener; }