From 384a80b84a53780b05b6d7c82bda2ca769d437b4 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 16 Jan 2025 18:57:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A9=E5=B1=95result=E6=94=AF=E6=8C=81autoH?= =?UTF-8?q?ide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/ActionHelper.cs | 4 ++-- Assets/Scripts/Actions/ResultTipAction.cs | 10 +++++++--- Assets/Scripts/Xml/XmlParser.cs | 17 +++++++---------- Doc/Xml配置文档.xml | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Assets/Scripts/Actions/ActionHelper.cs b/Assets/Scripts/Actions/ActionHelper.cs index 166975b3..14a5fb1a 100644 --- a/Assets/Scripts/Actions/ActionHelper.cs +++ b/Assets/Scripts/Actions/ActionHelper.cs @@ -194,8 +194,8 @@ public class ActionHelper } case "ResultTip": { - var strAction = (XMLTool.StringListAction)act; - return ResultTipAction.Allocate(act.Value, strAction.args[0], strAction.args[1]); + var strAction = (XMLTool.DictionaryAction)act; + return ResultTipAction.Allocate(act.Value, strAction.args); } case "Led": { diff --git a/Assets/Scripts/Actions/ResultTipAction.cs b/Assets/Scripts/Actions/ResultTipAction.cs index 998c7abc..ac21c186 100644 --- a/Assets/Scripts/Actions/ResultTipAction.cs +++ b/Assets/Scripts/Actions/ResultTipAction.cs @@ -1,5 +1,6 @@ using QFramework.Example; using System; +using System.Collections.Generic; using UnityEngine; namespace QFramework @@ -19,15 +20,17 @@ namespace QFramework public string txt; public string isRight; public string finishedEvent; - public static ResultTipAction Allocate(string txt, string isRight, string finishedEvent, System.Action OnFinished = null) + string autoHide; + public static ResultTipAction Allocate(string txt, Dictionary datas, System.Action OnFinished = null) { var retNode = mPool.Allocate(); retNode.ActionID = ActionKit.ID_GENERATOR++; retNode.Deinited = false; retNode.Reset(); retNode.txt = txt; - retNode.isRight = isRight; - retNode.finishedEvent = finishedEvent; + retNode.isRight = datas.ContainsKey("isRight") ? datas["isRight"] : ""; + retNode.finishedEvent = datas.ContainsKey("finishedEvent") ? datas["finishedEvent"] : ""; + retNode.autoHide = datas.ContainsKey("autoHide") ? datas["autoHide"] : "-1"; retNode.OnFinished = OnFinished; return retNode; } @@ -45,6 +48,7 @@ namespace QFramework { data.callback = () => StringEventSystem.Global.Send(finishedEvent); } + float.TryParse(autoHide, out data.autoHideTime); UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish()); } diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index 46be7080..ab03bd78 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -779,7 +779,7 @@ namespace XMLTool } newAction = act; } - + break; case "LoadRes": { @@ -884,24 +884,21 @@ namespace XMLTool break; case "ResultTip": { - var act = new StringListAction(); + var act = new DictionaryAction(); XAttribute isRight = action.Attribute("isRight"); if (isRight != null) { - act.args.Add(isRight.Value); - } - else - { - act.args.Add("false"); + act.args.Add("isRight", isRight.Value); } XAttribute finishedEvent = action.Attribute("finishedEvent"); if (finishedEvent != null) { - act.args.Add(finishedEvent.Value); + act.args.Add("finishedEvent", finishedEvent.Value); } - else + XAttribute autoHide = action.Attribute("autoHide"); + if (autoHide != null) { - act.args.Add(""); + act.args.Add("autoHide", autoHide.Value); } newAction = act; } diff --git a/Doc/Xml配置文档.xml b/Doc/Xml配置文档.xml index 53edc77f..06b6f190 100644 --- a/Doc/Xml配置文档.xml +++ b/Doc/Xml配置文档.xml @@ -114,7 +114,7 @@ - +