コード例 #1
0
 public void RegisterListener(Callback_1 <object> callback, int priority)
 {
     lock (handles)
     {
         NetMessageHandler handler = NetMessageHandler.New(callback, priority);
         handles.Add(handler);
         handles.Sort();
     }
 }
コード例 #2
0
        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();
                }
            }
        }