StopServer() public method

Stops the server that the manager is using.

public StopServer ( ) : void
return void
コード例 #1
0
 void Update()
 {
     if (!showGUI)
     {
         return;
     }
     if (!manager.IsClientConnected() && !NetworkServer.active && manager.matchMaker == null)
     {
         if (UnityEngine.Application.platform != RuntimePlatform.WebGLPlayer)
         {
             if (Input.GetKeyDown(KeyCode.S))
             {
                 destroyStuff();
                 manager.StartServer();
             }
             if (Input.GetKeyDown(KeyCode.H))
             {
                 destroyStuff();
                 manager.StartHost();
             }
         }
         if (Input.GetKeyDown(KeyCode.C))
         {
             destroyStuff();
             manager.StartClient();
         }
     }
     if (NetworkServer.active)
     {
         if (manager.IsClientConnected())
         {
             if (Input.GetKeyDown(KeyCode.X))
             {
                 manager.StopHost();
             }
         }
         else
         {
             if (Input.GetKeyDown(KeyCode.X))
             {
                 manager.StopServer();
             }
         }
     }
 }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     if (UnityEngine.Networking.NetworkServer.active)
     {
         if (leaveMatch())
         {
             if (manager.IsClientConnected())
             {
                 manager.StopHost();
             }
             else
             {
                 manager.StopServer();
             }
             ShowMenu(activeGroup);
         }
     }
 }