public override Task Run(UdpResult result, ConnectorsComponent connectors, UdpSender sender) { return(Task.Factory.StartNew(() => { uint eid; if (connectors.dictionary.TryGetValue(result.endPoint, out eid)) { world.RemoveEntity(eid); connectors.dictionary.Remove(result.endPoint); sender.Send(result.endPoint, ConDefine.disconnected); } })); }
public override Task Run(UdpResult result, ConnectorsComponent connectors, UdpSender sender) { return(Task.Factory.StartNew(() => { if (!connectors.dictionary.ContainsKey(result.endPoint)) { Entity e = world.Add <Entity>(); e.AddComponent <EndPointComponent>().remote = result.endPoint; connectors.dictionary.Add(result.endPoint, e.id); System.Console.WriteLine($"Accept::Run::ID={e.id}"); sender.Send(result.endPoint, ConDefine.connected); } })); }