Esempio n. 1
0
        public virtual bool ProcessError(EB.Sparx.Response response, EB.Sparx.eResponseCode errCode)
        {
            if (ErrorHandler != null)
            {
                var dels = ErrorHandler.GetInvocationList();
                foreach (var del in dels)
                {
                    var func = del as System.Func <EB.Sparx.Response, EB.Sparx.eResponseCode, bool>;
                    if (func(response, errCode))
                    {
                        EB.Debug.Log("SparxAPI.ProcessError: process error {0} success", errCode);
                        return(true);
                    }
                }
            }

            if (GlobalErrorHandler != null)
            {
                var dels = GlobalErrorHandler.GetInvocationList();
                foreach (var del in dels)
                {
                    var func = del as System.Func <EB.Sparx.Response, EB.Sparx.eResponseCode, bool>;
                    if (func(response, errCode))
                    {
                        EB.Debug.Log("SparxAPI.ProcessError: process error {0} success", errCode);
                        return(true);
                    }
                }
            }

            EB.Debug.LogError("SparxAPI.ProcessError: request {0} failed, {1}:{2}", response.request.uri, errCode, response.error);

            return(false);
        }
Esempio n. 2
0
        //API---------------------------------
        /// <summary>
        /// 获取委托列表最大返回值,为空则返回0
        /// </summary>
        private static float GetMaxReturn(System.Func <float> func)
        {
            if (func == null)
            {
                return(0);
            }
            System.Delegate[] list = func.GetInvocationList();
            float             max  = 0;

            foreach (System.Delegate d in list)
            {
                System.Func <float> f = d as System.Func <float>;
                float temp            = f();
                if (temp > max)
                {
                    max = temp;
                }
            }

            return(max);
        }