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

# Conflicts:
#	Assets/AVProPlayer.meta
#	Assets/Immersal.meta
#	Assets/LiveKitRTC.meta
#	Assets/LoginXR.meta
#	Assets/MRNavigatorPro.unity
#	Assets/OOBEPackage.meta
#	Assets/Scripts/Blue/Service/IPointService.cs
#	Assets/Scripts/Blue/Service/IUpOrDownloadService.cs
#	Assets/Scripts/UI/LoginPanel.cs
#	Assets/TriLibXR.meta
#	Assets/YiYanPackage.meta
胡佳骏 1 year ago
parent
commit
8e301a74dc

+ 7 - 0
Assets/2.0/Tools/DownLoadItem.cs

@@ -3,6 +3,7 @@ using Newtonsoft.Json;
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.IO;
 using System.Text;
 using UnityEngine;
 using UnityEngine.Networking;
@@ -240,6 +241,12 @@ public class DownLoadItem : MonoBehaviour
     public void DownloadFileMsg()
     {
         MsgHandler.AddListener(Application.persistentDataPath + "" + downLoadPath, HandleMsg);
+        DownLoadMaterial data = new DownLoadMaterial();
+        data.downLoadPath = downLoadPath;
+        data.localLoadPath = Application.persistentDataPath + "/Material/" + Path.GetFileName(downLoadPath);
+        data.updataTime = 0;
+        data.type = type.ToString();
+        DownloadResManager.Instance.DownLoad(data);
     }
 
     private void HandleMsg(Msg msg)

+ 2 - 1
Assets/2.0/Tools/LoadManager.cs

@@ -28,7 +28,8 @@ public class LoadManager : Singleton<LoadManager>
                         Debug.Log("下载完成===>" + nowLoad);
                         nowLoad--;
                     };
-                   GameScene.Instance.StartCoroutine( item.DownloadFile());
+                    // GameScene.Instance.StartCoroutine( item.DownloadFile());
+                    item.DownloadFileMsg();
                     nowLoad++;
                     if(nowLoad>= maxLoad)
                     {

+ 1 - 1
Assets/AVProPlayer.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 7995b5a7e8b9a3e46a93bf9f9b3669ee
+guid: a645ecf929262664ebff3f1793d1416d
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 1 - 1
Assets/Immersal.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: c9ae898be76006940b8b61049a84f882
+guid: c432480eb1e956a40ac852b0d421e0e0
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 1 - 1
Assets/LiveKitRTC.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: d0cab6f1e31be474b9f68a9fff011020
+guid: bdcd0cab5eb780b47a04042e16340758
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 1 - 1
Assets/LoginXR.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 5e199e4928234f146bd5c054f5dee1ef
+guid: 88dea9409d115d94492156d233182efb
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 1 - 1
Assets/OOBEPackage.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 101241248081f3d4284199661b610313
+guid: 1abe9eb826718c04daead5fbcf19c574
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 5 - 58
Assets/Scripts/Blue/Service/IPointService.cs

@@ -1,12 +1,7 @@
 using System;
 using System.Collections;
-using System.Collections.Generic;
 using System.IO;
-using System.Text;
 using Blue;
-using LitJson;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
 using UnityEngine;
 using UnityEngine.Networking;
 
@@ -32,20 +27,15 @@ public interface IPointService:IService
     /// <param name="fileType">文件类型</param>
     /// <param name="sceneID">场景ID</param>
     void DownloadPointFile(string downloadingUrl, PointFileType fileType);
-
-    void GetRefrencePos(int sceneID); // 获取参照物的坐标旋转
 }
 
 public class PointService : IPointService
 {
-    public ScenePosRotInfo PosRot { get; private set; }
     private string UrlPointCloud;
-    private string UrlObjOfReference;
     public void OnInit()
     {
-      //UrlPointCloud = "https://pro.qulivr.com/mr-navigator/v1";
-        UrlPointCloud = "https://api-cs.ghz-tech.com/mr-navigator/v1";
-        UrlObjOfReference = "https://api-fat3.ghz-tech.com/mr-navigator/v1/project/unityReference";
+        // UrlPointCloud = "https://pro.qulivr.com/mr-navigator/v1";
+        UrlPointCloud = "https://api-fat2.ghz-tech.com/mr-navigator/v1";
     }
 
     public void GetPoint(string methodName, Action<string> callback)
@@ -59,6 +49,7 @@ public class PointService : IPointService
         UriBuilder uriBuilder = new UriBuilder(url);
         // 添加查询参数
         uriBuilder.Query = "projectId=" + projectId + "&fileType=" + fileType.ToString();
+        Debug.Log(uriBuilder.Uri);
         // 创建UnityWebRequest
         UnityWebRequest webRequest = UnityWebRequest.Get(uriBuilder.Uri);
         webRequest.SetRequestHeader("Authorization", UserInfo.Instance.Token);
@@ -70,11 +61,6 @@ public class PointService : IPointService
         CoroutineSystem.Instance.Start_Coroutine(DownloadPointFileRequest(downloadingUrl,fileType));
     }
 
