ServerLink.Update C# (CSharp) Method

Update() public method

Log any messages received from server and handle special logic for commands received
public Update ( ) : void
return void
    void Update()
    {
        if (connector.message != Connector.RCV_JOIN_GGM)
        {
            // Check if the response has changed
            if (connector.res != lastMessage)
            {
                Debug.Log(connector.res);
                lastMessage = connector.res;

                // Check if command received is port
                if (connector.message.StartsWith(Connector.RCV_PORT))
                {
                    // Determine if a port was sent
                    int portNum;
                    if (int.TryParse(connector.res, out portNum))
                    {
                        // Try to join the game on the given port
                        Debug.Log("IP: " + gameManagerIP + " Port: " + portNum);
                        networkManager.JoinDirect(gameManagerIP, portNum);
                    }
                }
            }
        }
    }