// Faz a conexão como servidor private void ConectarComoServidor(string ip, int port) { gs = new GerenciadorSocket(ip, port); if (gs.IniciarComoServidor(ref status)) { ComecarJogo(); } }
// Faz a conexão como cliente private void ConectarComoCliente(string ip, int port) { gs = new GerenciadorSocket(ip, port); if (gs.IniciarComoCliente()) { ComecarJogo(); } }
public FormJogo(FormPrincipal principal, bool ehServidor, GerenciadorSocket gs) { // O servidor sempre começa o jogo this.ehMeuTurno = ehServidor; this.Principal = principal; this.ehServidor = ehServidor; InitializeComponent(); if (ehServidor) { this.Text = "Jogo da Velha | Servidor"; this.SetDesktopLocation(250, 200); } else { this.Text = "Jogo da Velha | Cliente"; this.SetDesktopLocation(700, 200); } this.gs = gs; }