Ver código fonte

提交修复bug

wartheking 1 dia atrás
pai
commit
d0b0ed8a06

+ 18 - 0
Assets/AIPagedLod/Scripts/WebGL/CameraBird.cs

@@ -29,6 +29,11 @@ public class CameraBird : MonoBehaviour
 
     bool onUI = false;
 
+    public Action OnCameraBeginChange;
+    public Action OnCameraEndChange;
+
+    private bool isChanging = false;
+
     public bool onScroll;
     float scrollCountDown = 0.5f;
     void Start()
@@ -175,8 +180,21 @@ public class CameraBird : MonoBehaviour
         this.Blink();
     }
 
+
     void Update()
     {
+        if (isRotate || isDragging || onScroll) {
+            if (!isChanging) {
+                isChanging = true;
+                OnCameraBeginChange?.Invoke();
+            }
+        }
+        else{
+            if (isChanging) {
+                isChanging = false;
+                OnCameraEndChange?.Invoke();
+            }
 
+        }
     }
 }

+ 1 - 1
Assets/Art/UI/YZT/B01/FQ/Materials/maps_h10ls@2x.mat

@@ -41,7 +41,7 @@ Material:
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
     - _MainTex:
-        m_Texture: {fileID: 2800000, guid: 32fc1eff25b52464585db0578b6a41af, type: 3}
+        m_Texture: {fileID: 2800000, guid: 1f8cedd8a33b2c94f96204e66ce53f6f, type: 3}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
     - _MetallicGlossMap:

+ 46 - 9
Assets/Prefabs/UI/Item/DevicesIcon.prefab

@@ -1,5 +1,44 @@
 %YAML 1.1
 %TAG !u! tag:unity3d.com,2011:
+--- !u!1 &1480552762465008014
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 5423408186911519283}
+  m_Layer: 5
+  m_Name: Root
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &5423408186911519283
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1480552762465008014}
+  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: 3852692801851589775}
+  - {fileID: 5949976977523710222}
+  - {fileID: 5199437906460888737}
+  m_Father: {fileID: 6018792256533632277}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 1, y: 1}
+  m_AnchoredPosition: {x: 0, y: 0}
+  m_SizeDelta: {x: 0, y: 0}
+  m_Pivot: {x: 0.5, y: 0.5}
 --- !u!1 &5026580704261802628
 GameObject:
   m_ObjectHideFlags: 0
@@ -25,12 +64,12 @@ RectTransform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 5026580704261802628}
-  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: 6018792256533632277}
+  m_Father: {fileID: 5423408186911519283}
   m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 0.5}
@@ -106,12 +145,12 @@ RectTransform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 5349183150760013211}
-  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: 6018792256533632277}
+  m_Father: {fileID: 5423408186911519283}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 0.5}
@@ -226,12 +265,12 @@ RectTransform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 5645363261452089401}
-  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: 6018792256533632277}
+  m_Father: {fileID: 5423408186911519283}
   m_RootOrder: 2
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 0.5}
@@ -310,9 +349,7 @@ RectTransform:
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children:
-  - {fileID: 3852692801851589775}
-  - {fileID: 5949976977523710222}
-  - {fileID: 5199437906460888737}
+  - {fileID: 5423408186911519283}
   m_Father: {fileID: 0}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

+ 42 - 5
Assets/Prefabs/UI/Item/obsIcon.prefab

@@ -125,8 +125,7 @@ RectTransform:
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children:
-  - {fileID: 2027052951324185546}
-  - {fileID: 8693264001334891580}
+  - {fileID: 1448223556320741065}
   m_Father: {fileID: 0}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -193,13 +192,13 @@ RectTransform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 5515461222174838467}
-  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:
   - {fileID: 2407755667622512913}
-  m_Father: {fileID: 4631781281010837161}
+  m_Father: {fileID: 1448223556320741065}
   m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
@@ -285,6 +284,44 @@ MonoBehaviour:
   m_ChildScaleWidth: 1
   m_ChildScaleHeight: 1
   m_ReverseArrangement: 0
