Пример #1
0
        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();
            }
        }
Пример #2
0
        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();
        }
Пример #3
0
        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();
            }
        }
Пример #4
0
 public void SetSimulator(SoccerSimulator sim)
 {
     m_simulator = sim;
 }