Example #1
0
        private void PreloadResponse(string responseInfoStr)
        {
            GPlaySDK.LogFormat("GPlaySDKProxy.PreloadResponse", "responseInfoStr: {0}", responseInfoStr);
            PreloadResponseInfo responseInfo = ParsePreloadResponseInfo(responseInfoStr);

            if (responseInfo != null)
            {
                GPlaySDK.PreloadResponse(responseInfo);
            }
        }
Example #2
0
        private PreloadResponseInfo ParsePreloadResponseInfo(string responseInfoStr)
        {
            GPlaySDK.LogFormat("GPlaySDKProxy.ParsePreloadResponseInfo", "responseInfoStr: {0}", responseInfoStr);
            Regex regex = new Regex(@"\{""resultCode"":(?<resultCode>[+\-\d]+), ""errorCode"":(?<errorCode>[+\-\d]+), ""groupName"":(?<groupName>[\s\S]*), ""percent"":(?<percent>[+\-\.\d]+), ""downloadSpeed"":(?<downloadSpeed>[+\-\.\d]+)\}");

            Match match        = regex.Match(responseInfoStr);
            var   responseInfo = new PreloadResponseInfo();

            responseInfo.resultCode    = (EActionResultCode)int.Parse(match.Groups["resultCode"].Value);
            responseInfo.errorCode     = (EActionResultCode)int.Parse(match.Groups["errorCode"].Value);
            responseInfo.groupName     = match.Groups["groupName"].Value;
            responseInfo.percent       = float.Parse(match.Groups["percent"].Value);
            responseInfo.downloadSpeed = float.Parse(match.Groups["downloadSpeed"].Value);

            return(responseInfo);
        }
Example #3
0
        internal static void PreloadResponse(PreloadResponseInfo responseInfo)
        {
            if (responseInfo == null)
            {
                return;
            }

            if (preloadResponseCallback != null)
            {
                preloadResponseCallback(responseInfo);
            }

            if (responseInfo.resultCode == EActionResultCode.PRELOAD_RESULT_SUCCESS && preloadSuccessCallback != null)
            {
                preloadSuccessCallback();
            }
        }