/// <summary> /// Downloads the asset bundle. /// </summary> /// <param name="json">Json.</param> protected void DownloadAssetBundle(string json) { assetBundleData = JsonUtil.FromJson <AssetBundleInitialData> (json); if (assetBundleData._Resource.Major != Register.GetInt(assetBundleData._Resource.Name + AssetBundleInitialData.major)) { #if UNITY_EDITOR HDebug.Log("Major : " + assetBundleData._Resource.Major); #endif downloads = assetBundleData._AssetBundle; // Delete all AssetBundle. assetBundleManager.CleanCache(); } else if (assetBundleData._Resource.Minor != Register.GetInt(assetBundleData._Resource.Name + AssetBundleInitialData.minor)) { #if UNITY_EDITOR HDebug.Log("Minor : " + assetBundleData._Resource.Minor); #endif downloads = new List <AssetBundleInitialData.AssetBundle> (); for (int i = 0; i < assetBundleData._AssetBundle.Count; i++) { if (assetBundleData._AssetBundle [i]._Version != Register.GetInt(assetBundleData._AssetBundle [i].Name)) { downloads.Add(assetBundleData._AssetBundle [i]); } } } else { if (aEvent != null) { aEvent(AssetBundleInitalStatus.Over); } return; } if (aEvent != null) { aEvent(AssetBundleInitalStatus.Start); } if (downloads.Count > 0) { index = 0; DownloadAssetBundle(); } else { HDebug.LogWarning("None of this has changed assetbundle version."); Register.SetInt(assetBundleData._Resource.Name + AssetBundleInitialData.major, assetBundleData._Resource.Major); Register.SetInt(assetBundleData._Resource.Name + AssetBundleInitialData.minor, assetBundleData._Resource.Minor); if (aEvent != null) { aEvent(AssetBundleInitalStatus.Over); } } }
/// <summary> /// Http Callback the specified www. /// </summary> /// <param name="www">Www.</param> protected void Callback(WWW www) { if (www == null) { if (aEvent != null) { aEvent (AssetBundleInitalStatus.HttpTimeover); } return; } else if (www.error != null) { if (aEvent != null) { aEvent (AssetBundleInitalStatus.HttpError); } return; } if (response != null) { response (www); } assetBundleData = JsonUtil.FromJson<AssetBundleInitialData> (www.text); if (assetBundleData._Resource.Major != Register.GetInt (assetBundleData._Resource.Name + AssetBundleInitialData.MAJOR)) { #if UNITY_EDITOR HDebug.Log ("Major : " + assetBundleData._Resource.Major); #endif downloads = assetBundleData._AssetBundle; // Delete all AssetBundle. assetBundleManager.CleanCache (); } else if (assetBundleData._Resource.Minor != Register.GetInt (assetBundleData._Resource.Name + AssetBundleInitialData.MINOR)) { #if UNITY_EDITOR HDebug.Log ("Minor : " + assetBundleData._Resource.Minor); #endif downloads = new List<AssetBundleInitialData.AssetBundle> (); for (int i = 0; i < assetBundleData._AssetBundle.Count; i++) { if (assetBundleData._AssetBundle [i]._Version != Register.GetInt (assetBundleData._AssetBundle [i].Name)) { downloads.Add (assetBundleData._AssetBundle [i]); } } } else { if (aEvent != null) { aEvent (AssetBundleInitalStatus.Over); } return; } if (aEvent != null) { aEvent (AssetBundleInitalStatus.Start); } if (downloads.Count > 0) { index = 0; DownloadAssetBundle (); } else { HDebug.LogWarning ("None of this has changed assetbundle version."); Register.SetInt (assetBundleData._Resource.Name + AssetBundleInitialData.MAJOR, assetBundleData._Resource.Major); Register.SetInt (assetBundleData._Resource.Name + AssetBundleInitialData.MINOR, assetBundleData._Resource.Minor); if (aEvent != null) { aEvent (AssetBundleInitalStatus.Over); } } }