Пример #1
0
    public void StartServer()
    {
        //Determine if we should use network address translation
        //Essentially, YES if server is behind a router
        //             NO is server has a public IP
        if (lanOnly == true)
        {
            useNAT = false;
        }
        else
        {
            useNAT = !Network.HavePublicAddress();
        }

        //Start a simple server and add it to the master server list.
        //This will allow other players to locate it.
        NetworkConnectionError state = Network.InitializeServer(playerCount, serverPort, useNAT);

        if (state == NetworkConnectionError.NoError)
        {
            MasterServerUtils.RegisterWithMasterServer("Unity CCG Master", "This is a comment about TestServer");
        }
        else
        {
            Log("Server: Couldn't initalize server! " + state);
        }
    }
Пример #2
0
    public void StartServer()
    {
        NetworkConnectionError state = Network.InitializeServer(playerCount, serverPort, useNAT);

        if (state == NetworkConnectionError.NoError)
        {
            MasterServerUtils.RegisterWithMasterServer("Testing test game", "Heres an obligatory comment");
            serverStarted = true;
        }
        else
        {
            Debug.Log("server failed to initalize -> " + state);
        }
    }
Пример #3
0
 public void StartServer()
 {
     if (!serverStarted)
     {
         NetworkConnectionError state = Network.InitializeServer(playerCount, serverPort, useNAT);
         if (state == NetworkConnectionError.NoError)
         {
             MasterServerUtils.RegisterWithMasterServer("Unity UI CCG", "This is a comment about TestServer");
             serverStarted = true;
         }
         else
         {
             Debug.Log("Couldn't initialize server! " + state);
         }
     }
 }