public static void RemoveFunByPid(int pid, MsgReceive_De fun) { if (!msgPool.ContainsKey(pid)) { Debug.LogWarning("the pid " + pid + " you want to remove is not contain"); return; } if (!msgPool[pid].Contains(fun)) { Debug.LogWarning("the fun in pid " + pid + " you want to remove is not contain"); return; } msgPool[pid].Remove(fun); }
/// <summary> /// 注册协议对应函数 /// </summary> /// <param name="pid"></param> /// <param name="fun"></param> public static void Register(int pid, MsgReceive_De fun) { if (!msgPool.ContainsKey(pid)) { List <MsgReceive_De> list = new List <MsgReceive_De>(); list.Add(fun); msgPool.Add(pid, list); } else { if (msgPool[pid].Contains(fun)) { Debug.LogWarning(fun.ToString() + " is contain where pid is " + pid); } else { msgPool[pid].Add(fun); } } }