From 788e8d72b52e68e03633c9954d68c20c3274ba98 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Tue, 11 Mar 2025 10:33:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E9=80=80=E5=87=BA=E4=BA=8B=E4=BB=B6=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UI/UIBody3D.cs | 5 +++++ Assets/Scripts/UI/UIBody3DInfo.cs | 6 ++++++ Assets/Scripts/UI/UIBody3DMenuTree.cs | 7 ++++++- Assets/Scripts/UI/UIBody3DMouse.cs | 6 ++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/UI/UIBody3D.cs b/Assets/Scripts/UI/UIBody3D.cs index d671c128..964e01b1 100644 --- a/Assets/Scripts/UI/UIBody3D.cs +++ b/Assets/Scripts/UI/UIBody3D.cs @@ -57,6 +57,7 @@ namespace QFramework.Example Dictionary bodyListIndex = new Dictionary(); protected override void OnInit(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnModuleQuithandler).UnRegisterWhenGameObjectDestroyed(this); DragBtn.onValueChanged.AddListener(isOn => { DragBtn.transform.Find("SubBtns").gameObject.SetActive(isOn); @@ -146,6 +147,10 @@ namespace QFramework.Example }); } + private void OnModuleQuithandler(OnModuleQuit quit) + { + Hide(); + } private void OnUIDrawClose() { diff --git a/Assets/Scripts/UI/UIBody3DInfo.cs b/Assets/Scripts/UI/UIBody3DInfo.cs index 14892a76..1d40613f 100644 --- a/Assets/Scripts/UI/UIBody3DInfo.cs +++ b/Assets/Scripts/UI/UIBody3DInfo.cs @@ -18,6 +18,7 @@ namespace QFramework.Example float bgH; protected override void OnInit(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnModuleQuithandler).UnRegisterWhenGameObjectDestroyed(this); bgH = Content.sizeDelta.y; Group.onValueChanged.AddListener(isOn => { @@ -122,6 +123,11 @@ namespace QFramework.Example } + private void OnModuleQuithandler(OnModuleQuit quit) + { + Hide(); + } + public void RefreshTipPath() { ListContent.RemoveAllChildren(); diff --git a/Assets/Scripts/UI/UIBody3DMenuTree.cs b/Assets/Scripts/UI/UIBody3DMenuTree.cs index 97a5cb4e..211ef38f 100644 --- a/Assets/Scripts/UI/UIBody3DMenuTree.cs +++ b/Assets/Scripts/UI/UIBody3DMenuTree.cs @@ -4,6 +4,7 @@ using XMLTool; using System.Collections.Generic; using TMPro; using DG.Tweening; +using System; namespace QFramework.Example { @@ -204,6 +205,7 @@ namespace QFramework.Example DOTweenAnimation contentAnim; protected override void OnInit(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnModuleQuithandler).UnRegisterWhenGameObjectDestroyed(this); contentAnim = RootContent.GetComponent(); // please add init code here Close.onClick.AddListener(() => @@ -233,7 +235,10 @@ namespace QFramework.Example }); } - + private void OnModuleQuithandler(OnModuleQuit quit) + { + Hide(); + } protected override void OnOpen(IUIData uiData = null) { diff --git a/Assets/Scripts/UI/UIBody3DMouse.cs b/Assets/Scripts/UI/UIBody3DMouse.cs index 05095ca5..0929d1ab 100644 --- a/Assets/Scripts/UI/UIBody3DMouse.cs +++ b/Assets/Scripts/UI/UIBody3DMouse.cs @@ -15,6 +15,7 @@ namespace QFramework.Example private bool isObjectHit; // Ƿ屻 protected override void OnInit(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnModuleQuithandler).UnRegisterWhenGameObjectDestroyed(this); mData = uiData as UIBody3DMouseData ?? new UIBody3DMouseData(); dragItem = Content.GetComponent(); @@ -31,6 +32,11 @@ namespace QFramework.Example }); } + private void OnModuleQuithandler(OnModuleQuit quit) + { + Hide(); + } + private void OnEndDrag() { Show3DCamera.instance.lockMove = false; From f1d865dc819ee4355b3cf178b8beaf7a91ebffc9 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Tue, 11 Mar 2025 13:59:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Item/Show3DCamera.cs | 27 +++++++++ Assets/Scripts/UI/UIBody3D.cs | 2 +- Assets/Scripts/Xml/XmlParser.cs | 5 +- Doc/Xml配置文档.xml | 94 ++++++++++++++++++++++++++++- 4 files changed, 124 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Item/Show3DCamera.cs b/Assets/Scripts/Item/Show3DCamera.cs index 229c3904..7247a701 100644 --- a/Assets/Scripts/Item/Show3DCamera.cs +++ b/Assets/Scripts/Item/Show3DCamera.cs @@ -72,6 +72,33 @@ public class Show3DCamera : MonoBehaviour + public void ResetCamera(Transform target, RectTransform inputRect = null, bool isRenderTexture = true) + { + if (target == null) + { + Debug.LogError("Target is not assigned!"); + return; + } + + yaw = 0; + pitch = 0; + // ʼλ + this.inputRect = inputRect; + this.targetPos = target.transform.position; + // ʼλ + offset = new Vector3(0, 0, -distance); + + if (isRenderTexture) + { + self.targetTexture = texture; + } + else + { + self.targetTexture = null; + } + UpdateCameraPosition(-1); + } + void Update() { if (targetPos != null && lockMove == false && EventSystem.current.IsPointerOverGameObject() == false) diff --git a/Assets/Scripts/UI/UIBody3D.cs b/Assets/Scripts/UI/UIBody3D.cs index 964e01b1..ba027026 100644 --- a/Assets/Scripts/UI/UIBody3D.cs +++ b/Assets/Scripts/UI/UIBody3D.cs @@ -246,7 +246,7 @@ namespace QFramework.Example public void ResetCamera(float moveTime) { - Show3DCamera.instance.Set(root.transform, distance: 5, isRenderTexture: false, moveTime: moveTime, pitchMin: -80); + Show3DCamera.instance.ResetCamera(root.transform); } protected override void OnShow() diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index 585ab642..1d795f54 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -405,9 +405,10 @@ namespace XMLTool Name = bodyElement.Attribute("name")?.Value, Path = bodyElement.Attribute("path")?.Value, Tip = bodyElement.Attribute("tip")?.Value, - Audio = bodyElement.Attribute("audio")?.Value + Audio = bodyElement.Attribute("audio")?.Value, + FocusDistance = bodyElement.Attribute("FocusDistance")?.Value }; - + var isShow = bodyElement.Attribute("isShow"); if (isShow != null) { diff --git a/Doc/Xml配置文档.xml b/Doc/Xml配置文档.xml index adae8340..b8f57467 100644 --- a/Doc/Xml配置文档.xml +++ b/Doc/Xml配置文档.xml @@ -380,4 +380,96 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +