From c9786484cc500c4ad9027825fab8081e54db09d5 Mon Sep 17 00:00:00 2001 From: YDL <1368269699@qq.com> Date: Wed, 17 Apr 2024 09:08:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AA=E7=83=81=E8=84=9A=E6=9C=AC=E5=9B=A0?= =?UTF-8?q?=E7=89=A9=E4=BD=93=E9=9A=90=E8=97=8F=E4=B8=8D=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/ANet/DeviceFollowTarget.cs | 12 ++++++++---- Assets/Scripts/ANet/DeviceLumos.cs | 4 ++-- Assets/Scripts/ANet/DeviceObj.cs | 6 +++++- Assets/Scripts/Lumos.cs | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Assets/Scripts/ANet/DeviceFollowTarget.cs b/Assets/Scripts/ANet/DeviceFollowTarget.cs index 8267513..beaf7c0 100644 --- a/Assets/Scripts/ANet/DeviceFollowTarget.cs +++ b/Assets/Scripts/ANet/DeviceFollowTarget.cs @@ -19,8 +19,6 @@ public class DeviceFollowTarget : MonoBehaviour } public void ViewClick() { - MessageDispatcher.SendMessage("FLOORNUMBER", target.GetComponent<DeviceObj>().floorId, "Floor"); - Camera.main.GetComponent<CameraOrbit>().SetCameraView(target.position, 15); if (target && target.GetComponent<DeviceObj>()) { @@ -41,7 +39,13 @@ public class DeviceFollowTarget : MonoBehaviour RectTransformUtility.ScreenPointToLocalPointInRectangle(transform.parent.GetComponent<RectTransform>(), world2ScreenPos, uiCamera, out uiPos); return uiPos; } - + private void OnDisable() + { + if (GetComponent<DeviceLumos>()) + { + DestroyImmediate(GetComponent<DeviceLumos>()); + } + } private void LateUpdate() { if (gameObject.activeSelf && target) @@ -53,7 +57,7 @@ public class DeviceFollowTarget : MonoBehaviour { if (target && DevicePanelManager.Instance.NowClickObject != target.GetComponent<DeviceObj>()) { - Destroy(GetComponent<DeviceLumos>()); + DestroyImmediate(GetComponent<DeviceLumos>()); } } } diff --git a/Assets/Scripts/ANet/DeviceLumos.cs b/Assets/Scripts/ANet/DeviceLumos.cs index 28fca04..2e834cc 100644 --- a/Assets/Scripts/ANet/DeviceLumos.cs +++ b/Assets/Scripts/ANet/DeviceLumos.cs @@ -9,7 +9,7 @@ public class DeviceLumos : MonoBehaviour private float time; private bool LumosReady; - public float Interval = 0.3f; + private float Interval = 0.5f; private void Awake() { @@ -21,7 +21,7 @@ public class DeviceLumos : MonoBehaviour else if (GetComponent<Image>()) { NormalColor = GetComponent<Image>().color; - TargetColor = Color.green; + TargetColor = Color.blue; } } private void LateUpdate() diff --git a/Assets/Scripts/ANet/DeviceObj.cs b/Assets/Scripts/ANet/DeviceObj.cs index f341366..955d5b3 100644 --- a/Assets/Scripts/ANet/DeviceObj.cs +++ b/Assets/Scripts/ANet/DeviceObj.cs @@ -74,7 +74,7 @@ public class DeviceObj : MonoBehaviour { if (DevicePanelManager.Instance.NowClickObject != this) { - Destroy(GetComponent<DeviceLumos>()); + DestroyImmediate(GetComponent<DeviceLumos>()); } } //if (BindType == DevicePanelManager.Instance.MenuType) @@ -102,6 +102,10 @@ public class DeviceObj : MonoBehaviour { tIconObj.GetComponent<DeviceFollowTarget>().ViewClick(); } + else + { + DevicePanelManager.Instance.NowClickObject = null; + } } public void CreateIcon(DeviceType type, int floorId) { diff --git a/Assets/Scripts/Lumos.cs b/Assets/Scripts/Lumos.cs index 1d06c0d..84d4c1b 100644 --- a/Assets/Scripts/Lumos.cs +++ b/Assets/Scripts/Lumos.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using UniRx; public class Lumos : MonoBehaviour {