-    public void GetRefrencePos(int sceneID)
-    {
-        CoroutineSystem.Instance.Start_Coroutine(GetObjectOfRefrence(UrlObjOfReference,sceneID));
-    }
-
     #region 协程
 
     private IEnumerator GetPointRequest(string methodName, Action<string> callback)
@@ -139,7 +125,7 @@ public class PointService : IPointService
                     nFile.Write(File, 0, File.Length); //写入数据
                     nFile.Close(); nFile.Dispose(); nFile = null;//关闭当前流并释放与之相关联的所有系统资源
                     if (fileType == PointFileType.bytes)
-                        this.SendEvent(new LoadMapFileEvent() { fileName = fileName });
+                        this.TriggerEvent(new LoadMapFileEvent() { fileName = fileName });
                 }
             }
                
@@ -148,48 +134,9 @@ public class PointService : IPointService
         {
             Debug.LogWarning("文件已存在");
             if (fileType == PointFileType.bytes)
-                this.SendEvent(new LoadMapFileEvent() { fileName = fileName });
+                this.TriggerEvent(new LoadMapFileEvent() { fileName = fileName });
         }
     }
-    private IEnumerator GetObjectOfRefrence(string url,int sceneID)
-    {
-        using (UnityWebRequest webRequest = new UnityWebRequest(url, "POST"))
-        {
-            ObjofRefrendenceInfo TestGet = new ObjofRefrendenceInfo();
-            TestGet.id = sceneID;
-            string jsonData = JsonConvert.SerializeObject(TestGet);
-            byte[] bodyRaw = Encoding.UTF8.GetBytes(jsonData);
-
-            webRequest.uploadHandler = (UploadHandler)new UploadHandlerRaw(bodyRaw);
-            webRequest.downloadHandler = new DownloadHandlerBuffer();
-
-            webRequest.SetRequestHeader("Content-Type", "application/json;charset=utf-8");
-            webRequest.SetRequestHeader("authorization", UserInfo.Instance.Token);
 
-            yield return webRequest.SendWebRequest();
-
-            if (webRequest.result== UnityWebRequest.Result.ProtocolError || webRequest.result == UnityWebRequest.Result.ConnectionError)
-                Debug.LogError("UnityWebRequest Error:"+webRequest.downloadHandler.text);
-            else
-            {
-                if (!string.IsNullOrWhiteSpace(webRequest.downloadHandler.text))
-                {
-                    string message = webRequest.downloadHandler.text;
-                    JObject jobject = JObject.Parse(message);
-                    if (jobject["code"].ToString() == "200")
-                    {
-                        message = jobject["data"].ToString();
-                        if (!string.IsNullOrWhiteSpace(message))
-                        {
-                            // Debug.LogError("message:"+message);
-                            ScenePosRotInfo ScenePosRotInfoList = JsonConvert.DeserializeObject<ScenePosRotInfo>(message);
-                            PosRot = ScenePosRotInfoList;
-                            this.SendEvent(new GetReferencePosEvent() { PosRot = PosRot });
-                        }
-                    }
-                }
-            }
-        }
-    }
     #endregion
 }

+ 7 - 17
Assets/Scripts/Blue/Service/IUpOrDownloadService.cs

@@ -7,7 +7,6 @@ using System.Collections.Generic;
 using System.Text;
 using UnityEngine;
 using UnityEngine.Networking;
