public override Task Run(UdpResult result, ConnectorsComponent connectors, UdpSender sender) { uint eid; connectors.dictionary.TryGetValue(result.endPoint, out eid); connectors.conTcs.SetResult(0); world.Get <Entity>(eid)?.RemoveComponent <ConTimeCounter>(); world.RemoveBehavior <TimeCount>(); return(Task.CompletedTask); }
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); } })); }
public override Task Run(UdpResult result, ConnectorsComponent connectors, UdpSender sender) { return(Task.Factory.StartNew(() => { uint eid; if (connectors.dictionary.TryGetValue(result.endPoint, out eid)) { ushort func = result.stream.GetUShort(); IPaylodable paylodable = MsgMaper.Get(func); if (paylodable == null) { return; } paylodable.GetFrom(result.stream); APDealer dealer = world.GetBehavior <APDealer>(MsgMaper.Get(paylodable.GetType().Name)); dealer?.Deal(eid, paylodable); ByteStream.Return(result.stream as ByteStream); } })); }
public abstract Task Run(UdpResult result, ConnectorsComponent connectors, UdpSender sender);