示例#1
0
        private RelayConnectionType connectionType = RelayConnectionType.UDP; // Change this to try different connection type

        void FullFlow(RelayConnectionType in_connectionType)
        {
            successCount   = 0;
            isRunning      = true;
            connectionType = in_connectionType;

            _bc.Client.EnableLogging(true);
            _bc.RTTService.RegisterRTTLobbyCallback(onLobbyEvent);
            _bc.RTTService.EnableRTT(RTTConnectionType.WEBSOCKET, onRTTEnabled, onFailed);

            // Main event loop
            var timeStart = DateTime.Now;

            while (isRunning)
            {
                _bc.Update();
                Thread.Sleep(10);

                // We timeout after 5 minutes (give it time if the system is slow and no server is up)
                if ((DateTime.Now - timeStart).TotalSeconds > 5.0 * 60.0)
                {
                    break;
                }
            }

            Assert.True(successCount == 3); // Test result
        }
    public void FindLobby(RelayConnectionType protocol)
    {
        StateManager.Instance.protocol = protocol;

        GameManager.Instance.CurrentUserInfo.UserGameColor = Settings.GetPlayerPrefColor();

        // Enable RTT
        m_bcWrapper.RTTService.RegisterRTTLobbyCallback(OnLobbyEvent);
        m_bcWrapper.RTTService.EnableRTT(RTTConnectionType.WEBSOCKET, OnRTTConnected, OnRTTDisconnected);
    }
        private IEnumerator FullFlow(RelayConnectionType in_connectionType)
        {
            connectionType = in_connectionType;

            yield return(_tc.StartCoroutine(_tc.SetUpNewUser(Users.UserA)));

            _tc.bcWrapper.Client.EnableLogging(true);
            _tc.bcWrapper.RTTService.RegisterRTTLobbyCallback(OnLobbyEvent);
            _tc.bcWrapper.RTTService.EnableRTT(RTTConnectionType.WEBSOCKET, OnRTTEnabled, OnFailed);

            yield return(_tc.StartCoroutine(_tc.Run()));
        }
 /// <summary>
 /// Start off a connection, based off connection type to brainClouds Relay Servers.  Connect options come in from "ROOM_ASSIGNED" lobby callback
 /// </summary>
 /// <param name="in_connectionType"></param>
 /// <param name="in_options">
 ///             in_options["ssl"] = false;
 ///             in_options["host"] = "168.0.1.192";
 ///             in_options["port"] = 9000;
 ///             in_options["passcode"] = "somePasscode"
 ///             in_options["lobbyId"] = "55555:v5v:001";
 ///</param>
 /// <param name="in_success"></param>
 /// <param name="in_failure"></param>
 /// <param name="cb_object"></param>
 public void Connect(RelayConnectionType in_connectionType = RelayConnectionType.WEBSOCKET, Dictionary <string, object> in_options = null, SuccessCallback in_success = null, FailureCallback in_failure = null, object cb_object = null)
 {
     m_commsLayer.Connect(in_connectionType, in_options, in_success, in_failure, cb_object);
 }
示例#5
0
 /// <summary>
 /// Start off a connection, based off connection type to brainClouds Relay Servers.  Connect options come in from "ROOM_ASSIGNED" lobby callback
 /// </summary>
 /// <param name="in_connectionType"></param>
 /// <param name="in_options"></param>
 /// <param name="in_success"></param>
 /// <param name="in_failure"></param>
 /// <param name="cb_object"></param>
 public void Connect(RelayConnectionType in_connectionType, RelayConnectOptions in_options, SuccessCallback in_success = null, FailureCallback in_failure = null, object cb_object = null)
 {
     m_commsLayer.Connect(in_connectionType, in_options, in_success, in_failure, cb_object);
 }