From abed4a23f191b618c6f5977eaa0c18db4280e749 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 9 Jan 2025 09:00:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=A7=BB=E5=8A=A8=E5=90=8E?= =?UTF-8?q?=20=E8=A7=86=E8=A7=92=E8=87=AA=E5=8A=A8=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Art/UIPrefab/UICameraSwitch.prefab | 6 +++--- Assets/Scripts/UI/UICameraSwitch.cs | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Assets/Art/UIPrefab/UICameraSwitch.prefab b/Assets/Art/UIPrefab/UICameraSwitch.prefab index 92fbe6e1..d287323b 100644 --- a/Assets/Art/UIPrefab/UICameraSwitch.prefab +++ b/Assets/Art/UIPrefab/UICameraSwitch.prefab @@ -17,7 +17,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &3411569463940388114 RectTransform: m_ObjectHideFlags: 0 @@ -226,7 +226,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &7775706862032139777 RectTransform: m_ObjectHideFlags: 0 @@ -826,7 +826,7 @@ MonoBehaviour: onValueChanged: m_PersistentCalls: m_Calls: [] - m_IsOn: 1 + m_IsOn: 0 --- !u!1 &8974889932437628810 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/UI/UICameraSwitch.cs b/Assets/Scripts/UI/UICameraSwitch.cs index dd2893cf..045681dd 100644 --- a/Assets/Scripts/UI/UICameraSwitch.cs +++ b/Assets/Scripts/UI/UICameraSwitch.cs @@ -33,7 +33,7 @@ namespace QFramework.Example Near.transform.Find("Bg/Line").gameObject.SetActive(isOn); }); Far.onValueChanged.AddListener(isOn => - { + { if (isOn) { SetNormal(); @@ -68,6 +68,21 @@ namespace QFramework.Example } } + private void Update() + { +#if UNITY_STANDALONE_WIN + if (Near.isOn == true || Far.isOn == true) + { + if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D)) + { + Near.isOn = false; + Far.isOn = false; + } + } + +#endif + } + protected override void OnShow() { }