From 57a871eeb25228be2d8232806d36a97c54f27f61 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 9 Jan 2025 14:10:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=95=9C=E5=A4=B4=E8=AE=BE?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/CameraSwitchAction.cs | 5 +++- Assets/Scripts/UI/UICameraSwitch.cs | 25 ++++++++++++++++---- Assets/Scripts/Xml/XmlParser.cs | 5 ++++ Doc/Xml配置文档.xml | 3 ++- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/Actions/CameraSwitchAction.cs b/Assets/Scripts/Actions/CameraSwitchAction.cs index a4993937..48f0e77d 100644 --- a/Assets/Scripts/Actions/CameraSwitchAction.cs +++ b/Assets/Scripts/Actions/CameraSwitchAction.cs @@ -63,7 +63,10 @@ namespace QFramework data.normalPos = Utility.GetVector3FromStrArray(datas["normalPos"]); data.normalRot = Utility.GetVector3FromStrArray(datas["normalRot"]); } - + if (datas.ContainsKey("isOn")) + { + data.isOn = datas["isOn"]; + } float.TryParse(datas["nearTime"], out data.nearTime); float.TryParse(datas["normalTime"], out data.normalTime); diff --git a/Assets/Scripts/UI/UICameraSwitch.cs b/Assets/Scripts/UI/UICameraSwitch.cs index 4020e826..839b2ac1 100644 --- a/Assets/Scripts/UI/UICameraSwitch.cs +++ b/Assets/Scripts/UI/UICameraSwitch.cs @@ -16,6 +16,7 @@ namespace QFramework.Example public Vector3 normalRot; public float nearTime; public float normalTime; + public string isOn; } public partial class UICameraSwitch : UIPanel @@ -58,14 +59,28 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { mData = uiData as UICameraSwitchData ?? new UICameraSwitchData(); - - if (Near.isOn) + if (string.IsNullOrEmpty(mData.isOn)) { - SetNear(); + if (Near.isOn) + { + SetNear(); + } + if (Far.isOn) + { + SetNormal(); + } } - if (Far.isOn) + else { - SetNormal(); + switch (mData.isOn) + { + case "near": + SetNear(); + break; + case "normal": + SetNormal(); + break; + } } } diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index b894aabf..c72821f9 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -666,6 +666,11 @@ namespace XMLTool { act.args.Add("normalTime", "0"); } + XAttribute isOn = action.Attribute("isOn"); + if (isOn != null) + { + act.args.Add("isOn", isOn.Value); + } newAction = act; } break; diff --git a/Doc/Xml配置文档.xml b/Doc/Xml配置文档.xml index 701cbb8d..ff8c6aaf 100644 --- a/Doc/Xml配置文档.xml +++ b/Doc/Xml配置文档.xml @@ -51,8 +51,9 @@ - +