-using XRTool.Util;
 
 public interface IUpOrDownloadService : IService
 {
@@ -24,16 +23,12 @@ public class UpOrDownloadService : IUpOrDownloadService
 
     public void OnInit()
     {
-       // UrlPointCloudPosRot = "http://192.168.50.114:8888/mr-navigator/v1/project/position";
-        UrlPointCloudPosRot = "https://api-fat3.ghz-tech.com/mr-navigator/v1/project/position";
-
+        UrlPointCloudPosRot = "https://api-fat2.ghz-tech.com/mr-navigator/v1/project/position";
     }
 
     void IUpOrDownloadService.GetScenePosRot(int projectID)
     {
-      //  TimerMgr.Instance.CreateTimer(()=> {
         CoroutineSystem.Instance.StartCoroutine(GetScenePosRotRequest(projectID));
-     //   },3,-1);
     }
 
     void IUpOrDownloadService.UploadScenePosRot(string Url, string JsonString)
@@ -48,7 +43,7 @@ public class UpOrDownloadService : IUpOrDownloadService
             ProjectID = projectID;
             ScenePointBodyInfo TestGet = new ScenePointBodyInfo();
             TestGet.id = projectID;
-            TestGet.unity = false;
+            TestGet.unity = true;
             string jsonData = JsonConvert.SerializeObject(TestGet);
             byte[] bodyRaw = Encoding.UTF8.GetBytes(jsonData);
 
@@ -61,7 +56,7 @@ public class UpOrDownloadService : IUpOrDownloadService
             yield return webRequest.SendWebRequest();
 
             if (webRequest.result== UnityWebRequest.Result.ProtocolError || webRequest.result == UnityWebRequest.Result.ConnectionError)
-                Debug.LogError("UnityWebRequest Error:"+webRequest.downloadHandler.text);
+                Debug.LogError("UnityWebRequest Error:"+webRequest.error);
             else
             {
                 if (!string.IsNullOrWhiteSpace(webRequest.downloadHandler.text))
@@ -73,14 +68,9 @@ public class UpOrDownloadService : IUpOrDownloadService
                         message = jobject["data"].ToString();
                         if (!string.IsNullOrWhiteSpace(message))
                         {
-                           // TimerMgr.Instance.CreateTimer(() => {
-                                List<ScenePosRotInfo> ScenePosRotInfoList = JsonConvert.DeserializeObject<List<ScenePosRotInfo>>(message);
-
-                            //  GongShi2.F2Dto3D(ScenePosRotInfoList[0].x, ScenePosRotInfoList[0].y, 643f, 1920f, ScenePosRotInfoList[1].x, ScenePosRotInfoList[1].y, 51f, 17.1f);
-                            
-                                GongShi2.F2Dto3D(ScenePosRotInfoList[0].x, ScenePosRotInfoList[0].y, GameManager.Instance.WebMapSize.y, GameManager.Instance.WebMapSize.x, ScenePosRotInfoList[1].x, ScenePosRotInfoList[1].y, DataManager.Instance.CurrentScene.length, DataManager.Instance.CurrentScene.width);
-                 
-                         //  },0.03f,-1);
+                            List<ScenePosRotInfo> ScenePosRotInfoList = JsonConvert.DeserializeObject<List<ScenePosRotInfo>>(message);
+                            PosRot = ScenePosRotInfoList;
+                            this.TriggerEvent(new GetScenePosRotEvent() { PosRot = PosRot });
                         }
                     }
                 }
@@ -96,7 +86,7 @@ public class UpOrDownloadService : IUpOrDownloadService
             JsonData d2 = new JsonData();
             d2["position"] = data;
             d2["id"] = ProjectID;
-            d2["unity"] = false;
+            d2["unity"] = true;
             byte[] bodyRaw = Encoding.UTF8.GetBytes(d2.ToJson());
 
             webRequest.uploadHandler = (UploadHandler)new UploadHandlerRaw(bodyRaw);

+ 3 - 1
Assets/Scripts/Download/DownloadManager.cs

@@ -1,4 +1,4 @@
-using LitJson;
+using LitJson;
 using Newtonsoft.Json;
 using SC.XR.Unity;
 using System;
@@ -334,6 +334,8 @@ public class DownloadManager : SingletonMono<DownloadManager>
         }));
     }
 
+  //  private void ImageHandleMsg()
+
     /// <summary>
     /// 获取图片
     /// </summary>

+ 25 - 2
Assets/Scripts/LayoutTemplate/TemplateImage.cs

@@ -29,7 +29,15 @@ public class TemplateImage : BaseTemPlate
         base.OnEnable();
         if (GameManager.Instance.IsRuning && m_Image.sprite == null && Data != null)
         {
-            DownloadManager.Instance.GetImage(Data, m_Image);
+         //   DownloadManager.Instance.GetImage(Data, m_Image);
+
+            DownLoadMaterial data = new DownLoadMaterial();
+            data.downLoadPath = Data.downloadPath;
+            data.localLoadPath = Application.persistentDataPath + "/Material/" + Path.GetFileName(Data.downloadPath);
+            data.updataTime = GameManager.Instance.m_SceneValue.updateTime;
+            data.type = "1";
+            MsgHandler.AddListener(data.downLoadPath, HandleMsg);
+            DownloadResManager.Instance.DownLoad(data);
         }
     }
 
