扩展result支持autoHide

This commit is contained in:
shenjianxing 2025-01-16 18:57:42 +08:00
parent b5a79921a9
commit 384a80b84a
4 changed files with 17 additions and 16 deletions

View File

@ -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":
{

View File

@ -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<string, string> 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<UIResultTip>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish());
}

View File

@ -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;
}

View File

@ -114,7 +114,7 @@
<!--相机锁定 是否可以移动 isMove 是否可以旋转镜头 isRotate-->
<Action type="CameraLock" isMove="false" isRotate="false"></Action>
<!--正确和错误的弹窗 isRight 是否正确-->
<Action type="ResultTip" value="这里是一个弹窗" isRight="true" finishedEvent="关闭弹窗事件"></Action>
<Action type="ResultTip" value="这里是一个弹窗" isRight="true" finishedEvent="关闭弹窗事件" autoHide="1"></Action>
<!--Led数字显示 要求每个数字单独一个模型面片,所有数字面片放在一个物体的子级,第一个物体是最右侧的数字,只能放数字面片模型 不要放其他的东西
number 是数值 支持 小数点和横线 例如 12.34 3-5 -->