|
@@ -10,19 +10,32 @@ public class LocalLoadManager : MonoSingleton<LocalLoadManager>
|
|
|
|
|
|
private Dictionary<string, byte[]> dicLoaclData = new Dictionary<string, byte[]>();
|
|
|
|
|
|
+ public void test()
|
|
|
+ {
|
|
|
+ Debug.Log("Hjj test");
|
|
|
+ }
|
|
|
+
|
|
|
public void LocalLoadMaterial(DownLoadMaterial downloadMaterial)
|
|
|
{
|
|
|
- if (dicLoaclData.ContainsKey(downloadMaterial.localLoadPath))
|
|
|
+
|
|
|
+ Debug.Log("Hjj LocalLoadMaterial :" + downloadMaterial.localLoadPath + " ");
|
|
|
+ if (dicLoaclData.ContainsKey(downloadMaterial.downLoadPath))
|
|
|
{
|
|
|
- MsgHandler.SendMsg(downloadMaterial.localLoadPath, new Msg(downloadMaterial.localLoadPath, dicLoaclData[downloadMaterial.localLoadPath]));
|
|
|
+ Debug.Log("Hjj LocalLoadMaterial 1 :" + downloadMaterial.localLoadPath + " ");
|
|
|
+ MsgHandler.SendMsg(downloadMaterial.downLoadPath, new Msg(downloadMaterial.downLoadPath, dicLoaclData[downloadMaterial.downLoadPath]));
|
|
|
}
|
|
|
else
|
|
|
+ {
|
|
|
+ Debug.Log("Hjj LocalLoadMaterial 2 :" + downloadMaterial.localLoadPath + " ");
|
|
|
StartCoroutine(DownloadFile(downloadMaterial));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private System.Collections.IEnumerator DownloadFile(DownLoadMaterial downloadMaterial)
|
|
|
{
|
|
|
bool isDownLoad;
|
|
|
+
|
|
|
+ Debug.Log("Hjj DownloadFile :" + downloadMaterial.localLoadPath + " ");
|
|
|
using (UnityWebRequest webRequest = new UnityWebRequest(downloadMaterial.localLoadPath, UnityWebRequest.kHttpVerbGET))
|
|
|
{
|
|
|
webRequest.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
|
|
@@ -30,8 +43,10 @@ public class LocalLoadManager : MonoSingleton<LocalLoadManager>
|
|
|
webRequest.SetRequestHeader("authorization", UserInfo.Instance.Token);
|
|
|
webRequest.SetRequestHeader("Content-Type", "application/json");
|
|
|
|
|
|
+ Debug.Log("Hjj DownloadFile start:" + downloadMaterial.localLoadPath + " ");
|
|
|
yield return webRequest.SendWebRequest();
|
|
|
|
|
|
+ Debug.Log("Hjj DownloadFile end:" + downloadMaterial.localLoadPath + " ");
|
|
|
while (!webRequest.isDone)
|
|
|
{
|
|
|
|
|
@@ -47,16 +62,16 @@ public class LocalLoadManager : MonoSingleton<LocalLoadManager>
|
|
|
|
|
|
|
|
|
isDownLoad = false;
|
|
|
- MsgHandler.SendMsg(downloadMaterial.localLoadPath, new Msg(downloadMaterial.localLoadPath,null));
|
|
|
+ MsgHandler.SendMsg(downloadMaterial.downLoadPath, new Msg(downloadMaterial.downLoadPath, null));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Debug.Log(webRequest.isDone + " " + webRequest.downloadHandler.data.Length);
|
|
|
+ Debug.Log("Hjj DownloadFile isDone:"+webRequest.isDone + " " + webRequest.downloadHandler.data.Length);
|
|
|
|
|
|
|
|
|
- dicLoaclData.Add(downloadMaterial.localLoadPath, webRequest.downloadHandler.data);
|
|
|
+ dicLoaclData.Add(downloadMaterial.downLoadPath, webRequest.downloadHandler.data);
|
|
|
isDownLoad = true;
|
|
|
- MsgHandler.SendMsg(downloadMaterial.localLoadPath, new Msg(downloadMaterial.localLoadPath, webRequest.downloadHandler.data));
|
|
|
+ MsgHandler.SendMsg(downloadMaterial.downLoadPath, new Msg(downloadMaterial.downLoadPath, webRequest.downloadHandler.data));
|
|
|
}
|
|
|
|
|
|
}
|