From dc9802943b17b928b3f8235fb9be996c2d3ede89 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 9 Jan 2025 13:35:04 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UI/UIBtns.cs | 2 +- Assets/Scripts/UI/UIHint.cs | 2 +- Assets/Scripts/UI/UIOperationList.cs | 1 - Assets/Scripts/UI/UIPointQuestion.cs | 2 +- Assets/Scripts/UI/UIResultTip.cs | 2 +- Assets/Scripts/UI/UITextQuestion.cs | 2 +- Assets/Scripts/UI/UITextTip.cs | 3 +-- Assets/Scripts/UI/UITipWindow.cs | 2 +- Assets/Scripts/UI/UITools.cs | 2 +- 9 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/UI/UIBtns.cs b/Assets/Scripts/UI/UIBtns.cs index 4b9414ca..61c0e263 100644 --- a/Assets/Scripts/UI/UIBtns.cs +++ b/Assets/Scripts/UI/UIBtns.cs @@ -18,7 +18,6 @@ namespace QFramework.Example { mData = uiData as UIBtnsData ?? new UIBtnsData(); // please add init code here - TypeEventSystem.Global.Register(OnStepChanged); TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } @@ -29,6 +28,7 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnStepChanged).UnRegisterWhenDisabled(gameObject); mData = uiData as UIBtnsData ?? new UIBtnsData(); BtnContent.RemoveAllChildren(); foreach (var item in mData.btns) diff --git a/Assets/Scripts/UI/UIHint.cs b/Assets/Scripts/UI/UIHint.cs index 6a30db99..a504b769 100644 --- a/Assets/Scripts/UI/UIHint.cs +++ b/Assets/Scripts/UI/UIHint.cs @@ -22,7 +22,6 @@ namespace QFramework.Example { mData = uiData as UIHintData ?? new UIHintData(); SetItem(0); - TypeEventSystem.Global.Register(OnStepChanged); TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } @@ -32,6 +31,7 @@ namespace QFramework.Example } protected override void OnOpen(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnStepChanged).UnRegisterWhenDisabled(gameObject); mData = uiData as UIHintData ?? new UIHintData(); if (curAction != null) { diff --git a/Assets/Scripts/UI/UIOperationList.cs b/Assets/Scripts/UI/UIOperationList.cs index 12ab9209..82693fb9 100644 --- a/Assets/Scripts/UI/UIOperationList.cs +++ b/Assets/Scripts/UI/UIOperationList.cs @@ -142,7 +142,6 @@ namespace QFramework.Example } protected override void OnClose() { - TypeEventSystem.Global.UnRegister(OnStepChanged); } } } diff --git a/Assets/Scripts/UI/UIPointQuestion.cs b/Assets/Scripts/UI/UIPointQuestion.cs index 8f60f828..6f078693 100644 --- a/Assets/Scripts/UI/UIPointQuestion.cs +++ b/Assets/Scripts/UI/UIPointQuestion.cs @@ -17,7 +17,6 @@ namespace QFramework.Example { mData = uiData as UIPointQuestionData ?? new UIPointQuestionData(); // please add init code here - TypeEventSystem.Global.Register(OnStepChanged); TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } @@ -28,6 +27,7 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnStepChanged).UnRegisterWhenDisabled(gameObject); mData = uiData as UIPointQuestionData ?? new UIPointQuestionData(); Content.RemoveAllChildren(); diff --git a/Assets/Scripts/UI/UIResultTip.cs b/Assets/Scripts/UI/UIResultTip.cs index 288574e1..5d685ef9 100644 --- a/Assets/Scripts/UI/UIResultTip.cs +++ b/Assets/Scripts/UI/UIResultTip.cs @@ -20,7 +20,6 @@ namespace QFramework.Example mData = uiData as UIResultTipData ?? new UIResultTipData(); Right.gameObject.SetActive(false); Wrong.gameObject.SetActive(false); - TypeEventSystem.Global.Register(OnStepChanged); TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } @@ -30,6 +29,7 @@ namespace QFramework.Example } protected override void OnOpen(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnStepChanged).UnRegisterWhenDisabled(gameObject); Right.gameObject.SetActive(false); Wrong.gameObject.SetActive(false); mData = uiData as UIResultTipData ?? new UIResultTipData(); diff --git a/Assets/Scripts/UI/UITextQuestion.cs b/Assets/Scripts/UI/UITextQuestion.cs index 3069230a..ea98985e 100644 --- a/Assets/Scripts/UI/UITextQuestion.cs +++ b/Assets/Scripts/UI/UITextQuestion.cs @@ -34,7 +34,6 @@ namespace QFramework.Example { mData = uiData as UITextQuestionData ?? new UITextQuestionData(); // please add init code here - TypeEventSystem.Global.Register(OnStepChanged); TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } @@ -44,6 +43,7 @@ namespace QFramework.Example } protected override void OnOpen(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnStepChanged).UnRegisterWhenDisabled(gameObject); mData = uiData as UITextQuestionData ?? new UITextQuestionData(); Title.text = mData.title; OptionContent.transform.RemoveAllChildren(); diff --git a/Assets/Scripts/UI/UITextTip.cs b/Assets/Scripts/UI/UITextTip.cs index 154c5dec..6b66d0cc 100644 --- a/Assets/Scripts/UI/UITextTip.cs +++ b/Assets/Scripts/UI/UITextTip.cs @@ -22,8 +22,6 @@ namespace QFramework.Example { mData = uiData as UITextTipData ?? new UITextTipData(); - TypeEventSystem.Global.Register(OnStepChanged).UnRegisterWhenGameObjectDestroyed(this); - TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } @@ -34,6 +32,7 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnStepChanged).UnRegisterWhenDisabled(gameObject); mData = uiData as UITextTipData ?? new UITextTipData(); Des.text = Regex.Replace(mData.text, @"\\n", "\n"); BtnContent.RemoveAllChildren(); diff --git a/Assets/Scripts/UI/UITipWindow.cs b/Assets/Scripts/UI/UITipWindow.cs index 0ed8613c..bebe56dc 100644 --- a/Assets/Scripts/UI/UITipWindow.cs +++ b/Assets/Scripts/UI/UITipWindow.cs @@ -27,7 +27,6 @@ namespace QFramework.Example mData = uiData as UITipWindowData ?? new UITipWindowData(); // please add init code here - TypeEventSystem.Global.Register(OnStepChanged); TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } @@ -39,6 +38,7 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { mData = uiData as UITipWindowData ?? new UITipWindowData(); + TypeEventSystem.Global.Register(OnStepChanged).UnRegisterWhenDisabled(gameObject); Label.text = mData.txt; BtnContent.RemoveAllChildren(); if (mData != null) diff --git a/Assets/Scripts/UI/UITools.cs b/Assets/Scripts/UI/UITools.cs index 49bc1571..368bf262 100644 --- a/Assets/Scripts/UI/UITools.cs +++ b/Assets/Scripts/UI/UITools.cs @@ -30,7 +30,6 @@ namespace QFramework.Example { mData = uiData as UIToolsData ?? new UIToolsData(); // please add init code here - TypeEventSystem.Global.Register(OnStepChanged); TypeEventSystem.Global.Register(OnModuleQuit).UnRegisterWhenGameObjectDestroyed(gameObject); } @@ -41,6 +40,7 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnStepChanged).UnRegisterWhenDisabled(gameObject); mResLoader = ResLoader.Allocate(); mData = uiData as UIToolsData ?? new UIToolsData(); if (string.IsNullOrEmpty(mData.answer) == false) From 1812e5c2ec1fb9e977bc608adcea1560837325bd Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 9 Jan 2025 13:57:44 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=89=A9=E5=B1=95=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E9=AB=98=E4=BA=AE=E5=8A=9F=E8=83=BD=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=8D=95=E4=B8=AA=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Editor/SetReadWrite.cs.meta | 11 +++++++++++ Assets/Scripts/Item/DeviceItem.cs | 5 ++++- Doc/Xml配置文档.xml | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 Assets/Scripts/Editor/SetReadWrite.cs.meta diff --git a/Assets/Scripts/Editor/SetReadWrite.cs.meta b/Assets/Scripts/Editor/SetReadWrite.cs.meta new file mode 100644 index 00000000..5c098667 --- /dev/null +++ b/Assets/Scripts/Editor/SetReadWrite.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a1465669937f2bd41bb9445a4ad56e2b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Item/DeviceItem.cs b/Assets/Scripts/Item/DeviceItem.cs index 03612200..51687e3e 100644 --- a/Assets/Scripts/Item/DeviceItem.cs +++ b/Assets/Scripts/Item/DeviceItem.cs @@ -46,7 +46,10 @@ public class DeviceItem : MonoBehaviour { bool isActive = true; bool.TryParse(obj[0], out isActive); - gameObject.GetComponent().enabled = isActive; + if (obj.Length == 1 || (obj.Length > 1 && obj[1] == device.Name)) + { + gameObject.GetComponent().enabled = isActive; + } } } diff --git a/Doc/Xml配置文档.xml b/Doc/Xml配置文档.xml index 4c2b2bf1..701cbb8d 100644 --- a/Doc/Xml配置文档.xml +++ b/Doc/Xml配置文档.xml @@ -128,7 +128,7 @@ 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 3/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=95=9C=E5=A4=B4?= =?UTF-8?q?=E8=AE=BE=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 @@ - + From f5eb58cdc9cc9036251abfe38ae2e06b2dfd7d51 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 9 Jan 2025 14:12:44 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=95=9C=E5=A4=B4?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E4=B8=BA60?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scenes/Main.unity | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 71c1cb4f..f0c38969 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -308,7 +308,7 @@ Camera: height: 1 near clip plane: 0.3 far clip plane: 1000 - field of view: 25 + field of view: 60 orthographic: 0 orthographic size: 5 m_Depth: -1 From 05770536525314c1bb8f640fcd4a3f1e6f1fab6d Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 9 Jan 2025 15:06:14 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E9=94=81=E5=AE=9A=E9=95=9C=E5=A4=B4?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/ActionHelper.cs | 4 ++-- Assets/Scripts/Actions/CameraLockAction.cs | 7 ++++--- Assets/Scripts/Xml/XmlParser.cs | 14 +++----------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Assets/Scripts/Actions/ActionHelper.cs b/Assets/Scripts/Actions/ActionHelper.cs index 813c31c2..aa776072 100644 --- a/Assets/Scripts/Actions/ActionHelper.cs +++ b/Assets/Scripts/Actions/ActionHelper.cs @@ -157,8 +157,8 @@ public class ActionHelper } case "CameraLock": { - var strAction = (XMLTool.StringListAction)act; - return CameraLockAction.Allocate(strAction.args[0], strAction.args[1]); + var strAction = (XMLTool.DictionaryAction)act; + return CameraLockAction.Allocate(strAction.args); } case "Video": { diff --git a/Assets/Scripts/Actions/CameraLockAction.cs b/Assets/Scripts/Actions/CameraLockAction.cs index 5a2d87bc..2dd41eae 100644 --- a/Assets/Scripts/Actions/CameraLockAction.cs +++ b/Assets/Scripts/Actions/CameraLockAction.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using UnityEngine; namespace QFramework @@ -18,14 +19,14 @@ namespace QFramework new SimpleObjectPool(() => new CameraLockAction(), null, 10); string isMove; string isRotate; - public static CameraLockAction Allocate(string isMove, string isRotate, System.Action OnFinished = null) + public static CameraLockAction Allocate(Dictionary datas, System.Action OnFinished = null) { var retNode = mPool.Allocate(); retNode.ActionID = ActionKit.ID_GENERATOR++; retNode.Deinited = false; retNode.Reset(); - retNode.isMove = isMove; - retNode.isRotate = isRotate; + retNode.isMove = datas.ContainsKey("isMove") ? datas["isMove"] : "true"; + retNode.isRotate = datas.ContainsKey("isRotate") ? datas["isRotate"] : "true"; retNode.OnFinished = OnFinished; return retNode; } diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index c72821f9..970508a6 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -676,24 +676,16 @@ namespace XMLTool break; case "CameraLock": { - var act = new StringListAction(); + var act = new DictionaryAction(); XAttribute isMove = action.Attribute("isMove"); if (isMove != null) { - act.args.Add(isMove.Value); - } - else - { - act.args.Add("true"); + act.args.Add("isMove", isMove.Value); } XAttribute isRotate = action.Attribute("isRotate"); if (isRotate != null) { - act.args.Add(isRotate.Value); - } - else - { - act.args.Add("true"); + act.args.Add("isRotate", isRotate.Value); } newAction = act; }