Esempio n. 1
0
    public IEnumerator DownloadAssetBundles()
    {
        Screen.sleepTimeout = -1;
        Int32 curItem = 0;
        Int32 numItem = AssetManager.DictAssetBundleRefs.Count;

        if (!BundleSceneIOS.Are3CompressedBundlesCached())
        {
            global::Debug.Log("Need to check free space");
            if (Storage.GetFreeSpace() < 382335908UL)
            {
                this.LoadingUI.SetSceneActive(true);
                this.LoadingUI.SetStatusText(ExpansionVerifier.State.DecompressFailure, ExpansionVerifier.ErrorCode.NotEnoughStorage);
                yield break;
            }
            AssetManager.ClearCache();
            Single curTime = Time.realtimeSinceStartup;
            Single percent = 0f;
            while (Time.realtimeSinceStartup - curTime < 5f)
            {
                percent = (Time.realtimeSinceStartup - curTime) / 5f;
                this.LoadingUI.SetSceneActive(true);
                this.LoadingUI.SetStatusText(ExpansionVerifier.State.DecompressOBB, ExpansionVerifier.ErrorCode.None);
                Single total         = ((Single)this.currentProgressIndex + percent) * 100f;
                Single totalProgress = total / 4f;
                this.LoadingUI.SetProgress(Mathf.FloorToInt(totalProgress), true);
                yield return(new WaitForSeconds(0.3f));
            }
            this.currentProgressIndex++;
        }
        foreach (KeyValuePair <String, AssetManager.AssetBundleRef> entry in AssetManager.DictAssetBundleRefs)
        {
            AssetManager.AssetBundleRef abRef = entry.Value;
            if (abRef.assetBundle != (UnityEngine.Object)null)
            {
                break;
            }
            yield return(base.StartCoroutine(this.DownloadAssetBundle(abRef, curItem, numItem)));

            curItem++;
        }
        this._SetStatusText("Load Completed");
        Screen.sleepTimeout = -2;
        this._OnDownloadFinished();
        yield return(null);

        yield break;
    }
Esempio n. 2
0
    private void Awake()
    {
        global::Debug.Log("10 BundleSceneSelector.Awake");
        Boolean flag = false;

        String[] files = Directory.GetFiles("./", "*steam_appid.txt", SearchOption.AllDirectories);
        String[] array = files;
        for (Int32 i = 0; i < (Int32)array.Length; i++)
        {
            String   fileName = array[i];
            FileInfo fileInfo = new FileInfo(fileName);
            if (fileInfo.IsReadOnly)
            {
                fileInfo.IsReadOnly = false;
            }
            fileInfo.Delete();
        }
        if (SteamSdkWrapper.SteamAPIRestartAppIfNecessary())
        {
            Application.Quit();
            return;
        }
        if (Application.platform == RuntimePlatform.IPhonePlayer || flag)
        {
            if (BundleSceneIOS.Are3CompressedBundlesCached())
            {
                global::Debug.Log("All 3 compressed bundles are cachaed. Go to SplashScreen");
                Application.LoadLevel("SplashScreen");
            }
            else
            {
                global::Debug.Log("Some compressed bundles are NOT cached. Go to Bundle-iOS");
                Application.LoadLevel("Bundle-iOS");
            }
        }
        else
        {
            Application.LoadLevel("SplashScreen");
        }
    }