コード例 #1
0
        /// <summary>
        /// Closes the connection and doesn't yield.
        /// </summary>
        /// <param name="stopCoroutines">If false, coroutines would not stop (used for stopping the game in the Unity editor)</param>
        public void CloseImmidiately(bool stopCoroutines = true)
        {
            if (Authorized && stopCoroutines)
            {
                if (_authorizationContext != null)
                {
                    EndAuthorizationContext();
                }

                if (_processBulkRequestCoroutine != null)
                {
                    CoroutineManager.StopCoroutine(_processBulkRequestCoroutine);
                }

                if (_trackContextDataCoroutine != null)
                {
                    CoroutineManager.StopCoroutine(_trackContextDataCoroutine);
                }

                // Unsubscribe from events
                JsonRpcClient.OnLostConnection -= OnLostConnection;
                JsonRpcClient.OnReconnected    -= OnReconnected;
            }

            JsonRpcClient.CloseImmidiately();
        }