private void OnUpdate_HandlePackage() { for (int i = 0, count = mRecvBuffer.Count; i < count; i++) { KeyValuePair <int, byte[]> one = mRecvBuffer[i]; if (_event != null) { _event.Dispatch((uint)one.Key, one.Value); } mRecvBuffer.Remove(one); count--; i--; } }
void IGameServiceUpdate.OnUpdate() { lock (mBufferLock) { if (_event != null) { Dictionary <string, byte[]> .Enumerator ie = mBuffer.GetEnumerator(); while (ie.MoveNext()) { KeyValuePair <string, byte[]> pair = ie.Current; uint msg_type = ParseBufferKey(pair.Key); _event.Dispatch(msg_type, pair.Value); } mBuffer.Clear(); } } }