Browse Source

Merge branch 'F/0710_2.1+2.0' of https://gogs.ghz-tech.com:8843/GHzGlass/GHZMRNavigatorProXR into F/0710_2.1+2.0

胡佳骏 1 year ago
parent
commit
64e0ed6128

+ 3 - 1
Assets/2.0/User/Model/ModelItem.cs

@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.IO;
 using UnityEngine;
 
 public enum ModelType
@@ -186,7 +187,8 @@ public class ModelItem
                 break;
             case ModelType.Video:
                 Debug.Log("  DownloadPath   " + DownloadPath);
-                prefabModel.GetComponent<TemplateVideo>().SetData(HttpAction.baseurvideo + DownloadPath);
+                // prefabModel.GetComponent<TemplateVideo>().SetData(HttpAction.baseurvideo + DownloadPath);
+                prefabModel.GetComponent<TemplateVideo>().SetData(Application.persistentDataPath+"/Material/"+Path.GetFileName(DownloadPath));
                 break;
             case ModelType.ABModel:
                 AssetBundle assetBundle = AssetBundle.LoadFromMemory(data);

+ 2 - 1
Assets/COSScripts/COSDownLoad.cs

@@ -105,7 +105,7 @@ public class COSDownLoad:MonoSingleton<COSDownLoad>
         //{
         //    Console.WriteLine(String.Format("progress = {0:##.##}%", completed * 100.0 / total));
         //};
-
+        Debug.Log(downloadMaterial.downLoadPath);
         downloadTask.onState += OnState;
         try
         {
@@ -150,6 +150,7 @@ public class COSDownLoad:MonoSingleton<COSDownLoad>
         string bucket = successCos.bucket;
         //string localDir = System.IO.Path.GetTempPath();//本地文件夹
         Debug.Log(listDLMaterial.Count);
+
         for (int i = 0; i < listDLMaterial.Count; i++)
         {
             string cosPath = listDLMaterial[i].downLoadPath;

+ 8 - 1
Assets/COSScripts/DownloadResManager.cs

@@ -75,9 +75,14 @@ public class DownloadResManager : MonoSingleton<DownloadResManager>
     /// <param name="downloadMaterial"></param>
     public void DownLoad(DownLoadMaterial downloadMaterial)
     {
+
+      
+
        if( Screen( downloadMaterial) == false)
         {
-            COSDownLoad.Instance.TransferDownloadObject(downloadMaterial, path);
+            List<DownLoadMaterial> list = new List<DownLoadMaterial>();
+            list.Add(downloadMaterial);
+            COSDownLoad.Instance.TransferBatchDownloadObjects(list, path);
         }
         else
         {
@@ -173,4 +178,6 @@ public class DownLoadMaterial
     public long updataTime { get; set; }
 
     public string type { get; set; }
+
+    
 }

+ 1 - 1
Assets/Scripts/LayoutTemplate/BaseTemPlate.cs

@@ -1,4 +1,4 @@
-using SC.XR.Unity.Module_InputSystem;
+using SC.XR.Unity.Module_InputSystem;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;

+ 10 - 24
Assets/Scripts/LayoutTemplate/TemplateVideo.cs

@@ -9,36 +9,20 @@ public class TemplateVideo : BaseTemPlate
     private Navigator.VideoControl m_VideoCtr;
     private AVProVideoPlayer m_Video;
 
+    private string localSavePath;
     protected override void OnEnable()
     {
-
+        localSavePath = Application.persistentDataPath + "/Material/" + Path.GetFileName(Data.downloadPath);
         base.OnEnable();
-        //if (GameManager.Instance.IsRuning && string.IsNullOrWhiteSpace(m_VideoCtr.VideoURL))
-        //{
-        //    if (File.Exists(Data.localSavePath))
-        //    {
-
-
-
-        //        m_VideoCtr.VideoURL = Data.localSavePath;
-
-        //    }
-        //    else
-        //    {
-        //        m_VideoCtr.VideoURL = null;
-        //    }
-        //}
-        //m_VideoCtr.m_IsPlaying = false;
-        //m_VideoCtr.PlayVideo();
-
         if (GameManager.Instance.IsRuning && string.IsNullOrWhiteSpace(m_Video.GetUrl()))
         {
-            if (File.Exists(Data.localSavePath))
+          
+            if (File.Exists(localSavePath))
             {
 
 
 
-                m_Video.SetUrl(Data.localSavePath);
+                m_Video.SetUrl(localSavePath);
 
             }
             else
@@ -80,10 +64,11 @@ public class TemplateVideo : BaseTemPlate
         }
         else
         {
-            if (File.Exists(Data.localSavePath))
+            localSavePath = Application.persistentDataPath + "/Material/" + Path.GetFileName(Data.downloadPath);
+            if (File.Exists(localSavePath))
             {
                 //  m_VideoCtr.VideoURL = Data.localSavePath;
-                m_Video.SetUrl(Data.localSavePath);
+                m_Video.SetUrl(localSavePath);
             }
             else
             {
@@ -97,12 +82,13 @@ public class TemplateVideo : BaseTemPlate
     public void SetData(string url)
     {
         Debug.Log(url);
+        localSavePath = Application.persistentDataPath + "/Material/" + Path.GetFileName(Data.downloadPath);
         //if(m_VideoCtr ==null)
         //    m_VideoCtr = transform.Find("Screen/Video").GetComponent<Navigator.VideoControl>();
         //m_VideoCtr.VideoURL = url;
         if (m_Video == null)
             m_Video = transform.Find("Screen/AVideo").GetComponent<AVProVideoPlayer>();
-        m_Video.SetUrl(url);
+        m_Video.SetUrl(localSavePath);
 
     }