예제 #1
0
        public void InitBase(EventHandlerServiceInited initedCallback, EventHandlerServiceError errorCallback)
        {
            this._onInitCallback  = initedCallback;
            this._onErrorCallback = errorCallback;

            this._transactions      = new Dictionary <string, Transaction>();
            this._transactionsQueue = new Queue <string>();
        } // InitBase
예제 #2
0
        public string GetBytes(string url, EventHandlerHTTPBytes bytesCallback, EventHandlerServiceError onError = null, EventHandlerServiceTimeOut onTimeOut = null, int timeOut = 0)
        {
            HTTPRequest request = new HTTPRequest();
            request.url = url;
            request.transactionId = UCSS.GenerateTransactionId(Common.Md5Sum(url));
            request.bytesCallback = bytesCallback;
            request.onError = onError;
            request.onTimeOut = onTimeOut;
            request.timeOut = timeOut;

            StartCoroutine(RunGetDataCoroutine(request));

            return request.transactionId;
        }
예제 #3
0
        public string GetMovie(string url, EventHandlerMovieTexture movieCallback, EventHandlerServiceError onError = null, EventHandlerServiceTimeOut onTimeOut = null, int timeOut = 0)
        {
            HTTPRequest request = new HTTPRequest();

            request.url                  = url;
            request.transactionId        = UCSS.GenerateTransactionId(Common.Md5Sum(url));
            request.movieTextureCallback = movieCallback;
            request.onError              = onError;
            request.onTimeOut            = onTimeOut;
            request.timeOut              = timeOut;

            request.coroutineFactory = RunGetDataCoroutineFactory(request);
            request.coroutine        = StartCoroutine(request.coroutineFactory());
            return(request.transactionId);
        }
예제 #4
0
        public string PostForm(string url, WWWForm formData, EventHandlerHTTPBytes bytesCallback, EventHandlerServiceError onError = null, EventHandlerServiceTimeOut onTimeOut = null, int timeOut = 0)
        {
            HTTPRequest request = new HTTPRequest();

            request.url           = url;
            request.formData      = formData;
            request.transactionId = UCSS.GenerateTransactionId(Common.Md5Sum(url));
            request.bytesCallback = bytesCallback;
            request.onError       = onError;
            request.onTimeOut     = onTimeOut;
            request.timeOut       = timeOut;

            request.coroutineFactory = RunPostFormCoroutineFactory(request);
            request.coroutine        = StartCoroutine(request.coroutineFactory());
            return(request.transactionId);
        }
예제 #5
0
        public string PostBytes(string url, byte[] bytes, Dictionary <string, string> headers, EventHandlerHTTPString stringCallback, EventHandlerServiceError onError = null, EventHandlerServiceTimeOut onTimeOut = null, int timeOut = 0)
        {
            HTTPRequest request = new HTTPRequest();

            request.url            = url;
            request.bytes          = bytes;
            request.headers        = headers;
            request.transactionId  = UCSS.GenerateTransactionId(Common.Md5Sum(url));
            request.stringCallback = stringCallback;
            request.onError        = onError;
            request.onTimeOut      = onTimeOut;
            request.timeOut        = timeOut;

            request.coroutineFactory = RunPostBytesCoroutineFactory(request);
            request.coroutine        = StartCoroutine(request.coroutineFactory());
            return(request.transactionId);
        }
예제 #6
0
        public static void InitService(UCSSprotocols protocol, string serviceName, string host, EventHandlerServiceInited initedCallback = null, EventHandlerServiceError errorCallback = null)
        {
            if (string.IsNullOrEmpty(serviceName))
            {
                throw new System.ArgumentNullException("serviceName");
            }
            if (string.IsNullOrEmpty(host))
            {
                throw new System.ArgumentNullException("host");
            }

            if (UCSS.Instance._initedProtocols.Count > 0 && UCSS.Instance._initedProtocols.ContainsKey(serviceName))
            {
                throw new System.InvalidOperationException("serviceName [" + serviceName + "] already exists in CSS");
            }

            BaseProtocol selectedProtocol = null;

            switch (protocol)
            {
            case UCSSprotocols.amf:
                break;

            default:
                throw new System.InvalidOperationException("protocol [" + protocol + "] is NOT found in InitService");
            }
            if (selectedProtocol != null)
            {
                UCSS.Instance._initedProtocols.Add(serviceName, selectedProtocol);
            }
            //Debug.Log("CSS.Instance._initedProtocols = " + UCSS.Instance._initedProtocols.Count);
        } // InitService
