public void RegisterListener(Callback_1 <object> callback, int priority) { lock (handles) { NetMessageHandler handler = NetMessageHandler.New(callback, priority); handles.Add(handler); handles.Sort(); } }
public void RemoveListener(Callback_1 <object> callback) { int index = -1; lock (handles) { for (int i = 0; i < handles.Count; i++) { if (handles[i].EqualTo(callback)) { index = i; break; } } if (index >= 0) { NetMessageHandler handler = handles[index]; handles.RemoveAt(index); handler.Release(); } } }