From 292e1f0a3d33eca542c78404b3aa6759159a1fdc Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Tue, 25 Mar 2025 13:23:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=81=E5=B1=8F=E5=8F=8A?= =?UTF-8?q?=E5=8F=91=E5=8C=85=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scenes/Main.unity | 2 +- Assets/Scripts/Event/EventEx.cs | 4 ++++ Assets/Scripts/Item/ObjectToggle.cs | 17 +++++++++++++++++ Assets/Scripts/Item/Show3DCamera.cs | 7 +++++++ Assets/Scripts/UI/UIBody3D.cs | 2 +- ProjectSettings/GraphicsSettings.asset | 1 + 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 8f27026f..89bfe170 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -1329,7 +1329,7 @@ MonoBehaviour: rotateSpeed: 10 moveSpeed: 0.1 distance: 2 - distanceMin: 1 + distanceMin: 0.5 distanceMax: 15 pitchMinMax: {x: -80, y: 80} texture: {fileID: 8400000, guid: 187fba8368491cb428c8cbd324fa9bb4, type: 2} diff --git a/Assets/Scripts/Event/EventEx.cs b/Assets/Scripts/Event/EventEx.cs index 6c77c517..dae3ce7d 100644 --- a/Assets/Scripts/Event/EventEx.cs +++ b/Assets/Scripts/Event/EventEx.cs @@ -15,3 +15,7 @@ struct EndScreenShot { } +struct OnLock +{ + public bool isLock; +} \ No newline at end of file diff --git a/Assets/Scripts/Item/ObjectToggle.cs b/Assets/Scripts/Item/ObjectToggle.cs index 856b5e8e..f7374a6b 100644 --- a/Assets/Scripts/Item/ObjectToggle.cs +++ b/Assets/Scripts/Item/ObjectToggle.cs @@ -1,3 +1,4 @@ +using QFramework; using System; using System.Collections; using System.Collections.Generic; @@ -11,8 +12,23 @@ public class ObjectToggle : MonoBehaviour public UnityEvent OnValueChanged = new UnityEvent(); private float mouseDownTime; private bool isMouseDown; + bool isLock = false; + private void Awake() + { + TypeEventSystem.Global.Register(OnLockEvent).UnRegisterWhenDisabled(this); + } + + private void OnLockEvent(OnLock islock) + { + this.isLock = islock.isLock; + } + private void OnMouseDown() { + if (isLock == true) + { + return; + } // ¼갴µʱ mouseDownTime = Time.time; isMouseDown = true; @@ -44,4 +60,5 @@ public class ObjectToggle : MonoBehaviour this.isOn = isOn; OnValueChanged?.Invoke(isOn); } + } diff --git a/Assets/Scripts/Item/Show3DCamera.cs b/Assets/Scripts/Item/Show3DCamera.cs index f18b4a03..b2a5cafd 100644 --- a/Assets/Scripts/Item/Show3DCamera.cs +++ b/Assets/Scripts/Item/Show3DCamera.cs @@ -1,4 +1,6 @@ using DG.Tweening; +using QFramework; +using System; using UnityEngine; using UnityEngine.EventSystems; @@ -47,8 +49,13 @@ public class Show3DCamera : MonoBehaviour self = transform.GetComponent(); DontDestroyOnLoad(this); gameObject.SetActive(false); + TypeEventSystem.Global.Register(OnLockEvent).UnRegisterWhenDisabled(this); } + private void OnLockEvent(OnLock islock) + { + this.lockMove = islock.isLock; + } public void Set(Transform target, float rotateSpeed = 10, float moveSpeed = 0.1f, float distance = 0.1f, float pitchMin = -20, float pitchMax = 80, float distanceMin = 0.2f, float distanceMax = 20f, RectTransform inputRect = null, bool isRenderTexture = true, float moveTime = -1) { diff --git a/Assets/Scripts/UI/UIBody3D.cs b/Assets/Scripts/UI/UIBody3D.cs index 57b70533..e37a221f 100644 --- a/Assets/Scripts/UI/UIBody3D.cs +++ b/Assets/Scripts/UI/UIBody3D.cs @@ -233,7 +233,7 @@ namespace QFramework.Example LockMode.transform.Find("Label").GetComponent().text = "Ļ"; LockMode.transform.Find("Label").GetComponent().color = new Color(74f / 255f, 91f / 255f, 116f / 255f); } - Show3DCamera.instance.lockMove = isOn; + TypeEventSystem.Global.Send(new OnLock() { isLock = isOn }); }); diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index f72acb40..d4505c0a 100644 --- a/ProjectSettings/GraphicsSettings.asset +++ b/ProjectSettings/GraphicsSettings.asset @@ -37,6 +37,7 @@ GraphicsSettings: - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 4800000, guid: c8b5bc66eaa9c574cb2bfefd127c88b9, type: 3} m_PreloadedShaders: [] m_PreloadShadersBatchTimeLimit: -1 m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}