Exemple #1
0
        private void UpdateLan()
        {
            net.PollEvents();

            for (int i = servers.Count - 1; i >= 0; i--)
            {
                LanServer server = servers[i];
                if (Multiplayer.Clock.ElapsedMilliseconds - server.lastUpdate > 5000)
                {
                    servers.RemoveAt(i);
                }
            }
        }
Exemple #2
0
        private void AddOrUpdate(IPEndPoint endpoint)
        {
            LanServer server = servers.Find(s => s.endpoint.Equals(endpoint));

            if (server == null)
            {
                servers.Add(new LanServer()
                {
                    endpoint   = endpoint,
                    lastUpdate = Multiplayer.Clock.ElapsedMilliseconds
                });
            }
            else
            {
                server.lastUpdate = Multiplayer.Clock.ElapsedMilliseconds;
            }
        }