public void BindToSimulator(SoccerSimulator sim) { var act = new Action(() => { m_simulator = sim; this.soccerField.SetSimulator(sim); m_simulator.Changed += new EventHandler(m_simulator_Changed); m_simulator.ScoreChanged += new EventHandler(m_simulator_ScoreChanged); m_isBound = true; //this.soccerField.BindToSimulator(sim); //m_simulator_ScoreChanged(this, new EventArgs()); ForceUpdateMonitor(); EnableTimer(); } ); if (this.InvokeRequired) { this.Invoke(act); } else { act.Invoke(); } }
public Server(SoccerSimulator sim, int port) { this.m_simulator = sim; m_connectedClients = new ClientInfo[Settings.Default.MaxPlayers * 2]; m_listener = new TcpListener(IPAddress.Parse("127.0.0.1"), Settings.Default.PortNumber); m_listener.Start(); }
public void UnbindFromSimulator(SoccerSimulator sim) { var act = new Action(() => { m_isBound = false; DisableTimer(); this.soccerField.SetSimulator(null); m_simulator.Changed -= new EventHandler(m_simulator_Changed); m_simulator.ScoreChanged -= new EventHandler(m_simulator_ScoreChanged); } ); if (this.InvokeRequired) { this.Invoke(act); } else { act.Invoke(); } }
public void SetSimulator(SoccerSimulator sim) { m_simulator = sim; }