static IEnumerator <object> HandleNewClients() { while (true) { IFuture f = Server.AcceptNewClient(); using (f) yield return(f); TelnetClient client = f.Result as TelnetClient; Player player = new Player(client, World.PlayerStartLocation); } }
private IEnumerator <object> ListenTask() { while (true) { var f = _Listener.AcceptIncomingConnection(); yield return(f); TcpClient tcpClient = f.Result as TcpClient; Console.WriteLine("Accepted connection from {0}.", tcpClient.Client.RemoteEndPoint); TelnetClient client = new TelnetClient(this, tcpClient); _Clients.Add(client); _NewClients.Enqueue(client); } }
public Player (TelnetClient client, Location location) : base(location, null) { Client = client; client.RegisterOnDispose(OnDisconnected); RebuildCommandTrie(); AddExitCommands(location); AddEventHandler(EventType.CombatHit, OnEventCombatHit); AddEventHandler(EventType.CombatMiss, OnEventCombatMiss); AddEventHandler(EventType.CombatStart, OnEventCombatStart); AddEventHandler(EventType.Death, OnEventDeath); AddEventHandler(EventType.Emote, OnEventEmote); AddEventHandler(EventType.Enter, OnEventEnter); AddEventHandler(EventType.Leave, OnEventLeave); AddEventHandler(EventType.Say, OnEventSay); AddEventHandler(EventType.Tell, OnEventTell); }
public Player(TelnetClient client, Location location) : base(location, null) { Client = client; client.RegisterOnDispose(OnDisconnected); RebuildCommandTrie(); AddExitCommands(location); AddEventHandler(EventType.CombatHit, OnEventCombatHit); AddEventHandler(EventType.CombatMiss, OnEventCombatMiss); AddEventHandler(EventType.CombatStart, OnEventCombatStart); AddEventHandler(EventType.Death, OnEventDeath); AddEventHandler(EventType.Emote, OnEventEmote); AddEventHandler(EventType.Enter, OnEventEnter); AddEventHandler(EventType.Leave, OnEventLeave); AddEventHandler(EventType.Say, OnEventSay); AddEventHandler(EventType.Tell, OnEventTell); }
private IEnumerator<object> ListenTask() { while (true) { var f = _Listener.AcceptIncomingConnection(); yield return f; TcpClient tcpClient = f.Result as TcpClient; Console.WriteLine("Accepted connection from {0}.", tcpClient.Client.RemoteEndPoint); TelnetClient client = new TelnetClient(this, tcpClient); _Clients.Add(client); _NewClients.Enqueue(client); } }