public Player(GameClient client) { Game = client.Game; Type = (int)PlayerType.Undefined; State = PlayerState.None; m_client = client; TurnSkip = 0; }
public void Disconnect() { if(m_client==null){ return; } m_client.Close(); m_client = null; }
public void RemoveClient(GameClient client) { m_clients.Remove(client); }
public void AddClient(GameClient client) { m_clients.Add(client); }
private void AcceptClient(){ while(IsListening){ GameClient client=null; try{ TcpClient tcpClient=m_listener.AcceptTcpClient(); client=new GameClient(tcpClient); }catch(Exception){ client=null; } m_mutexClients.WaitOne(); m_clients.Add(client); m_mutexClients.ReleaseMutex(); Thread.Sleep(1); } }