@@ -49,10 +57,25 @@ public class TemplateImage : BaseTemPlate
         }
         else
         {
-            DownloadManager.Instance.GetImage(Data, m_Image);
+            // DownloadManager.Instance.GetImage(Data, m_Image);
+            DownLoadMaterial data = new DownLoadMaterial();
+            data.downLoadPath = value.DownloadPath;
+            data.localLoadPath = Application.persistentDataPath + "/Material/" + Path.GetFileName(value.DownloadPath);
+            data.updataTime = GameManager.Instance.m_SceneValue.updateTime;
+            data.type = "1";
+            MsgHandler.AddListener(data.downLoadPath, HandleMsg);
+            DownloadResManager.Instance.DownLoad(data);
         }
     }
 
+    private void HandleMsg(Msg msg)
+    {
+        Texture2D texture = new Texture2D(1, 1);
+        texture.LoadImage((byte[])msg.Value);
+        Sprite sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.one * 0.5f);
+        m_Image.sprite = sprite;
+    }
+
     public void SetLocaImageData(MaterialObjValue value)
     {
         m_Image.sprite = ResMgr.Instance.Load<Sprite>(value.DownloadPath);

+ 15 - 1
Assets/Scripts/LayoutTemplate/TemplateModel.cs

@@ -171,7 +171,16 @@ public class TemplateModel : BaseTemPlate
         //下载列表中加入数据
         if (!GameManager.Instance.IsRuning)
         {
-            DownloadManager.Instance.AddDownloadData(Data);
+         //   DownloadManager.Instance.AddDownloadData(Data);
+
+
+            DownLoadMaterial data = new DownLoadMaterial();
+            data.downLoadPath = value.DownloadPath;
+            data.localLoadPath = Application.persistentDataPath + "/Material/" + Path.GetFileName(value.DownloadPath);
+            data.updataTime = GameManager.Instance.m_SceneValue.updateTime;
+            data.type = "3";
+
+            DownloadResManager.Instance.DownLoad(data);
             Debug.Log(" SetData " + updateTime);
         }
         else
@@ -198,6 +207,11 @@ public class TemplateModel : BaseTemPlate
         }
     }
   
