コード例 #1
0
        public LobbyManager(Game game)
        {
            var localIp = game.Configuration.LanIpAddress;

            if (localIp == IPAddress.Any)
            {
                var selfAdresses = Dns.GetHostAddresses(Dns.GetHostName());
                localIp = selfAdresses.FirstOrDefault(x => x.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork);
            }

            Unicast = GetLocalAdapter(localIp);

            LobbyBroadcastSession = new LobbyBroadcastSession(this);
            LobbyScanSession      = new LobbyScanSession(this);

            Players  = new Dictionary <IPEndPoint, LobbyPlayer>();
            Username = Environment.MachineName;
            Hosting  = false;
            Updated  = true;
        }
コード例 #2
0
 public void Stop()
 {
     LobbyBroadcastSession.Stop();
     LobbyScanSession.Stop();
 }
コード例 #3
0
 public void Start()
 {
     Hosting = false;
     LobbyBroadcastSession.Start();
     LobbyScanSession.Start();
 }