예제 #1
0
        /// <summary>
        /// Manifest自体の取得
        /// </summary>
        public IEnumerator LoadWait(IManifestAccess manifest)
        {
            if (m_bundle)
            {
                m_bundle.Unload(true);
                m_bundle = null;
            }
            //	manifestのパス
            //	s3 : xxxx // server-version / fileName

            yield return(m_versionLoader.LoadWait( ));

            var version = m_versionLoader.Get();

            while (!m_cache.ready)
            {
                yield return(null);
            }
            var location = manifest.Uri;

            ChipstarLog.Log_RequestVersionManifest(location);

            // 保存先指定
            Caching.currentCacheForWriting = m_cache;
            //	アセットバンドルとしてDL/キャッシュ
            var www = UnityWebRequestAssetBundle.GetAssetBundle(location, version.Hash);

            www.SendWebRequest();
            // DL待ち
            while (!www.isDone)
            {
                yield return(null);

                if (www.isHttpError || www.isNetworkError)
                {
                    throw new Exception(www.error + "\n" + www.url);
                }
            }

            // Manifestの取得
            m_bundle = DownloadHandlerAssetBundle.GetContent(www);
            // 中身のLoad
            var loadMainfestAssets = m_bundle.LoadAllAssetsAsync();

            while (!loadMainfestAssets.isDone)
            {
                yield return(null);
            }
            // 結果の保持
            m_assets = loadMainfestAssets.allAssets;
            // Complete
            yield break;
        }