+--- !u!1 &6060978376918982434
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 1448223556320741065}
+  m_Layer: 5
+  m_Name: Root
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &1448223556320741065
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 6060978376918982434}
+  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: 2027052951324185546}
+  - {fileID: 8693264001334891580}
+  m_Father: {fileID: 4631781281010837161}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 1, y: 1}
+  m_AnchoredPosition: {x: 0, y: 0}
+  m_SizeDelta: {x: 0, y: 0}
+  m_Pivot: {x: 0.5, y: 0.5}
 --- !u!1 &8445803138219866511
 GameObject:
   m_ObjectHideFlags: 0
@@ -317,7 +354,7 @@ RectTransform:
   m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 4742984429411117486}
-  m_Father: {fileID: 4631781281010837161}
+  m_Father: {fileID: 1448223556320741065}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 0.5}

Diferenças do arquivo suprimidas por serem muito extensas
+ 302 - 426
Assets/Scene 1.unity


+ 32 - 12
Assets/Scripts/UI/Item/DeviceIconCtrl.cs

@@ -30,10 +30,14 @@ public class DeviceIconCtrl : MonoBehaviour
     public Sprite erXiangCeFengJiIcon;
     public Sprite weiYiJiIcon;
 
+    private float currentTime = 0.0f;
     
     public void Init(DeviceIconData data)
     {
         _camera = CameraManager.instance.mainCamera;
+        _camera.GetComponent<CameraBird>().OnCameraBeginChange += CameraBeginChange;
+        _camera.GetComponent<CameraBird>().OnCameraEndChange += CameraEndChange;
+
         _data = data;
         targetTransForm = data.targetTransform;
         
@@ -41,7 +45,7 @@ public class DeviceIconCtrl : MonoBehaviour
         
         rect.anchoredPosition = new Vector2(2000, 0);
 
-        iconImg = this.transform.Find("bg").GetComponent<Image>();
+        iconImg = this.transform.Find("Root").Find("bg").GetComponent<Image>();
         switch (_data.type)
         {
             case GongChengType.shuiWei:
@@ -78,9 +82,9 @@ public class DeviceIconCtrl : MonoBehaviour
                 iconImg.sprite = weiYiJiIcon;
                 break;
         }
-        nameText = this.transform.Find("nameText").GetComponent<Text>();
+        nameText = this.transform.Find("Root").Find("nameText").GetComponent<Text>();
         nameText.text = $"{_data.name}";
-        valueText = this.transform.Find("valueText").GetComponent<Text>();
+        valueText = this.transform.Find("Root").Find("valueText").GetComponent<Text>();
         valueText.text = $"{_data.value} <size=12><color=FFFFFF>{_data.valueType}</color></size>";
         
         _Button.onClick.AddListener(() =>
@@ -88,20 +92,36 @@ public class DeviceIconCtrl : MonoBehaviour
             GCJKLayer._Instance.OpenDeviceTrendPanel(_data.name,_data.type,_data.gid,_data.sid);
         });
     }
