From 10f1b0b052a5174a081f692a8e678602893ad969 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Mon, 20 Jan 2025 18:42:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A9=E5=B1=95cameraSwitch=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/CameraSwitchAction.cs | 21 +++++++++++++++----- Assets/Scripts/UI/UICameraSwitch.cs | 7 +++++++ Doc/Xml配置文档.xml | 1 + 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/Actions/CameraSwitchAction.cs b/Assets/Scripts/Actions/CameraSwitchAction.cs index 48f0e77d..beaa5066 100644 --- a/Assets/Scripts/Actions/CameraSwitchAction.cs +++ b/Assets/Scripts/Actions/CameraSwitchAction.cs @@ -47,9 +47,14 @@ namespace QFramework } else { - data.nearPos = Utility.GetVector3FromStrArray(datas["nearPos"]); - data.nearRot = Utility.GetVector3FromStrArray(datas["nearRot"]); - + if (datas.ContainsKey("nearPos")) + { + data.nearPos = Utility.GetVector3FromStrArray(datas["nearPos"]); + } + if (datas.ContainsKey("nearRot")) + { + data.nearRot = Utility.GetVector3FromStrArray(datas["nearRot"]); + } } if (datas.ContainsKey("normalDevice")) @@ -60,8 +65,14 @@ namespace QFramework } else { - data.normalPos = Utility.GetVector3FromStrArray(datas["normalPos"]); - data.normalRot = Utility.GetVector3FromStrArray(datas["normalRot"]); + if (datas.ContainsKey("normalPos")) + { + data.normalPos = Utility.GetVector3FromStrArray(datas["normalPos"]); + } + if (datas.ContainsKey("normalRot")) + { + data.normalRot = Utility.GetVector3FromStrArray(datas["normalRot"]); + } } if (datas.ContainsKey("isOn")) { diff --git a/Assets/Scripts/UI/UICameraSwitch.cs b/Assets/Scripts/UI/UICameraSwitch.cs index e144115e..1f3d5451 100644 --- a/Assets/Scripts/UI/UICameraSwitch.cs +++ b/Assets/Scripts/UI/UICameraSwitch.cs @@ -59,6 +59,11 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { mData = uiData as UICameraSwitchData ?? new UICameraSwitchData(); + + Near.gameObject.SetActive(mData.nearPos != default); + Far.gameObject.SetActive(mData.normalPos != default); + + if (string.IsNullOrEmpty(mData.isOn)) { if (Near.isOn) @@ -96,6 +101,8 @@ namespace QFramework.Example break; } } + + } private void Update() diff --git a/Doc/Xml配置文档.xml b/Doc/Xml配置文档.xml index 381962ab..c658c7f1 100644 --- a/Doc/Xml配置文档.xml +++ b/Doc/Xml配置文档.xml @@ -74,6 +74,7 @@