//Iniciar Servidor****************************************** public void RunServer() { if (!NetworkClient.isConnected && !NetworkServer.active) { if (!NetworkClient.active) { manager.StartServer(); networkDiscovery.AdvertiseServer(); } } AddressData(); }
public void RunServer() { if (!NetworkClient.isConnected && !NetworkServer.active) { if (!NetworkClient.active) { discoveredServers.Clear(); m_TanksNetwork.StartServer(); networkDiscovery.AdvertiseServer(); } } AddressData(); }
public void StartServer() { if (NetworkClient.isConnected == false && NetworkServer.active == false && NetworkClient.active == false) { ReinitializeDiscovery(); NetworkManager.singleton.StartServer(); networkDiscovery.AdvertiseServer(); } else { LogConsoleWarning("Trying to start a new server but this client is already connected"); } }
void DrawGUI() { GUILayout.BeginHorizontal(); var options = new GUILayoutOption[] { GUILayout.Height(80), GUILayout.Width(120) }; if (GUILayout.Button("Find Servers", options)) { discoveredServers.Clear(); networkDiscovery.StartDiscovery(); } // LAN Host if (GUILayout.Button("Start Host", options)) { discoveredServers.Clear(); NetworkManager.singleton.StartHost(); networkDiscovery.AdvertiseServer(); } // Dedicated server if (GUILayout.Button("Start Server", options)) { discoveredServers.Clear(); NetworkManager.singleton.StartServer(); networkDiscovery.AdvertiseServer(); } GUILayout.EndHorizontal(); // show list of found server GUILayout.Label($"Discovered Servers [{discoveredServers.Count}]:"); // servers scrollViewPos = GUILayout.BeginScrollView(scrollViewPos); foreach (ServerResponse info in discoveredServers.Values) { if (GUILayout.Button(info.EndPoint.Address.ToString(), options)) { Connect(info); } } GUILayout.EndScrollView(); }
void Start() { searchPanel.SetActive(false); gameConfiguration = FindObjectOfType <GameConfiguration>(); searchGlass = FindObjectOfType <SearchGlass>(); StartCoroutine(HidePanel()); IEnumerator HidePanel() { yield return(new WaitForSeconds(1f)); switch (gameConfiguration.role) { case 0: NetworkManager.singleton.StartHost(); networkDiscovery.AdvertiseServer(); loadingPanel.SetActive(false); break; case 1: searchPanel.SetActive(true); loadingPanel.SetActive(false); networkDiscovery.StartDiscovery(); StartCoroutine(UpdateAndAttemptConnection()); break; } } }
public void StartHost() { discoveredServers.Clear(); NetworkManager.singleton.StartHost(); networkDiscovery.AdvertiseServer(); isPlaying = true; GameManager.Instance.LoadScene(GameManager.sceneName, false); }
//When start host button is clicked public void StartHost() { discoveredServers.Clear(); //clear existing servers Debug.Log("Starting as host..."); NetworkManager.singleton.StartHost(); //start a new network manager host networkDiscovery.AdvertiseServer(); //advertises this new host in the list Debug.Log("Host server advertised"); Debug.Log("Show lobby"); }
void Start() { if (OnStartAction == OnStartPlayAction.CREATE_AND_JOIN) { gameNetwork.StartHost(); networkDiscovery.AdvertiseServer(); } else if (OnStartAction == OnStartPlayAction.ONLY_JOIN) { gameNetwork.StartClient(); } }
// ------------------------------------------- /* * OnBasicSystemEvent */ private void OnBasicSystemEvent(string _nameEvent, object[] _list) { if (_nameEvent == EVENT_MIRRORDISCOVERYCONTROLLER_TIMEOUT_DISCOVERY) { if (m_discovering) { m_discovering = false; m_networkDiscovery.StopDiscovery(); CommunicationsController.Instance.IsServer = true; StartHost(); m_networkDiscovery.AdvertiseServer(); NetworkEventController.Instance.DispatchLocalEvent(NetworkEventController.EVENT_COMMUNICATIONSCONTROLLER_REGISTER_ALL_NETWORK_PREFABS); BasicSystemEventController.Instance.DispatchBasicSystemEvent(CommunicationsController.EVENT_COMMSCONTROLLER_SET_UP_IS_SERVER); Debug.LogError("%%%%%%%%%% MirrorDiscoveryController::STARTED AS A SERVER (MIRROR)."); } } }
public void startHost() { discoveredServers.Clear(); _manager.StartHost(); _discovery.AdvertiseServer(); }
public void AdvertiseServers() { discoveredServers.Clear(); networkDiscovery.AdvertiseServer(); }