public void SetUp() { IPAddress ipAddr = Dns.Resolve(Dns.GetHostName()).AddressList.First(); endPoint = new IPEndPoint(ipAddr, 10060); tcpClientA = new TcpClient(); tcpClientB = new TcpClient(); messenger = new SocketMessageTransmitter(); protocol = new Protocol(); }
//constructors public GameManager() { protocol = new Protocol(); gameList = new List<Game>(); eventRiser = new GameEventRiser(); eventRiser.MoveEvent += new GameEventRiser.Move(Move); eventRiser.ConfirmEvent += new GameEventRiser.Confirm(Confirm); eventRiser.RejectEvent += new GameEventRiser.Reject(Reject); eventRiser.ExitEvent += new GameEventRiser.Exit(Exit); }
//constructors public Server(Listener listener, ClientManager clientManager, GameManager gameManager) { this.listener = listener; this.clientManager = clientManager; this.gameManager = gameManager; messager = new SocketMessageTransmitter(); protocol = new Protocol(); notifier = new Notifier(protocol); loginEventRiser = new LoginEventRiser(); loginEventRiser.ConnectEvent += Connect; listener.NewConnection += NewConnection; clientManager.NewGame += NewGame; gameManager.GameOverEvent += GameOver; gameManager.FreeUserEvent += clientManager.AddClient; }
public Notifier(Protocol protocol) { this.protocol = protocol; }