From c25830a67084d68f2a6b1a5f63a960bd8f4ca652 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Tue, 31 Dec 2024 16:17:48 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=B1=8F=E8=94=BD?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UI/UICameraSwitch.cs | 48 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/Assets/Scripts/UI/UICameraSwitch.cs b/Assets/Scripts/UI/UICameraSwitch.cs index 7890ac3b..532f5fe4 100644 --- a/Assets/Scripts/UI/UICameraSwitch.cs +++ b/Assets/Scripts/UI/UICameraSwitch.cs @@ -16,7 +16,7 @@ namespace QFramework.Example public Vector3 normalRot; public float nearTime; public float normalTime; - public bool isNear = false; + public bool isNear; } public partial class UICameraSwitch : UIPanel @@ -60,30 +60,28 @@ namespace QFramework.Example mData = uiData as UICameraSwitchData ?? new UICameraSwitchData(); - - - if (mData.isNear) - { - if (Near.isOn == false) - { - Near.isOn = true; - } - else - { - SetNear(); - } - } - else - { - if (Far.isOn == false) - { - Far.isOn = true; - } - else - { - SetNormal(); - } - } + //if (mData.isNear) + //{ + // if (Near.isOn == false) + // { + // Near.isOn = true; + // } + // else + // { + // SetNear(); + // } + //} + //else + //{ + // if (Far.isOn == false) + // { + // Far.isOn = true; + // } + // else + // { + // SetNormal(); + // } + //} } protected override void OnShow() From 8caed7288639e81e95a49888405f3727a46147fb Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Tue, 31 Dec 2024 16:24:35 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8F=8D=E9=A6=88=20?= =?UTF-8?q?=E6=8A=8A=E9=95=9C=E5=A4=B4=E5=88=87=E6=8D=A2=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E4=B8=8D=E5=BC=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Art/UIPrefab/UICameraSwitch.prefab | 2 +- Assets/Scripts/Actions/CameraSwitchAction.cs | 10 +++- Assets/Scripts/UI/UICameraSwitch.cs | 48 +++++++++++--------- Doc/Xml配置文档.xml | 4 +- 4 files changed, 39 insertions(+), 25 deletions(-) diff --git a/Assets/Art/UIPrefab/UICameraSwitch.prefab b/Assets/Art/UIPrefab/UICameraSwitch.prefab index 0157920f..92fbe6e1 100644 --- a/Assets/Art/UIPrefab/UICameraSwitch.prefab +++ b/Assets/Art/UIPrefab/UICameraSwitch.prefab @@ -529,7 +529,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2fafe2cfe61f6974895a912c3755e8f1, type: 3} m_Name: m_EditorClassIdentifier: - m_AllowSwitchOff: 0 + m_AllowSwitchOff: 1 --- !u!1 &5353223196711954198 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Actions/CameraSwitchAction.cs b/Assets/Scripts/Actions/CameraSwitchAction.cs index 586497a8..82fbcb98 100644 --- a/Assets/Scripts/Actions/CameraSwitchAction.cs +++ b/Assets/Scripts/Actions/CameraSwitchAction.cs @@ -64,7 +64,15 @@ namespace QFramework data.normalRot = Utility.GetVector3FromStrArray(datas["normalRot"]); } - bool.TryParse(datas["isNear"], out data.isNear); + if (datas.ContainsKey("isNear") == false) + { + data.NotRun = true; + } + else + { + data.NotRun = false; + bool.TryParse(datas["isNear"], out data.isNear); + } 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 532f5fe4..60f36643 100644 --- a/Assets/Scripts/UI/UICameraSwitch.cs +++ b/Assets/Scripts/UI/UICameraSwitch.cs @@ -17,6 +17,7 @@ namespace QFramework.Example public float nearTime; public float normalTime; public bool isNear; + public bool NotRun; } public partial class UICameraSwitch : UIPanel @@ -59,29 +60,32 @@ namespace QFramework.Example { mData = uiData as UICameraSwitchData ?? new UICameraSwitchData(); + if (mData.NotRun==false) + { + if (mData.isNear) + { + if (Near.isOn == false) + { + Near.isOn = true; + } + else + { + SetNear(); + } + } + else + { + if (Far.isOn == false) + { + Far.isOn = true; + } + else + { + SetNormal(); + } + } + } - //if (mData.isNear) - //{ - // if (Near.isOn == false) - // { - // Near.isOn = true; - // } - // else - // { - // SetNear(); - // } - //} - //else - //{ - // if (Far.isOn == false) - // { - // Far.isOn = true; - // } - // else - // { - // SetNormal(); - // } - //} } protected override void OnShow() diff --git a/Doc/Xml配置文档.xml b/Doc/Xml配置文档.xml index 4c5ab3e3..06d2e0f3 100644 --- a/Doc/Xml配置文档.xml +++ b/Doc/Xml配置文档.xml @@ -48,7 +48,9 @@ - + From 3e4d87b0cad21f26354056345e6e649c4240dbee Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Tue, 31 Dec 2024 16:31:32 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=E4=BF=AE=E6=94=B9UI=E7=BB=84=E4=BB=B6=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/CameraSwitchAction.cs | 9 ------ Assets/Scripts/UI/UICameraSwitch.cs | 32 ++++---------------- Assets/Scripts/Xml/XmlParser.cs | 9 ------ Doc/Xml配置文档.xml | 4 +-- 4 files changed, 8 insertions(+), 46 deletions(-) diff --git a/Assets/Scripts/Actions/CameraSwitchAction.cs b/Assets/Scripts/Actions/CameraSwitchAction.cs index 82fbcb98..a4993937 100644 --- a/Assets/Scripts/Actions/CameraSwitchAction.cs +++ b/Assets/Scripts/Actions/CameraSwitchAction.cs @@ -64,15 +64,6 @@ namespace QFramework data.normalRot = Utility.GetVector3FromStrArray(datas["normalRot"]); } - if (datas.ContainsKey("isNear") == false) - { - data.NotRun = true; - } - else - { - data.NotRun = false; - bool.TryParse(datas["isNear"], out data.isNear); - } 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 60f36643..dd2893cf 100644 --- a/Assets/Scripts/UI/UICameraSwitch.cs +++ b/Assets/Scripts/UI/UICameraSwitch.cs @@ -16,8 +16,6 @@ namespace QFramework.Example public Vector3 normalRot; public float nearTime; public float normalTime; - public bool isNear; - public bool NotRun; } public partial class UICameraSwitch : UIPanel @@ -60,32 +58,14 @@ namespace QFramework.Example { mData = uiData as UICameraSwitchData ?? new UICameraSwitchData(); - if (mData.NotRun==false) + if (Near.isOn) { - if (mData.isNear) - { - if (Near.isOn == false) - { - Near.isOn = true; - } - else - { - SetNear(); - } - } - else - { - if (Far.isOn == false) - { - Far.isOn = true; - } - else - { - SetNormal(); - } - } + SetNear(); + } + if (Far.isOn) + { + SetNormal(); } - } protected override void OnShow() diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index 3fcc3afd..c7fb8bc0 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -655,15 +655,6 @@ namespace XMLTool { act.args.Add("normalTime", "0"); } - XAttribute isNear = action.Attribute("isNear"); - if (isNear != null) - { - act.args.Add("isNear", isNear.Value); - } - else - { - act.args.Add("isNear", "false"); - } newAction = act; } break; diff --git a/Doc/Xml配置文档.xml b/Doc/Xml配置文档.xml index 06d2e0f3..3e3e6975 100644 --- a/Doc/Xml配置文档.xml +++ b/Doc/Xml配置文档.xml @@ -49,9 +49,9 @@ - + From 448bab5f03a20f18f833fc2bb74d242375181729 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Tue, 31 Dec 2024 16:41:03 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E6=A8=A1=E5=BC=8F=20?= =?UTF-8?q?=E5=8F=AA=E9=AB=98=E4=BA=AE=E5=BD=93=E5=89=8D=20=E8=80=83?= =?UTF-8?q?=E6=A0=B8=E6=A8=A1=E5=BC=8F=20=E9=AB=98=E4=BA=AE=E5=81=9A?= =?UTF-8?q?=E8=BF=87=E7=9A=84=E6=AD=A5=E9=AA=A4=20=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E8=BF=87=E4=BA=8E=E8=80=A6=E5=90=88=20=E5=90=8E=E6=9C=9F?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UI/UIOperationList.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/UI/UIOperationList.cs b/Assets/Scripts/UI/UIOperationList.cs index 76d40ae5..7e4a9d18 100644 --- a/Assets/Scripts/UI/UIOperationList.cs +++ b/Assets/Scripts/UI/UIOperationList.cs @@ -66,7 +66,15 @@ namespace QFramework.Example btn.transform.parent.gameObject.SetActive(true); break; case StepStatus.Finished: - stepLabel.color = highColor; + // TODOʵַʽ Ż + if (Global.Instance.curModule.type=="Exam") + { + stepLabel.color = highColor; + } + else + { + stepLabel.color = Color.white; + } break; } } From 1de81496789dac40195da122ec4d996474783648 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Tue, 31 Dec 2024 17:06:00 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=9A=E7=94=A8?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/ActionHelper.cs | 4 + Assets/Scripts/Actions/StrEventAction.cs | 77 +++++++++++++++++++ Assets/Scripts/Actions/StrEventAction.cs.meta | 11 +++ Assets/Scripts/Global/Global.cs | 4 + Assets/Scripts/Item/DeviceItem.cs | 12 +++ Doc/Xml配置文档.xml | 8 ++ 6 files changed, 116 insertions(+) create mode 100644 Assets/Scripts/Actions/StrEventAction.cs create mode 100644 Assets/Scripts/Actions/StrEventAction.cs.meta diff --git a/Assets/Scripts/Actions/ActionHelper.cs b/Assets/Scripts/Actions/ActionHelper.cs index 8c6c6110..ebd121cd 100644 --- a/Assets/Scripts/Actions/ActionHelper.cs +++ b/Assets/Scripts/Actions/ActionHelper.cs @@ -209,6 +209,10 @@ public class ActionHelper var dictAction = (XMLTool.DictionaryAction)act; return TimeTipAction.Allocate(act.Value, dictAction.args); } + case "StrEvent": + { + return StrEventAction.Allocate(act.Name, act.Value); + } default: Debug.LogError($"ûҵAction{act.Type}"); break; diff --git a/Assets/Scripts/Actions/StrEventAction.cs b/Assets/Scripts/Actions/StrEventAction.cs new file mode 100644 index 00000000..89c7cea2 --- /dev/null +++ b/Assets/Scripts/Actions/StrEventAction.cs @@ -0,0 +1,77 @@ +using System; +using System.Runtime.CompilerServices; +using UnityEngine; + +namespace QFramework +{ + internal class StrEventAction : IAction + { + public string txt; + + + public System.Action OnFinished { get; set; } + + + private StrEventAction() + { + } + + private static readonly SimpleObjectPool mPool = + new SimpleObjectPool(() => new StrEventAction(), null, 10); + + string key = string.Empty; + string arg = string.Empty; + public static StrEventAction Allocate(string key, string arg, System.Action OnFinished = null) + { + var retNode = mPool.Allocate(); + retNode.ActionID = ActionKit.ID_GENERATOR++; + retNode.Deinited = false; + retNode.Reset(); + retNode.OnFinished = OnFinished; + retNode.key = key; + retNode.arg = arg; + return retNode; + } + + + public ulong ActionID { get; set; } + public ActionStatus Status { get; set; } + + public void OnStart() + { + StringEventSystem.Global.Send(key, arg.Split(",")); + this.Finish(); + } + + public void OnExecute(float dt) + { + + } + + public void OnFinish() + { + } + + public void Reset() + { + Status = ActionStatus.NotStart; + Paused = false; + } + + public bool Paused { get; set; } + + public void Deinit() + { + if (!Deinited) + { + OnFinished = null; + Deinited = true; + mPool.Recycle(this); + } + } + + public bool Deinited { get; set; } + } + + +} \ No newline at end of file diff --git a/Assets/Scripts/Actions/StrEventAction.cs.meta b/Assets/Scripts/Actions/StrEventAction.cs.meta new file mode 100644 index 00000000..d09f31f6 --- /dev/null +++ b/Assets/Scripts/Actions/StrEventAction.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7a45244e92d067b4495241480cdec7b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Global/Global.cs b/Assets/Scripts/Global/Global.cs index 7c9cf1f6..339953fd 100644 --- a/Assets/Scripts/Global/Global.cs +++ b/Assets/Scripts/Global/Global.cs @@ -23,6 +23,8 @@ public class Global : Singleton public static string reportDemoPath = reportPath + "Demo.docx"; public static APPSetting appSetting { get; } = new APPSetting(); + public static string HighLightTrigger = "HighLightTrigger"; + public enum AppType { UnKnow = 1 << 0, @@ -33,4 +35,6 @@ public class Global : Singleton public static AppType appTpe = AppType.UnKnow; + + } diff --git a/Assets/Scripts/Item/DeviceItem.cs b/Assets/Scripts/Item/DeviceItem.cs index 0821ed95..2d9a2399 100644 --- a/Assets/Scripts/Item/DeviceItem.cs +++ b/Assets/Scripts/Item/DeviceItem.cs @@ -1,6 +1,7 @@ using HighlightPlus; using QFramework; using QFramework.Example; +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -16,6 +17,7 @@ public class DeviceItem : MonoBehaviour var effect = gameObject.GetOrAddComponent(); gameObject.GetOrAddComponent(); effect.outlineColor = Color.green; + StringEventSystem.Global.Register(Global.HighLightTrigger, OnHighLightTriggerEvent).UnRegisterWhenGameObjectDestroyed(gameObject); } if (device.MeshCollider) { @@ -40,6 +42,16 @@ public class DeviceItem : MonoBehaviour } } + private void OnHighLightTriggerEvent(string[] obj) + { + if (obj.Length > 0) + { + bool isActive = true; + bool.TryParse(obj[0], out isActive); + gameObject.GetComponent().enabled = isActive; + } + } + private void OnMouseUpAsButton() { var effect = gameObject.GetComponent(); diff --git a/Doc/Xml配置文档.xml b/Doc/Xml配置文档.xml index 3e3e6975..080cfa82 100644 --- a/Doc/Xml配置文档.xml +++ b/Doc/Xml配置文档.xml @@ -121,6 +121,14 @@ + + + +