Browse Source

将代码从其他类中移植出去,脱离关系

蓝色星空 1 year ago
parent
commit
ac4913cf81

+ 44 - 23
Assets/Prefab/BluePrefabs/BlueRoot.prefab

@@ -9,7 +9,6 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1004673916}
-  - component: {fileID: 1004673917}
   m_Layer: 0
   m_Name: DownloadPointFile
   m_TagString: Untagged
@@ -24,26 +23,14 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 1004673915}
-  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children: []
-  m_Father: {fileID: 5886227751517987777}
+  m_Father: {fileID: 4047458563064717630}
   m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
---- !u!114 &1004673917
-MonoBehaviour:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 1004673915}
-  m_Enabled: 1
-  m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: 5056337c45d1c474596bb345f15bd80d, type: 3}
-  m_Name: 
-  m_EditorClassIdentifier: 
 --- !u!1 &1691766441
 GameObject:
   m_ObjectHideFlags: 0
@@ -74,7 +61,7 @@ Transform:
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 5886227751517987777}
-  m_RootOrder: 3
+  m_RootOrder: 2
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!114 &4085329947062313590
 MonoBehaviour:
@@ -120,7 +107,7 @@ Transform:
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 5886227751517987777}
-  m_RootOrder: 4
+  m_RootOrder: 3
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!114 &5122960243441828857
 MonoBehaviour:
@@ -136,6 +123,39 @@ MonoBehaviour:
   m_EditorClassIdentifier: 
   moveGame: {fileID: 0}
   parent: {fileID: 0}
+--- !u!1 &811614693913846086
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 4047458563064717630}
+  m_Layer: 0
+  m_Name: Function
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &4047458563064717630
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 811614693913846086}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
+  m_Children:
+  - {fileID: 5192568582079240754}
+  - {fileID: 1004673916}
+  m_Father: {fileID: 5886227751517987777}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1 &3255320335503680843
 GameObject:
   m_ObjectHideFlags: 0
@@ -166,7 +186,7 @@ Transform:
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 5886227751517987777}
-  m_RootOrder: 2
+  m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!114 &1850852233735434126
 MonoBehaviour:
@@ -213,8 +233,7 @@ Transform:
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children:
-  - {fileID: 5192568582079240754}
-  - {fileID: 1004673916}
+  - {fileID: 4047458563064717630}
   - {fileID: 1263283691747613010}
   - {fileID: 1691766442}
   - {fileID: 3490034733957922214}
@@ -304,6 +323,7 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: adb4de7180662d949af04a42fcab6f67, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
+  MinMapCanvas: {fileID: 0}
 --- !u!1 &7412898482642897146
 GameObject:
   m_ObjectHideFlags: 0
@@ -348,6 +368,7 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 5e0751fcd7df98244a7c6a74f2074965, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
+  SetBtn: {fileID: 0}
 --- !u!1 &8366907603109842081
 GameObject:
   m_ObjectHideFlags: 0
@@ -378,7 +399,7 @@ Transform:
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 5886227751517987777}
-  m_RootOrder: 5
+  m_RootOrder: 4
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!114 &6071567358264610956
 MonoBehaviour:
@@ -423,7 +444,7 @@ Transform:
   - {fileID: 4142298729973525203}
   - {fileID: 252912846317535761}
   m_Father: {fileID: 5886227751517987777}
-  m_RootOrder: 6
+  m_RootOrder: 5
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1 &8893702449747549102
 GameObject:
@@ -454,7 +475,7 @@ Transform:
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children: []
-  m_Father: {fileID: 5886227751517987777}
+  m_Father: {fileID: 4047458563064717630}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!114 &5439870886630026804

+ 0 - 63
Assets/Scripts/Net/HttpTool.cs

@@ -81,69 +81,6 @@ public class HttpTool : MonoSingleton<HttpTool>
         }
     }
 
