/// <summary> /// 移除绑定 /// </summary> /// <param name="route"></param> public void RemoveBindSouce(string route, DelegateBindSource del) { DelegateBindSource _del; if (bindSourceDictionary.TryGetValue(route, out _del)) { _del -= del; bindSourceDictionary[route] = _del; } }
/// <summary> /// 这里原则上是绑定 客户端主动请求的消息 /// 临时接口 后面需要统一 /// </summary> /// <param name="route"></param> /// <param name="action"></param> /// <typeparam name="T"></typeparam> public void BindSource(string route, DelegateBindSource del) { DelegateBindSource _del; if (bindSourceDictionary.ContainsKey(route) == false) { bindSourceDictionary[route] = (string s) => { Debug.Log("执行回调:" + route); }; } bindSourceDictionary[route] += del; }