Beispiel #1
0
        public async Task LoadAsync()
        {
            if (File.Exists(_localPath))
            {
                try
                {
                    _abManifest = JsonUtility.FromJson <AbManifest>(File.ReadAllText(_localPath));
                }
                catch (System.Exception e)
                {
                    Debug.LogError(
                        $"{GetType()}/UpdateAsync() failed to read AbManifest file, please check it! Error Message: {e}");
                    return;
                }
            }
            else
            {
                return;
            }

            if (File.Exists(_manifestLocalPath))
            {
                var   abCreateRequest = AssetBundle.LoadFromFileAsync(_manifestLocalPath);
                await abCreateRequest;
                var   assetBundle = abCreateRequest.assetBundle;
                var   abManifest  = _abManifest;
                abManifest.manifest = assetBundle.LoadAsset(AbDefine.assetbundleManifest) as AssetBundleManifest;
                _abManifest         = abManifest;
            }
        }
Beispiel #2
0
        public async Task <AbUpdateMode> CheckUpdateAsync()
        {
            await DownloadFileAsync(_remotePath, _tempPath);

            if (!File.Exists(_localPath))
            {
                return(AbUpdateMode.Force);
            }

            if (File.Exists(_tempPath))
            {
                _abManifest = JsonUtility.FromJson <AbManifest>(File.ReadAllText(_localPath));
                var temp = JsonUtility.FromJson <AbManifest>(File.ReadAllText(_tempPath));
                if (temp.version > _abManifest.version)
                {
                    return(AbUpdateMode.Remind);
                }
            }

            return(AbUpdateMode.None);
        }
Beispiel #3
0
 public MultiAbLoader(AbManifest abManifest)
 {
     _loaders    = new Dictionary <Hash128, AbLoader>();
     _relations  = new Dictionary <Hash128, AbRelation>();
     _abManifest = abManifest;
 }