Example #1
0
        private void _SetupHotUpdateDownloaderAsync(string updateServerPath, byte loadType, IAssetConfigure assetConfigure, Action <IAssetDownloader> callback)
        {
            this.assetVersion = assetConfigure.Version;
            this.totalSize    = 0;
            this.assets.Clear();

            var assetDescs     = assetConfigure.Assets;
            var checkLeftCount = assetDescs.Length;

            for (var i = 0; i < assetDescs.Length; ++i)
            {
                var description = assetDescs[i];
                _CollectUpgradeAssetAsync(loadType, updateServerPath, description, asset =>
                {
                    if (null != asset)
                    {
                        this.assets.Add(asset);
                        this.totalSize += asset.Size;
                    }

                    if (0 == (--checkLeftCount))
                    {
                        if (this.assets.Count > 0)
                        {
                            callback(this);
                        }
                        else
                        {
                            _SaveConfigureDataAsync(() =>
                            {
                                callback(null);
                            });
                        }
                    }
                });
            }
        }
Example #2
0
        private IAssetDownloader _SetupHotUpdateDownloaderWithoutCheck(string updateServerPath, IAssetConfigure assetConfigure)
        {
            this.assetVersion = assetConfigure.Version;
            this.totalSize    = 0;
            this.assets.Clear();

            var assetDescs = assetConfigure.Assets;

            for (var i = 0; i < assetDescs.Length; ++i)
            {
                var description = assetDescs[i];

                this.assets.Add(new Asset(description)
                {
                    ServerPath = updateServerPath,
                    File       = description.Path,
                    Size       = description.Size,
                });
                this.totalSize += description.Size;
            }

            return(this);
        }