Esempio n. 1
0
        private void OnDetectServer(DiscoveryResponse _response)
        {
            // Here we have recieved a server that is broadcasting on the network.
            if (!discoveredGames.ContainsKey(_response.endpoint.Address))
            {
                // We haven't already found a game with this IP, so make it.
                DiscoveredGame game = Instantiate(gameTemplate, foundGameHolder);
                game.gameObject.SetActive(true);

                // Setup the game using the response and add it to the list.
                game.Setup(_response, networkManager);
                discoveredGames.Add(_response.endpoint.Address, game);
            }
        }
        private void OnDetectServer(DiscoveryResponse _response)
        {
            //Here we have received a server that is broadcasting on teh network
            if (!discoveredGames.ContainsKey(_response.EndPoint.Address))
            {
                //We haven't already found a game with this IP, so make it
                DiscoveredGame game = Instantiate(gameTemplate, foundGamesHolder);
                game.gameObject.SetActive(true);

                //Setup the game using the response and add it to the list
                game.Setup(_response, networkManager);
                //game.Setup(_response.EndPoint.Address.ToString(), networkManager);
                discoveredGames.Add(_response.EndPoint.Address, game);
            }
            else
            {
                DiscoveredGame game = discoveredGames[_response.EndPoint.Address];
                if (game.Gamename != _response.gameName)
                {
                    game.UpdateResponse(_response);
                }
            }
        }