-    
+
+    // 分离的委托方法,便于解除绑定
+    private void CameraBeginChange()
+    {
+        this.transform.Find("Root").gameObject.SetActive(false);
+    }
+
+    private void CameraEndChange()
+    {
+        this.transform.Find("Root").gameObject.SetActive(true);
+    }
+
+    // 在物体销毁前调用这个方法来解除绑定
+    private void OnDestroy()
+    {
+        _camera.GetComponent<CameraBird>().OnCameraBeginChange -= CameraBeginChange;
+        _camera.GetComponent<CameraBird>().OnCameraEndChange -= CameraEndChange;
+    }
+
     void Update()
     {
-        if (targetTransForm != null)
-        {
-            if (IsObjectInCameraView(targetTransForm, _camera))
-            {
-                rect.transform.position=_camera.WorldToScreenPoint(targetTransForm.position);
-            }
-            else
+        currentTime += Time.deltaTime;
+        if (currentTime > 0.06f) {
+            if (targetTransForm != null)
             {
-                rect.transform.position = new Vector3(2000, 0, 0);
+                rect.transform.position = _camera.WorldToScreenPoint(targetTransForm.position);
             }
+            currentTime = 0;
         }
+        
     }
     
     bool IsObjectInCameraView(Transform objectTransform, Camera camera)

+ 29 - 14
Assets/Scripts/UI/Item/ObsIconCtrl.cs

@@ -18,6 +18,8 @@ public class ObsIconCtrl : MonoBehaviour,IPointerEnterHandler,IPointerExitHandle
     public GameObject tint;
 
     public Text tintName;
+
+    private float currentTime = 0.0f;
     public void Init(ObsData data)
     {
         _data = data;
@@ -26,12 +28,12 @@ public class ObsIconCtrl : MonoBehaviour,IPointerEnterHandler,IPointerExitHandle
         
 
         rect = this.GetComponent<RectTransform>();
-        _button = this.transform.Find("Icon").GetComponent<UnityEngine.UI.Button>();
+        _button = this.transform.Find("Root").Find("Icon").GetComponent<UnityEngine.UI.Button>();
 
         if (!data.status)
         {
-            this.transform.Find("Icon").GetComponent<UnityEngine.UI.Image>().color = Color.red;
-            this.transform.Find("Icon").GetChild(0).GetComponent<UnityEngine.UI.Image>().color = Color.red;
+            this.transform.Find("Root").Find("Icon").GetComponent<UnityEngine.UI.Image>().color = Color.red;
+            this.transform.Find("Root").Find("Icon").GetChild(0).GetComponent<UnityEngine.UI.Image>().color = Color.red;
         }
         else
         {
@@ -51,8 +53,9 @@ public class ObsIconCtrl : MonoBehaviour,IPointerEnterHandler,IPointerExitHandle
         
         rect.anchoredPosition = new Vector2(2000, 0);
         _camera = CameraManager.instance.mainCamera;
-        
-        targetTransForm=StaticLod.instance.GetStaticObj(_data.targetName).transform;
+        _camera.GetComponent<CameraBird>().OnCameraBeginChange += CameraBeginChange;
+        _camera.GetComponent<CameraBird>().OnCameraEndChange += CameraEndChange;
+        targetTransForm =StaticLod.instance.GetStaticObj(_data.targetName).transform;
 
         
     }
@@ -61,17 +64,29 @@ public class ObsIconCtrl : MonoBehaviour,IPointerEnterHandler,IPointerExitHandle
     {
         if (targetTransForm != null)
         {
-            if (IsObjectInCameraView(targetTransForm, _camera))
-            {
-                rect.transform.position=_camera.WorldToScreenPoint(targetTransForm.position);
-            }
-            else
-            {
-                rect.transform.position = new Vector3(2000, 0, 0);
-            }
+            rect.transform.position = _camera.WorldToScreenPoint(targetTransForm.position);
         }
     }
-    
+
+    // 分离的委托方法,便于解除绑定
+    private void CameraBeginChange()
+    {
+        this.transform.Find("Root").gameObject.SetActive(false);
+    }
+
+    private void CameraEndChange()
+    {
+        this.transform.Find("Root").gameObject.SetActive(true);
+    }
+
+    // 在物体销毁前调用这个方法来解除绑定
+    private void OnDestroy()
+    {
+        _camera.GetComponent<CameraBird>().OnCameraBeginChange -= CameraBeginChange;
+        _camera.GetComponent<CameraBird>().OnCameraEndChange -= CameraEndChange;
+    }
+
+
     bool IsObjectInCameraView(Transform objectTransform, Camera camera)
     {
         Vector3 objectScreenPosition = camera.WorldToScreenPoint(objectTransform.position);

+ 1 - 1
Assets/Scripts/UI/UIView/GCJK/GCJKLayer.cs

@@ -1643,7 +1643,7 @@ public class GCJKLayer : YZTRootLayer
         gongChengPanel.SetActive(true);
         zhaZhanMingCheng.text = itemData.name;
         var floorGateData = currentDataType == 0 ? GlobalData.floorGateData.buYuan : GlobalData.floorGateData.taoKou;
-        zhaMenKaiDu.text = $"{floorGateData[_index].opening_degree:0.00}<size=14><color=#A5BFE2>%</color></size>";
+        zhaMenKaiDu.text = $"{floorGateData[_index].opening_degree:0.00}<size=14><color=#A5BFE2>m</color></size>";
 
         guoZhaLiuLiang.text = $"-<size=14><color=#A5BFE2>m\u00b3/s</color></size>";
 

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff