コード例 #1
0
        /// <summary>
        /// Connects to
        ///     1. the IP address parameter, if one is passed in
        ///     2. the serialized input field's text, if no IP address is passed in and the input field exists
        ///     3. the remote host name in the remoting configuration, if no input field exists
        /// </summary>
        /// <param name="address">The (optional) address to connect to.</param>
        public void ConnectToRemote(string address = null)
        {
            m_appRemotingMode = AppRemotingMode.connect;
            if (!string.IsNullOrWhiteSpace(address))
            {
                remotingConfiguration.RemoteHostName = address;
            }
            else if (textInput != null)
            {
                remotingConfiguration.RemoteHostName = textInput.text;
            }

            if (string.IsNullOrWhiteSpace(remotingConfiguration.RemoteHostName))
            {
                Debug.LogWarning($"No IP address was provided to {nameof(Remoting.AppRemoting)}. Returning without connecting.");
                return;
            }

            StartCoroutine(Remoting.AppRemoting.Connect(remotingConfiguration));
        }
コード例 #2
0
 /// <summary>
 /// Listens to the incoming connections as specified in the remotinglistenconfiguration
 /// </summary>
 public void ListenToRemote()
 {
     m_appRemotingMode = AppRemotingMode.listen;
     StartCoroutine(Remoting.AppRemoting.Listen(remotingListenConfiguration, () => m_listenCompleted = true));
 }