-    public void GetPoint(string methodName, Action<string> callback)
-    {
-        StartCoroutine(GetPointRequest(methodName, callback));
-    }
-    private IEnumerator GetPointRequest(string methodName, Action<string> callback)
-    {
-        string url = UrlPointCloud + methodName;
-        //Debug.Log("URL:"+url);
-        using (UnityWebRequest webRequest = UnityWebRequest.Get(url))
-        {
-            webRequest.SetRequestHeader("authorization", token);
-            //设置header
-            foreach (var v in requestHeader)
-            {
-                webRequest.SetRequestHeader(v.Key, v.Value);
-            }
-            yield return webRequest.SendWebRequest();
-
-            if (webRequest.isHttpError || webRequest.isNetworkError)
-            {
-                Debug.LogError(webRequest.error + "\n" + webRequest.downloadHandler.text);
-                if (callback != null)
-                {
-                    callback(null);
-                }
-            }
-            else
-            {
-                if (callback != null)
-                {
-                    callback(webRequest.downloadHandler.text);
-                }
-            }
-        }
-    }
-
-    public void GetPointFile(string methodName, string projectId, string fileType, Action<string> callback)
-    {
-        string url = UrlPointCloud + methodName;
-        // 创建URL
-        UriBuilder uriBuilder = new UriBuilder(url);
-        // 添加查询参数
-        uriBuilder.Query = "projectId=" + projectId + "&fileType=" + fileType;
-        // 创建UnityWebRequest
-        UnityWebRequest webRequest = UnityWebRequest.Get(uriBuilder.Uri);
-        webRequest.SetRequestHeader("Authorization", token);
-        // 发送请求
-        StartCoroutine(GetPointGetPointFileRequest(webRequest, callback));
-    }
-    private IEnumerator GetPointGetPointFileRequest(UnityWebRequest webRequest, Action<string> callback)
-    {
-        yield return webRequest.SendWebRequest();
-
-        if (webRequest.result != UnityWebRequest.Result.Success)
-        {
-            Debug.LogError("GetPointRequest failed: " + webRequest.error);
-        }
-        else
-        {
-            //Debug.LogError("GetPointRequest successful!");
-            callback?.Invoke(webRequest.downloadHandler.text);
-        }
-    }
     public void PostTest(string methodName, string jsonString, Action<string> CallBack)
     {
         StartCoroutine(PostRequestTest(methodName, jsonString, CallBack));

+ 1 - 1
Assets/Scripts/UI/AnchorEditorPanel/UIAnchorsPanel.cs

@@ -83,7 +83,7 @@ public class UIAnchorsPanel : UIPanelBase
             InstantiateCommand Command = new InstantiateCommand(
                 InstantiateSystem.Instance.BlueObject.WarningPopUp,
                 InstantiateSystem.Instance.BlueObject.NetErrorText);
-            CommandExtensionSystem.Instance.Send(Command);
+            CommandSystem.Instance.Send(Command);
             return;
         }
         Debug.Log("SaveCallBack:  " + message);

+ 1 - 1
Assets/Scripts/UI/EdirPanel/UIMaterialsPanel.cs

@@ -288,7 +288,7 @@ public class UIMaterialsPanel : UIPanelBase, EventObserver
             InstantiateCommand Command =new InstantiateCommand(
                 InstantiateSystem.Instance.BlueObject.WarningPopUp,
                 InstantiateSystem.Instance.BlueObject.NetErrorText);
-            CommandExtensionSystem.Instance.Send(Command);
+            CommandSystem.Instance.Send(Command);
             return;
         }
 

+ 0 - 1
Assets/Scripts/UI/GameManager.cs

@@ -204,7 +204,6 @@ public class GameManager : MonoSingleton<GameManager>
         set { m_AnchorChild = value; }
     }
 
-    public PointCouldAutoMatchController point; 
     private void Awake()
     {
         

+ 3 - 52
Assets/Scripts/UI/SceneChoose.cs

@@ -78,29 +78,9 @@ public class SceneChoose : BaseUI
             detail.id = m_CurrentData.id;
             string str = JsonConvert.SerializeObject(detail);
 
-
-            //获取账号下的点数据
-            HttpTool.Instance.GetPoint("/project/position/" + detail.id.ToString(), message =>
-             {
-                 if (!string.IsNullOrWhiteSpace(message))
-                 {
-                     JObject jobject = JObject.Parse(message);
-                     if (jobject["code"].ToString() == "200")
-                     {
-                         message = jobject["data"].ToString();
-                         if (!string.IsNullOrWhiteSpace(message))
-                         {
-                             List<PointJsonInfo> listScenesPage = JsonConvert.DeserializeObject<List<PointJsonInfo>>(message);
-                             this.SendCommand(new GetPointPosSuccessCommand(listScenesPage));
-                             return;
-                         }
-                     }
-                 }
-             });
-
-            DownLoadFile(detail.id,"json");
-            DownLoadFile(detail.id,"bytes");
-            GetScenePosRot(detail.id,"bytes");
+            this.SendCommand(new PointFileGetUrlCommand(detail.id, PointFileType.json));
+            this.SendCommand(new PointFileGetUrlCommand(detail.id, PointFileType.bytes));
+            this.SendCommand(new PointPosRotDownloadCommand(detail.id));
 
             HttpTool.Instance.PostTest("/project/detail", str, (mes) =>
             {
@@ -133,35 +113,6 @@ public class SceneChoose : BaseUI
         }
     }
 
-    private void DownLoadFile(int projectId,string fileType)
-    {
-        //获取账号下的点云文件数据
-        HttpTool.Instance.GetPointFile("/project/pointcloud", projectId.ToString(),fileType, message=>
-        {
-            if (!string.IsNullOrWhiteSpace(message))
-                {
-                    JObject jobject = JObject.Parse(message);
-                    if (jobject["code"].ToString() == "200")
-                    {
-                        message = jobject["data"].ToString();
-                        if (!string.IsNullOrWhiteSpace(message))
-                        {
-                            PointFileData PointFile = JsonConvert.DeserializeObject<PointFileData>(message);
-                            //Debug.LogError(PointFile.url);
-                            this.SendCommand<DownloadFileCommand>(new DownloadFileCommand(PointFile.url,fileType,projectId){});
-                        }
-                    }
-                }
-        });
-    }
-
-    private void GetScenePosRot(int projectId,string fileType)
-    {
-        string url = "https://api-fat1.ghz-tech.com/mr-navigator/v1/project/position";
-
-        this.SendCommand(new DownloadCommand(url,projectId));
-    }
-
     private void GetSNInit()
     {
         // 选择场景