예제 #1
0
    public void EndCallBackOne_ODLS(AssetBundle ab, AB_DownLoadInfo abdlI)
    {
        this.ABM_Instance.DelODLS(abdlI);
        bool flag = this.endFuncOne(ab);

        if (abdlI != null && abdlI.www != null)
        {
            abdlI.www.Dispose();
            abdlI.www = null;
        }
        if (!flag)
        {
            bool flag2 = this.ABM_Instance.IsODLSExist();
            if (flag2 && this.execFCT < this.abid.assetBundleInfoList.Count)
            {
                AB_DownLoadInfo abdlI2 = this.ABM_Instance.DownLoad_OneAssetBundleData(this.abid.name, this.abid.ver, this.abid.abPath, this.abid.assetBundleInfoList[this.execFCT++], new Action <AssetBundle, AB_DownLoadInfo>(this.EndCallBackOne_ODLS), false);
                this.ABM_Instance.AddODLS(abdlI2);
            }
        }
    }
예제 #2
0
	private IEnumerator ReloadFromWWW(AB_DownLoadInfo abdlI, string AB_ROOT_PATH)
	{
		yield return base.StartCoroutine(this.WaitResponse_DownLoad(abdlI, AB_ROOT_PATH, true));
		yield break;
	}
예제 #3
0
	public AB_DownLoadInfo DownLoad_OneAssetBundleData(string catName, int ver, string abPath, AssetBundleInfo abInfo, Action<AssetBundle, AB_DownLoadInfo> actEnd = null, bool forceDL = false)
	{
		AB_DownLoadInfo abdlI = new AB_DownLoadInfo
		{
			ver = ver,
			abPath = abPath,
			abInfo = abInfo,
			actEndCallBack = actEnd,
			progress = 0f
		};
		string text = string.Empty;
		string strROOT = string.Empty;
		strROOT = this.GetAssetBundleRootPath();
		text = strROOT + abdlI.abPath + abdlI.abInfo.abName;
		text = text + ".unity3d?" + AssetDataMng.assetVersion;
		uint crc = abdlI.abInfo.crc;
		uint recordCRC = this.GetRecordCRC(abdlI.abPath, abdlI.abInfo.abName);
		int recordVersion = this.GetRecordVersion(abdlI.abPath, abdlI.abInfo.abName);
		if (abdlI.actEndCallBack != null)
		{
			Action action;
			if (forceDL && recordVersion != -1)
			{
				abdlI.ver = recordVersion;
				action = delegate()
				{
					this.StartCoroutine(this.WaitResponse_DownLoad(abdlI, strROOT, forceDL));
				};
			}
			else
			{
				forceDL = false;
				if (this.level != string.Empty && this.level != abdlI.abInfo.level.Trim())
				{
					action = delegate()
					{
						abdlI.actEndCallBack(null, abdlI);
					};
				}
				else if (recordVersion == -1)
				{
					abdlI.ver = 1;
					action = delegate()
					{
						this.StartCoroutine(this.WaitResponse_DownLoad(abdlI, strROOT, false));
					};
				}
				else if (recordCRC != crc)
				{
					abdlI.ver = recordVersion;
					action = delegate()
					{
						this.StartCoroutine(this.WaitResponse_DownLoad(abdlI, strROOT, false));
					};
				}
				else
				{
					Hash128 hash = new Hash128(0u, 0u, 0u, (uint)recordVersion);
					bool flag = Caching.IsVersionCached(text, hash);
					if (flag)
					{
						Caching.MarkAsUsed(text, hash);
						action = delegate()
						{
							abdlI.actEndCallBack(null, abdlI);
						};
					}
					else
					{
						abdlI.ver = recordVersion;
						action = delegate()
						{
							this.StartCoroutine(this.WaitResponse_DownLoad(abdlI, strROOT, false));
						};
					}
				}
			}
			this.waitDownLoadCT = 1;
			base.StartCoroutine(this.DownLoad(action));
			return abdlI;
		}
		Hash128 hash2 = new Hash128(0u, 0u, 0u, 1u);
		bool flag2 = Caching.IsVersionCached(text, hash2);
		if (flag2)
		{
			abdlI.www = WWW.LoadFromCacheOrDownload(text, hash2, 0u);
			while (!abdlI.www.isDone)
			{
				Thread.Sleep(1);
			}
			return abdlI;
		}
		abdlI.ver = recordVersion;
		forceDL = false;
		base.StartCoroutine(this.ReloadFromWWW(abdlI, strROOT));
		string text2 = text.Substring(text.IndexOf("AB_DATA/"));
		string text3 = text2;
		text2 = string.Concat(new string[]
		{
			text3,
			"\n存在するはずのファイルがキャッシュに存在しません!\n CRC = ",
			recordCRC.ToString(),
			",  VER = ",
			recordVersion.ToString()
		});
		NativeMessageDialog.Show(text2);
		return abdlI;
	}
예제 #4
0
	private IEnumerator WaitResponse_DownLoad(AB_DownLoadInfo abdlI, string AB_ROOT_PATH, bool forceDL = false)
	{
		string allPath = AB_ROOT_PATH + abdlI.abPath + abdlI.abInfo.abName;
		uint crc = abdlI.abInfo.crc;
		allPath = allPath + ".unity3d?" + AssetDataMng.assetVersion;
		while (this.isWaitDiskSpaceCheck)
		{
			yield return null;
		}
		this.isWaitDiskSpaceCheck = true;
		yield return base.StartCoroutine(AssetBundleDiskSpaceCheck.CheckDiskSpace(abdlI.abInfo, this));
		this.isWaitDiskSpaceCheck = false;
		this.countDownloadProcess++;
		long assetbundleFileSize = long.Parse(abdlI.abInfo.size);
		this.downloadFileSize += AssetBundleDiskSpaceCheck.GetFileSize(assetbundleFileSize);
		while (!Caching.ready)
		{
			yield return null;
		}
		WWWHelper wwwHelper = WWWHelper.LoadFromCacheOrDownload(allPath, abdlI.ver, crc, 60f);
		bool startDownload = true;
		while (startDownload)
		{
			yield return base.StartCoroutine(wwwHelper.StartDownloadAssetBundle(delegate(WWW www)
			{
				if (abdlI.www != null)
				{
					abdlI.www.Dispose();
				}
				abdlI.www = www;
			}, delegate(WWW resultWWW)
			{
				if (resultWWW == null)
				{
					if (!forceDL)
					{
						this.OpenAlert();
					}
				}
				else if (!string.IsNullOrEmpty(resultWWW.error))
				{
					if (!forceDL && this.isOpenAlert(resultWWW.error))
					{
						this.OpenAlert();
					}
					abdlI.www = resultWWW;
				}
				else
				{
					abdlI.www = resultWWW;
					startDownload = false;
				}
			}));
			while (this.IsStopDownload())
			{
				yield return null;
			}
		}
		this.countDownloadProcess--;
		this.downloadFileSize -= AssetBundleDiskSpaceCheck.GetFileSize(assetbundleFileSize);
		if (!forceDL)
		{
			this.Add_OR_SetRecord(abdlI.abPath, abdlI.abInfo.abName, crc, abdlI.ver);
		}
		if (abdlI.actEndCallBack != null)
		{
			abdlI.actEndCallBack(abdlI.www.assetBundle, abdlI);
		}
		yield break;
	}