|
@@ -419,6 +419,16 @@ public class Bundle : MonoBehaviour
|
|
//return "file://" + Application.streamingAssetsPath + "/Bundle/Windows/";
|
|
//return "file://" + Application.streamingAssetsPath + "/Bundle/Windows/";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static string GetPersistingPath()
|
|
|
|
+ {
|
|
|
|
+ if (Application.platform == RuntimePlatform.IPhonePlayer)
|
|
|
|
+ return "file://" + Application.persistentDataPath;
|
|
|
|
+ else if (Application.isMobilePlatform)
|
|
|
|
+ return Application.streamingAssetsPath;
|
|
|
|
+ else
|
|
|
|
+ return "file://" + Application.persistentDataPath;
|
|
|
|
+ }
|
|
|
|
+
|
|
public static string GetStreamingUrlPath()
|
|
public static string GetStreamingUrlPath()
|
|
{
|
|
{
|
|
if (Application.platform == RuntimePlatform.IPhonePlayer)
|
|
if (Application.platform == RuntimePlatform.IPhonePlayer)
|
|
@@ -714,7 +724,7 @@ public class Bundle : MonoBehaviour
|
|
CopyCount++;
|
|
CopyCount++;
|
|
Initializer.Instance.StartCoroutine
|
|
Initializer.Instance.StartCoroutine
|
|
(
|
|
(
|
|
- LoadAssetBundle
|
|
|
|
|
|
+ LoadAssetBundleFromStream
|
|
(
|
|
(
|
|
streamingFolder,
|
|
streamingFolder,
|
|
assetBundleName,
|
|
assetBundleName,
|
|
@@ -734,7 +744,7 @@ public class Bundle : MonoBehaviour
|
|
CopyCount--;
|
|
CopyCount--;
|
|
}
|
|
}
|
|
|
|
|
|
- public static IEnumerator LoadAssetBundle(string folder, string name, Action<WWW> callback)
|
|
|
|
|
|
+ public static IEnumerator LoadAssetBundleFromStream(string folder, string name, Action<WWW> callback)
|
|
{
|
|
{
|
|
WWW www = new WWW(GetStreamingUrlPath() + Path.DirectorySeparatorChar + "Bundle" + Path.DirectorySeparatorChar + folder + Path.DirectorySeparatorChar + "HotUpdate" + Path.DirectorySeparatorChar + name);
|
|
WWW www = new WWW(GetStreamingUrlPath() + Path.DirectorySeparatorChar + "Bundle" + Path.DirectorySeparatorChar + folder + Path.DirectorySeparatorChar + "HotUpdate" + Path.DirectorySeparatorChar + name);
|
|
yield return www;
|
|
yield return www;
|
|
@@ -782,15 +792,16 @@ public class Bundle : MonoBehaviour
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- Debug.Log(localMD5);
|
|
|
|
- Debug.Log(HttpManager.Md5);
|
|
|
|
|
|
+ //Debug.Log(localMD5);
|
|
|
|
+ //Debug.Log(HttpManager.Md5);
|
|
needUpdate = localMD5 != HttpManager.Md5;
|
|
needUpdate = localMD5 != HttpManager.Md5;
|
|
Debug.LogWarning($"NeedUpdate : {needUpdate}");
|
|
Debug.LogWarning($"NeedUpdate : {needUpdate}");
|
|
}
|
|
}
|
|
- if (Application.isEditor)
|
|
|
|
- {
|
|
|
|
- needUpdate = false;
|
|
|
|
- }
|
|
|
|
|
|
+ //if (Application.isEditor)
|
|
|
|
+ //{
|
|
|
|
+ // needUpdate = false;
|
|
|
|
+ //}
|
|
|
|
+ AssetBundleUtility.OnDownloadOrUpdateFinish += FinishDownloadAndLoad;
|
|
if (needUpdate)
|
|
if (needUpdate)
|
|
{
|
|
{
|
|
Initializer.DebugText.text = "U4";
|
|
Initializer.DebugText.text = "U4";
|
|
@@ -828,7 +839,7 @@ public class Bundle : MonoBehaviour
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public static void DownloadAllAssetBundleSucceed()
|
|
|
|
|
|
+ private static void FinishDownloadAndLoad()
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -917,6 +928,11 @@ public class Bundle : MonoBehaviour
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static void DownloadAllAssetBundleSucceed()
|
|
|
|
+ {
|
|
|
|
+ Debug.Log("succeed");
|
|
|
|
+ }
|
|
|
|
+
|
|
public static void DownloadAllAssetBundleFailed()
|
|
public static void DownloadAllAssetBundleFailed()
|
|
{
|
|
{
|
|
Debug.Log("failed");
|
|
Debug.Log("failed");
|
|
@@ -958,9 +974,21 @@ public class Bundle : MonoBehaviour
|
|
|
|
|
|
public static void DownloadAssetBundleFailed(AssetBundleSet assetBundleSet, string error)
|
|
public static void DownloadAssetBundleFailed(AssetBundleSet assetBundleSet, string error)
|
|
{
|
|
{
|
|
- string str = Language.GetStr(LanguageLabel.UI__AJ_UpdateFailed, Application.systemLanguage) + " " + error;
|
|
|
|
- UpdatePanel.SetContent(str);
|
|
|
|
- //Debug.Log(error);
|
|
|
|
|
|
+ Debug.Log(error);
|
|
|
|
+ string path = assetBundleSet.PersistentPath;
|
|
|
|
+ path = path.Replace("/", Path.DirectorySeparatorChar.ToString());
|
|
|
|
+ path = path.Replace("\\", Path.DirectorySeparatorChar.ToString());
|
|
|
|
+ path = path.Replace("\\\\", Path.DirectorySeparatorChar.ToString());
|
|
|
|
+ path = "file://" + path;
|
|
|
|
+ WWW www = new WWW(path);
|
|
|
|
+ AssetBundleSet bundleSet = new AssetBundleSet();
|
|
|
|
+ bundleSet.Name = assetBundleSet.Name;
|
|
|
|
+ bundleSet.AssetBundle = www.assetBundle;
|
|
|
|
+ DownloadAssetBundleSucceed(bundleSet, false);
|
|
|
|
+
|
|
|
|
+ //string str = Language.GetStr(LanguageLabel.UI__AJ_UpdateFailed, Application.systemLanguage) + " " + error;
|
|
|
|
+ //UpdatePanel.SetContent(str);
|
|
|
|
+
|
|
//Initializer.DebugText.text = assetBundleSet.Name;
|
|
//Initializer.DebugText.text = assetBundleSet.Name;
|
|
//Initializer.DebugText.text += error;
|
|
//Initializer.DebugText.text += error;
|
|
//Initializer.EnableDebugLab();
|
|
//Initializer.EnableDebugLab();
|