コード例 #1
0
    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;
            }
        }
    }
コード例 #2
0
    public void RefreshServerList()
    {
        CheckForManagers();

        ClearServerList();

        NetworkDiscovery.StartDiscovery();
    }
コード例 #3
0
    //TODO: Always search for active servers (Update, coroutine) while in menu scene
    public void FindServers()
    {
        //Find available servers
        networkDiscovery.StartDiscovery(); //search for more servers
        Debug.Log("Discovered Servers: " + discoveredServers.Count);

        CheckRooms();
    }
コード例 #4
0
 //Buscar Partida********************************************
 public void Discovery()
 {
     BotonBuscar.SetActive(false);
     TextoBuscando.SetActive(true);
     discoveredServers.Clear();
     networkDiscovery.StartDiscovery();
     StartCoroutine(BuscarServidores());
 }
コード例 #5
0
 void Discovery()
 {
     networkDiscovery.StartDiscovery();
     print(networkDiscoveryHUD.discoveredServers.Count);
     foreach (ServerResponse info in networkDiscoveryHUD.discoveredServers.Values)
     {
         if (networkDiscoveryHUD.discoveredServers.Count > 0)
         {
             jionBtnText.color = Color.red;
             jionBtnText.text  = info.EndPoint.Address.ToString();
         }
         print(info.EndPoint.Address.ToString());
         serverResponse = info;
     }
 }
コード例 #6
0
    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();
    }
コード例 #7
0
        // -------------------------------------------

        /*
         * Start
         */
        public override void Start()
        {
            base.Start();

            if (m_networkDiscovery == null)
            {
                m_networkDiscovery = GetComponent <NetworkDiscovery>();
                m_networkDiscovery.OnServerFound.AddListener(OnDiscoveredServer);
            }

            m_discovering = true;
            m_networkDiscovery.StartDiscovery();

            BasicSystemEventController.Instance.BasicSystemEvent += new BasicSystemEventHandler(OnBasicSystemEvent);

            BasicSystemEventController.Instance.DelayBasicSystemEvent(EVENT_MIRRORDISCOVERYCONTROLLER_TIMEOUT_DISCOVERY, 5);

            Debug.LogError("%%%%%%%%%% MirrorDiscoveryController::START SEARCHING FOR A SERVER...");
        }
コード例 #8
0
ファイル: NetworkSystem.cs プロジェクト: songying/mrpp
 public void listening()
 {
     discoveredServers.Clear();
     _discovery.StartDiscovery();
 }
コード例 #9
0
ファイル: LobbyMenu.cs プロジェクト: jorgelosada10/TanksLAN
 public void StartDiscovery()
 {
     discoveredServers.Clear();
     networkDiscovery.StartDiscovery();
 }
コード例 #10
0
 public void FindServers()
 {
     networkDiscovery.StartDiscovery();
 }
コード例 #11
0
 public void OnFindServers()
 {
     discoveredServers.Clear();
     networkDiscovery.StartDiscovery();
     StartCoroutine(PopulateUIWithServerInfo());
 }