예제 #7
0
 public static void InitService(UCSSprotocols protocol, UCSSservices serviceName, string host, EventHandlerServiceInited initedCallback = null, EventHandlerServiceError errorCallback = null)
 {
     UCSS.InitService(protocol, serviceName.ToString(), host, initedCallback, errorCallback);
 }
예제 #8
0
        public string PostForm(string url, WWWForm formData, EventHandlerHTTPString stringCallback, EventHandlerServiceError onError = null, EventHandlerServiceTimeOut onTimeOut = null, int timeOut = 0)
        {
            HTTPRequest request = new HTTPRequest();
            request.url = url;
            request.formData = formData;
            request.transactionId = UCSS.GenerateTransactionId(Common.Md5Sum(url));
            request.stringCallback = stringCallback;
            request.onError = onError;
            request.onTimeOut = onTimeOut;
            request.timeOut = timeOut;

            StartCoroutine(RunPostFormCoroutine(request));

            return request.transactionId;
        }
예제 #9
0
        public string PostBytes(string url, byte[] bytes, Hashtable headers, EventHandlerHTTPString stringCallback, EventHandlerServiceError onError = null, EventHandlerServiceTimeOut onTimeOut = null, int timeOut = 0)
        {
            HTTPRequest request = new HTTPRequest();
            request.url = url;
            request.bytes = bytes;
            request.headers = headers;
            request.transactionId = UCSS.GenerateTransactionId(Common.Md5Sum(url));
            request.stringCallback = stringCallback;
            request.onError = onError;
            request.onTimeOut = onTimeOut;
            request.timeOut = timeOut;

            StartCoroutine(RunPostBytesCoroutine(request));

            return request.transactionId;
        }
예제 #10
0
        public void InitBase(EventHandlerServiceInited initiedCallback, EventHandlerServiceError errorCallback)
        {
            this._onInitCallback = initiedCallback;
            this._onErrorCallback = errorCallback;

            this._transactions = new Dictionary<string, Transaction>();
            this._transactionsQueue = new Queue<string>();
        }
예제 #11
0
        public static void InitService(UCSSprotocols protocol, string serviceName, string host, EventHandlerServiceInited initedCallback = null, EventHandlerServiceError errorCallback = null)
        {
            if (string.IsNullOrEmpty(serviceName))
            {
                throw new System.ArgumentNullException("serviceName");
            }
            if (string.IsNullOrEmpty(host))
            {
                throw new System.ArgumentNullException("host");
            }

            if (UCSS.Instance._initedProtocols.Count > 0 && UCSS.Instance._initedProtocols.ContainsKey(serviceName))
            {
                throw new System.InvalidOperationException("serviceName [" + serviceName + "] already exists in CSS");
            }

            BaseProtocol selectedProtocol = null;
            switch (protocol)
            {
                case UCSSprotocols.amf:
                    break;
                default:
                    throw new System.InvalidOperationException("protocol [" + protocol + "] is NOT found in InitService");
            }
            if (selectedProtocol != null)
            {
                UCSS.Instance._initedProtocols.Add(serviceName, selectedProtocol);
            }
            //Debug.Log("CSS.Instance._initedProtocols = " + UCSS.Instance._initedProtocols.Count);
        }
예제 #12
0
 public static void InitService(UCSSprotocols protocol, UCSSservices serviceName, string host, EventHandlerServiceInited initedCallback = null, EventHandlerServiceError errorCallback = null)
 {
     UCSS.InitService(protocol, serviceName.ToString(), host, initedCallback, errorCallback);
 }