public void DispatchMessage() { while (true) { foreach (var item in _beginHome) { if (item._listSocket.Count == 0) { _beginHomeRemoveHelper.Add(item); continue; } ProtocolSCFrameNotify protocol = new ProtocolSCFrameNotify(); item._switchQueue.Push(protocol); item._switchQueue.Switch(); while (!item._switchQueue.Empty()) { protocol = item._switchQueue.pop(); protocol.data.NextFrame = item.nextFrame; protocol.data.CurrentFrame = item.currentFrame; foreach (var person in item._listSocket) { Program.Send(protocol, person); } } item.nextFrame++; item.currentFrame++; } foreach (var item in _beginHomeRemoveHelper) { _beginHome.Remove(item); } Thread.Sleep(33); } }
public void CSFrameMessage(Socket socket, CSFrameNotify data) { HomeMessage homeMessage = HomeLogicManager.Instance._personToHome[socket]; ProtocolSCFrameNotify protocol = new ProtocolSCFrameNotify(); protocol.data.Keys.Add(data); homeMessage._switchQueue.Push(protocol); }