+    //private void HandleMsg(Msg msg)
+    //{
+
+    //}
+
     public override void HideCollider()
     {
         base.HideCollider();

+ 8 - 11
Assets/Scripts/UI/LoginPanel.cs

@@ -259,11 +259,11 @@ public class LoginPanel : BaseUI
     /// </summary>
     private void OnClickLogin()
     {
+
 #if UNITY_EDITOR
-        m_AccountStr = "jiajun.hu@ghz-tech.com";
-        m_AccountStr = "Blue@163.com";
         m_AccountStr = "1768147286@qq.com";
-        m_PasswordStr = "123456Aa";
+        //m_AccountStr = "666666@qq.com";
+        //m_PasswordStr = "ghztech@402B";
 #endif
         if (string.IsNullOrWhiteSpace(m_AccountStr))
         {
@@ -382,17 +382,13 @@ public class LoginPanel : BaseUI
          
             if (int.Parse(jobect["data"]["type"].ToString()) == 0)
             {
-                Debug.Log("GetUserInfoCallBack 登录为2.0");
-                UserInfo.Instance.is20 = true; 
                 Debug.Log(jobect["data"]["type"].ToString());
-                StartCoroutine( LoginCallBack2YS(2));
+               StartCoroutine( LoginCallBack2YS(2));
             }
             else if (int.Parse(jobect["data"]["type"].ToString()) == 1)
             {
-                Debug.Log("GetUserInfoCallBack 登录为2.1");
-                UserInfo.Instance.is20 = false;
                 Debug.Log(jobect["data"]["type"].ToString());
-                StartCoroutine( LoginCallBackYS(2));
+               StartCoroutine( LoginCallBackYS(2));
             }
             else
                 return;
@@ -678,10 +674,11 @@ public class LoginPanel : BaseUI
 #if UNITY_EDITOR
         // m_AccountStr = "ghztest2@ghz-tech.com";
         // m_PasswordStr = "123456Aa";
-#endif
         m_AccountStr = "1768147286@qq.com";
-        //m_AccountStr = "jiajun.hu@ghz-tech.com";
+        m_AccountStr = "jiajun.hu@ghz-tech.com";
+        // m_AccountStr = "yhb_adv10@1.com";
         m_PasswordStr = "123456Aa";
+#endif
         if (!string.IsNullOrWhiteSpace(m_AccountStr) && !string.IsNullOrWhiteSpace(m_PasswordStr))
         {
             m_Account.text = m_AccountStr;

+ 1 - 1
Assets/TriLibXR.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: a6c03aeea9904b741bd23c52e941274a
+guid: df7d78516ebcf644daee07c45bf72f3d
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 1 - 1
Assets/YiYanPackage.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 5d0802fda8d90264a89aed163aba7593
+guid: eca438f11b825bc49862cba2395c9534
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 4 - 3
Packages/manifest.json

@@ -1,10 +1,12 @@
 {
   "dependencies": {
+    "com.ghz.avideoplayer": "https://gogs.ghz-tech.com:8843/GHzGlass/VideoPlayerXR.git",
     "com.ptc.vuforia.engine": "file:com.ptc.vuforia.engine-10.15.4.tgz",
     "com.unity.feature.development": "1.0.1",
     "com.unity.ide.rider": "3.0.18",
     "com.unity.ide.visualstudio": "2.0.17",
     "com.unity.ide.vscode": "1.2.5",
+    "com.unity.inputsystem": "1.7.0",
     "com.unity.test-framework": "1.1.33",
     "com.unity.textmeshpro": "3.0.6",
     "com.unity.timeline": "1.6.4",
@@ -15,11 +17,10 @@
     "com.unity.xr.arkit-face-tracking": "4.2.7",
     "com.unity.xr.interactionsubsystems": "1.0.1",
     "com.unity.xr.openxr": "1.5.3",
-    "com.ghz.avideoplayer": "https://gogs.ghz-tech.com:8843/GHzGlass/VideoPlayerXR.git",
     "jh.baseeditor.engine": "https://gogs.ghz-tech.com:8843/GHzGlass/GHZBasePackage.git",
-    "jh.xr.engine": "https://gogs.ghz-tech.com:8843/GHzGlass/GHZSDKXR.git#XRSDK_Nreal",
-    "jh.trilib.engine": "https://gogs.ghz-tech.com:8843/GHzGlass/TriLibXR.git",
     "jh.immersalsdk.engine": "https://gogs.ghz-tech.com:8843/GHzGlass/ImmersalSDK.git#ImmersalSDK_Nreal",
+    "jh.trilib.engine": "https://gogs.ghz-tech.com:8843/GHzGlass/TriLibXR.git",
+    "jh.xr.engine": "https://gogs.ghz-tech.com:8843/GHzGlass/GHZSDKXR.git#XRSDK_Nreal",
     "com.unity.modules.ai": "1.0.0",
     "com.unity.modules.androidjni": "1.0.0",
     "com.unity.modules.animation": "1.0.0",

+ 2 - 2
Packages/packages-lock.json

@@ -69,8 +69,8 @@
       "url": "https://packages.unity.cn"
     },
     "com.unity.inputsystem": {
-      "version": "1.4.4",
-      "depth": 1,
+      "version": "1.7.0",
+      "depth": 0,
       "source": "registry",
       "dependencies": {
         "com.unity.modules.uielements": "1.0.0"

+ 3 - 3
ProjectSettings/ProjectSettings.asset

@@ -927,7 +927,6 @@ PlayerSettings:
   metroSplashScreenUseBackgroundColor: 1
   platformCapabilities:
     WindowsStoreApps:
-      EnterpriseAuthentication: False
       OfflineMapsManagement: False
       HumanInterfaceDevice: False
       Location: False
@@ -939,6 +938,7 @@ PlayerSettings:
       PrivateNetworkClientServer: False
       InternetClientServer: False
       VideosLibrary: False
+      BackgroundMediaPlayback: False
       Objects3D: False
       RemoteSystem: False
       BlockedChatMessages: False
@@ -961,9 +961,9 @@ PlayerSettings:
       RecordedCallsFolder: False
       Contacts: False
       InternetClient: True
-      CodeGeneration: False
-      BackgroundMediaPlayback: False
       Proximity: False
+      CodeGeneration: False
+      EnterpriseAuthentication: False
   metroTargetDeviceFamilies:
     Desktop: False
     Holographic: False