예제 #1
0
        //http文本读取成功
        private void OnHttpReadTextSuccess(object sender, IEventArgs e)
        {
            HttpReadTextSuccessEventArgs ne = (HttpReadTextSuccessEventArgs)e;

            if (ne != null)
            {
                _remoteVersion = JsonUtility.FromJson <AssetBundleVersionInfo>(ne.Content);
                if (_remoteVersion == null)
                {
                    Debug.LogError("Remote Version is null");
                    return;
                }

                //如果资源版本不一样 则更新资源
                if (!CompareVersion())
                {
                    //更新资源
                    UpdateResource();
                    //下载资源
                    DownloadResource();
                }

                //资源更新完成
                _resourceUpdateDone = true;
            }
        }
예제 #2
0
 public WebRequestManager()
 {
     _event = GameFrameworkMode.GetModule <EventManager>();
     _httpReadTextSuccess = new HttpReadTextSuccessEventArgs();
     _httpReadTextFaile   = new HttpReadTextFaileEventArgs();
     _downloadSuccess     = new DownloadSuccessEventArgs();
     _downloadFaile       = new DownloadFaileEventArgs();
     _downloadProgress    = new DownloadProgressEventArgs();
 }
예제 #3
0
        //http文本读取成功
        private void OnHttpReadTextSuccess(object sender, IEventArgs e)
        {
            HttpReadTextSuccessEventArgs ne = (HttpReadTextSuccessEventArgs)e;

            if (ne != null)
            {
                if (ne.Url == Path.Combine(GameMode.Resource.ResUpdatePath, _assetPlatformVersionText))
                {
                    PlatformVersionInfo assetPlatform = JsonUtility.FromJson <PlatformVersionInfo>(ne.Content);
                    string platformName = GetPlatformName();
                    if (assetPlatform.Platforms.Contains(platformName))
                    {
                        //更新远程资源的路径
                        GameMode.Resource.ResUpdatePath =
                            Path.Combine(GameMode.Resource.ResUpdatePath, platformName);
                        //读取远程的文本
                        string remotePath = Path.Combine(GameMode.Resource.ResUpdatePath, _assetVersionTxt);
                        GameMode.WebRequest.ReadHttpText(remotePath);
                    }
                }
                else
                {
                    _remoteVersion = JsonUtility.FromJson <AssetBundleVersionInfo>(ne.Content);
                    if (_remoteVersion == null)
                    {
                        Debug.LogError("Remote Version is null");
                        return;
                    }

                    //如果资源版本不一样 则更新资源
                    if (!CompareVersion())
                    {
                        //更新资源
                        UpdateResource();
                        //下载资源
                        DownloadResource();
                    }

                    //资源更新完成
                    _resourceUpdateDone = true;
                }
            }
        }