Browse Source

修改关联闸门开度数据到模型

Void_F 7 months ago
parent
commit
88055c17b5

+ 69 - 6
Assets/Art/Prefab/Buildings/BuYuan_ShiNei.prefab

@@ -31,7 +31,7 @@ Transform:
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children:
-  - {fileID: 1836226784703844511}
+  - {fileID: 5923163603117100730}
   m_Father: {fileID: 0}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: -90, y: 0, z: 180}
@@ -94,25 +94,88 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   moveModelName: ZhaMen
-  oriV3: {x: -1.666016, y: -2.4, z: 6.5}
-  targetV3: {x: -1.666016, y: -2.4, z: 16.5}
+  objectCount: 14
   speed: 1
   aniType: 0
---- !u!1001 &7163127533927766879
+--- !u!1001 &2891401018980975994
 PrefabInstance:
   m_ObjectHideFlags: 0
   serializedVersion: 2
   m_Modification:
     m_TransformParent: {fileID: 8404428449182255607}
     m_Modifications:
+    - target: {fileID: 906460733905944895, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_LocalPosition.x
+      value: 329.45
+      objectReference: {fileID: 0}
+    - target: {fileID: 906460733905944895, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_LocalPosition.y
+      value: -10.45
+      objectReference: {fileID: 0}
+    - target: {fileID: 906460733905944895, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_LocalPosition.z
+      value: -2.97
+      objectReference: {fileID: 0}
+    - target: {fileID: 1502535993475158920, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_Enabled
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 2104638354118742436, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_LocalPosition.x
+      value: 329.45
+      objectReference: {fileID: 0}
+    - target: {fileID: 2104638354118742436, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_LocalPosition.y
+      value: -1.54
+      objectReference: {fileID: 0}
+    - target: {fileID: 2104638354118742436, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_LocalPosition.z
+      value: -2.97
+      objectReference: {fileID: 0}
+    - target: {fileID: 4354287880637744367, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_Enabled
+      value: 0
+      objectReference: {fileID: 0}
     - target: {fileID: 4496899257497986419, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
       propertyPath: m_Parameters.textureMode
       value: 3
       objectReference: {fileID: 0}
+    - target: {fileID: 4556425160177927787, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_Enabled
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 5824030983035300970, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_Enabled
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 6479114625718222780, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_LocalPosition.x
+      value: 315.7
+      objectReference: {fileID: 0}
+    - target: {fileID: 6479114625718222780, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_LocalPosition.y
+      value: 0.01
+      objectReference: {fileID: 0}
+    - target: {fileID: 6479114625718222780, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_LocalPosition.z
+      value: -2.97
+      objectReference: {fileID: 0}
     - target: {fileID: 6646519964417813596, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
       propertyPath: m_Name
       value: CheckPathTool
       objectReference: {fileID: 0}
+    - target: {fileID: 8520383457342634186, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_LocalPosition.x
+      value: -343.1
+      objectReference: {fileID: 0}
+    - target: {fileID: 8520383457342634186, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_LocalPosition.y
+      value: -10.45
+      objectReference: {fileID: 0}
+    - target: {fileID: 8520383457342634186, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
+      propertyPath: m_LocalPosition.z
+      value: -2.97
+      objectReference: {fileID: 0}
     - target: {fileID: 8796405293740264384, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
       propertyPath: m_RootOrder
       value: 0
@@ -159,8 +222,8 @@ PrefabInstance:
       objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
---- !u!4 &1836226784703844511 stripped
+--- !u!4 &5923163603117100730 stripped
 Transform:
   m_CorrespondingSourceObject: {fileID: 8796405293740264384, guid: 72a7ce1ede15b3a43bca6e61ff2dafea, type: 3}
-  m_PrefabInstance: {fileID: 7163127533927766879}
+  m_PrefabInstance: {fileID: 2891401018980975994}
   m_PrefabAsset: {fileID: 0}

+ 1 - 2
Assets/Art/Prefab/Buildings/TaoKou_ShiNei.prefab

@@ -94,8 +94,7 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   moveModelName: ZhaMen
-  oriV3: {x: 0, y: 0, z: 0}
-  targetV3: {x: -45, y: 0, z: 0}
+  objectCount: 24
   speed: 1
   aniType: 1
 --- !u!1001 &7246725413754811816

+ 61 - 25
Assets/ModelAniTool.cs

@@ -7,60 +7,96 @@ using UnityEngine.Serialization;
 
 public enum AniType
 {
-    move,
-    rota
+    buYuan,
+    taoKou
 }
 
 public class ModelAniTool : MonoBehaviour
 {
     public string moveModelName;
-
-    [FormerlySerializedAs("oriPos")] public Vector3 oriV3;
-
-    [FormerlySerializedAs("targetPos")] public Vector3 targetV3;
-
+    public int objectCount=0;
+    private Vector3[] oriV3;
+    
     public float speed=2.0f;
 
-    private GameObject targetObj;
+    private GameObject[] targetObjs;
 
     public AniType aniType;
-    
+
+    private float[] openValues;
     
     public void FindObje()
     {
-        targetObj = this.transform.Find(moveModelName+"(Clone)").gameObject;
+        targetObjs = new GameObject[objectCount];
+        oriV3 = new Vector3[objectCount];
+        for (int i = 0; i < objectCount; i++)
+        {
+            targetObjs[i] = this.transform.Find(moveModelName+"(Clone)").GetChild(i).gameObject;
+            switch (aniType)
+            {
+                case AniType.buYuan:
+                    oriV3[i] = targetObjs[i].transform.localPosition;
+                    break;
+                case AniType.taoKou:
+                    oriV3[i] = targetObjs[i].transform.localEulerAngles;
+                    break;
+            }
+        }
         ActionInstance._Instance.ModelAni_On += Ani_On;
         ActionInstance._Instance.ModelAni_Off += Ani_Off;
     }
 
-    public void Ani_On()
+    public void Ani_On(float[] v3s)
     {
+        if (v3s == null)
+        {
+            v3s = new float[targetObjs.Length];
+            for (int i = 0; i < v3s.Length; i++)
+            {
+                v3s[i] = 1;
+            }
+        }
+        openValues = v3s;
         switch (aniType)
         {
-            case AniType.move:
-                targetObj.transform.localPosition = oriV3;
-                targetObj.transform.DOLocalMove(targetV3, speed);
+            case AniType.buYuan:
+                for (int i = 0; i < targetObjs.Length; i++)
+                {
+                    int tempIndex = i;
+                    targetObjs[i].transform.localPosition = oriV3[tempIndex];
+                    targetObjs[i].transform.DOLocalMoveY(8*openValues[tempIndex], speed);
+                }
                 break;
-            case AniType.rota:
-                targetObj.transform.localEulerAngles = oriV3;
-                targetObj.transform.DOLocalRotate(targetV3, speed);
+            case AniType.taoKou:
+                for (int i = 0; i < targetObjs.Length; i++)
+                {
+                    int tempIndex = i;
+                    targetObjs[i].transform.localEulerAngles = oriV3[tempIndex];
+                    targetObjs[i].transform.DOLocalRotate(new Vector3(-45.0f,0,0) *openValues[tempIndex], speed);
+                }
                 break;
-       
         }
-    
     }
 
     public void Ani_Off()
     {
         switch (aniType)
         {
-            case AniType.move:
-                targetObj.transform.localPosition = targetV3;
-                targetObj.transform.DOLocalMove(oriV3, speed);
+            case AniType.buYuan:
+                for (int i = 0; i < targetObjs.Length; i++)
+                {
+                    int tempIndex = i;
+                    targetObjs[i].transform.localPosition = oriV3[tempIndex] + new Vector3(0, 0, 8);
+                    targetObjs[i].transform.DOLocalMoveY(0, speed);
+                }
                 break;
-            case AniType.rota:
-                targetObj.transform.localEulerAngles = targetV3;
-                targetObj.transform.DOLocalRotate(oriV3, speed);
+            case AniType.taoKou:
+                for (int i = 0; i < targetObjs.Length; i++)
+                {
+                    int tempIndex = i;
+                    targetObjs[i].transform.localEulerAngles = new Vector3(-45.0f,0,0)*openValues[tempIndex];
+                    targetObjs[i].transform.DOLocalRotate(Vector3.zero, speed);
+                }
                 break;
         }
     }

File diff suppressed because it is too large
+ 1 - 103
Assets/Scene 1.unity


+ 1 - 1
Assets/Scripts/ActionInstance.cs

@@ -9,7 +9,7 @@ public class ActionInstance : MonoBehaviour
 
     public Action<string> obsFmUpdata;
 
-    public Action ModelAni_On;
+    public Action<float[]> ModelAni_On;
     public Action ModelAni_Off;
 
     public Action<bool> SetCheckPathActive;

+ 5 - 0
Assets/Scripts/UI/Data/GlobalData.cs

@@ -88,6 +88,11 @@ public class GlobalData
     /// </summary>
     public static SensorDataResult buYuanSensorData;
     
+    /// <summary>
+    /// 套口闸门信息
+    /// </summary>
+    public static SensorDataResult taoKouSensorData;
+    
     /// <summary>
     /// 补元水压计数据
     /// </summary>

+ 21 - 1
Assets/Scripts/UI/UIView/3D/GCZLLayer.cs

@@ -150,7 +150,27 @@ public class GCZLLayer : MonoBehaviour
         downloadPdfButton.onClick.AddListener(DownLoadPDF);
         
         OpenAniButton = DetailPanel.transform.Find("OpenAniButton").GetComponent<Button>();
-        OpenAniButton.onClick.AddListener(() => { ActionInstance._Instance.ModelAni_On?.Invoke(); });
+        OpenAniButton.onClick.AddListener(() =>
+        {
+            float[] openValues=new float[1];
+            if (currentData.name_pri.Equals("BuYuan"))
+            {
+                openValues=new float[GlobalData.buYuanSensorData.data.Count];
+                for (int i = 0; i < openValues.Length; i++)
+                {
+                    openValues[i] = GlobalData.buYuanSensorData.data[i].gate_open ? 1.0f : 0.0f;
+                }
+            }
+            if (currentData.name_pri.Equals("TaoKou"))
+            {
+                openValues=new float[GlobalData.taoKouSensorData.data.Count];
+                for (int i = 0; i < openValues.Length; i++)
+                {
+                    openValues[i] = GlobalData.taoKouSensorData.data[i].gate_open ? 1.0f : 0.0f;
+                }
+            }
+            ActionInstance._Instance.ModelAni_On?.Invoke(openValues);
+        });
         CloseAniButton = DetailPanel.transform.Find("CloseAniButton").GetComponent<Button>();
         CloseAniButton.onClick.AddListener(() => { ActionInstance._Instance.ModelAni_Off?.Invoke(); });
 

+ 1 - 1
Assets/Scripts/UI/UIView/XHDD/XHDDLayer.cs

@@ -472,7 +472,7 @@ public class XHDDLayer : YZTRootLayer
                     return;
                 }
                 StaticLod.instance.OnFoucusStatic("Bird4");
-                ActionInstance._Instance.ModelAni_On?.Invoke();
+                ActionInstance._Instance.ModelAni_On?.Invoke(null);
                 await new WaitUntil(() =>
                 {
                     return currentTime > 5.2;

Some files were not shown because too many files changed in this diff