From 684614b43bbb7c8765ab1e222b619e6ed2100b17 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Wed, 8 Jan 2025 11:13:02 +0800 Subject: [PATCH 01/21] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dhint=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UI/UIHint.Designer.cs | 2 +- Assets/Scripts/UI/UIHint.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/UI/UIHint.Designer.cs b/Assets/Scripts/UI/UIHint.Designer.cs index 15ec5a81..b7d0c337 100644 --- a/Assets/Scripts/UI/UIHint.Designer.cs +++ b/Assets/Scripts/UI/UIHint.Designer.cs @@ -5,7 +5,7 @@ using QFramework; namespace QFramework.Example { - // Generate Id:56300545-9a16-4363-94bb-73919dd6d4f0 + // Generate Id:81782f84-21db-40cc-8f07-78023c95d54e public partial class UIHint { public const string Name = "UIHint"; diff --git a/Assets/Scripts/UI/UIHint.cs b/Assets/Scripts/UI/UIHint.cs index b03364bd..623d81c3 100644 --- a/Assets/Scripts/UI/UIHint.cs +++ b/Assets/Scripts/UI/UIHint.cs @@ -61,6 +61,7 @@ namespace QFramework.Example { ItemPrefab.DOFade(alph, 0.5f); Label.DOFade(alph, 0.5f); + Icon.gameObject.SetActive(alph == 1); } protected override void OnShow() From f118173ae7740c819432c449f3f96c6fd02b021d Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Wed, 8 Jan 2025 14:56:51 +0800 Subject: [PATCH 02/21] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dobjclick=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/AnimationAction.cs | 4 ++++ Assets/Scripts/Conditions/ObjClickCondition.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Actions/AnimationAction.cs b/Assets/Scripts/Actions/AnimationAction.cs index 16660014..4cf89710 100644 --- a/Assets/Scripts/Actions/AnimationAction.cs +++ b/Assets/Scripts/Actions/AnimationAction.cs @@ -56,6 +56,10 @@ namespace QFramework } if (obj != null) { + if (obj.activeSelf == false) + { + Debug.LogError(obj.name + "ǰ״̬"); + } try { anim = obj.GetComponent(); diff --git a/Assets/Scripts/Conditions/ObjClickCondition.cs b/Assets/Scripts/Conditions/ObjClickCondition.cs index 3dd78de4..68754b2c 100644 --- a/Assets/Scripts/Conditions/ObjClickCondition.cs +++ b/Assets/Scripts/Conditions/ObjClickCondition.cs @@ -45,7 +45,7 @@ namespace QFramework obj = DeviceController.Instance.GetDeviceObj(deviceName); } } - if (obj != null && Input.GetMouseButtonUp(0)) + if (obj != null && Input.GetMouseButtonUp(0) && EventSystem.current.IsPointerOverGameObject() == false) { Vector3 mousePos = Input.mousePosition; Ray ray = Camera.main.ScreenPointToRay(mousePos); From cdc5a49106fbf2614cfce187b6cf77da43f367fa Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Wed, 8 Jan 2025 15:11:32 +0800 Subject: [PATCH 03/21] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UI/UIHint.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/UI/UIHint.cs b/Assets/Scripts/UI/UIHint.cs index 623d81c3..73deb610 100644 --- a/Assets/Scripts/UI/UIHint.cs +++ b/Assets/Scripts/UI/UIHint.cs @@ -17,6 +17,7 @@ namespace QFramework.Example public partial class UIHint : UIPanel { ResLoader loader; + IAction curAction; protected override void OnInit(IUIData uiData = null) { mData = uiData as UIHintData ?? new UIHintData(); @@ -31,16 +32,22 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { mData = uiData as UIHintData ?? new UIHintData(); + if (curAction != null) + { + curAction.Deinit(); + curAction = null; + } + Icon.gameObject.SetActive(mData.isShowIcon); Label.text = mData.txt; SetItem(1); if (mData.time != -1) { - ActionKit.Delay(mData.time, () => - { - SetItem(0); - - }).Start(this); + curAction = ActionKit.Delay(mData.time, () => + { + SetItem(0); + }); + curAction.Start(this); } if (string.IsNullOrEmpty(mData.audio) == false) { From 86f588515ce945c54f577a30d96f7b6b0a568405 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Wed, 8 Jan 2025 16:02:57 +0800 Subject: [PATCH 04/21] =?UTF-8?q?=E6=96=B0=E5=A2=9Etipwindow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/ActionHelper.cs | 5 ++ Assets/Scripts/Actions/TipWindowAction.cs | 69 +++++++++++++++++++ .../Scripts/Actions/TipWindowAction.cs.meta | 11 +++ Assets/Scripts/UI/UITipWindow.cs | 19 ++++- Assets/Scripts/Xml/XmlParser.cs | 1 + 5 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 Assets/Scripts/Actions/TipWindowAction.cs create mode 100644 Assets/Scripts/Actions/TipWindowAction.cs.meta diff --git a/Assets/Scripts/Actions/ActionHelper.cs b/Assets/Scripts/Actions/ActionHelper.cs index a13fb53d..d5a6a328 100644 --- a/Assets/Scripts/Actions/ActionHelper.cs +++ b/Assets/Scripts/Actions/ActionHelper.cs @@ -133,6 +133,11 @@ public class ActionHelper var strAction = (XMLTool.DictionaryAction)act; return ShowAction.Allocate(act.Value, strAction.args); } + case "TipWindow": + { + var strAction = (XMLTool.StringListAction)act; + return TipWindowAction.Allocate(act.Value, strAction.args[0], strAction.args[1]); + } case "TextTip": { var strAction = (XMLTool.StringListAction)act; diff --git a/Assets/Scripts/Actions/TipWindowAction.cs b/Assets/Scripts/Actions/TipWindowAction.cs new file mode 100644 index 00000000..e7a5540c --- /dev/null +++ b/Assets/Scripts/Actions/TipWindowAction.cs @@ -0,0 +1,69 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using QFramework; +using System; +using QFramework.Example; +using System.Linq; +public class TipWindowAction : IAction +{ + public ulong ActionID { get; set; } + public bool Deinited { get; set; } + public bool Paused { get; set; } + public ActionStatus Status { get; set; } + + private static readonly SimpleObjectPool mPool = + new SimpleObjectPool(() => new TipWindowAction(), null, 10); + string text = string.Empty; + string btns = string.Empty; + string audio = string.Empty; + public static TipWindowAction Allocate(string text, string audio, string btns, System.Action onDelayFinish = null) + { + var retNode = mPool.Allocate(); + retNode.ActionID = ActionKit.ID_GENERATOR++; + retNode.Deinited = false; + retNode.Reset(); + retNode.text = text; + retNode.btns = btns; + retNode.audio = audio; + return retNode; + } + + + + public void Deinit() + { + if (!Deinited) + { + Deinited = true; + mPool.Recycle(this); + } + } + + public void OnExecute(float dt) + { + } + + public void OnFinish() + { + } + + public void OnStart() + { + UITipWindowData data = new UITipWindowData(); + data.txt = text; + var btnText = btns.Split(',').ToList(); + foreach (var item in btnText) + { + data.btns.Add(new UITipWindowData.ItemData() { txt = item }); + } + data.audio = audio; + UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish()); + } + + public void Reset() + { + Status = ActionStatus.NotStart; + Paused = false; + } +} diff --git a/Assets/Scripts/Actions/TipWindowAction.cs.meta b/Assets/Scripts/Actions/TipWindowAction.cs.meta new file mode 100644 index 00000000..c465da72 --- /dev/null +++ b/Assets/Scripts/Actions/TipWindowAction.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 10573b9b3c343214bb0b5990d11f02f5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/UITipWindow.cs b/Assets/Scripts/UI/UITipWindow.cs index e4208481..6dde5a40 100644 --- a/Assets/Scripts/UI/UITipWindow.cs +++ b/Assets/Scripts/UI/UITipWindow.cs @@ -16,10 +16,12 @@ namespace QFramework.Example public Action OnClick; } public string txt; + public string audio; public List btns = new List(); } public partial class UITipWindow : UIPanel { + ResLoader loader; protected override void OnInit(IUIData uiData = null) { mData = uiData as UITipWindowData ?? new UITipWindowData(); @@ -44,6 +46,7 @@ namespace QFramework.Example { GameObject obj = GameObject.Instantiate(BtnPrefab.gameObject, BtnContent); obj.transform.Find("Label").GetComponent().text = item.txt; + obj.name = item.txt; obj.GetComponent