From ed2f790dd31cab9ad72ebcfe041b494483b47314 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Fri, 27 Dec 2024 14:08:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=AB=98=E4=BA=AE=E6=94=AF?= =?UTF-8?q?=E6=8C=81deviceName?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/ActionHelper.cs | 4 ++-- Assets/Scripts/Actions/HighLightAction.cs | 28 +++++++++++++++++++---- Assets/Scripts/Xml/XmlParser.cs | 15 +++++------- Doc/Xml配置文档.xml | 10 ++++---- 4 files changed, 36 insertions(+), 21 deletions(-) diff --git a/Assets/Scripts/Actions/ActionHelper.cs b/Assets/Scripts/Actions/ActionHelper.cs index 029a5ec5..cebc9620 100644 --- a/Assets/Scripts/Actions/ActionHelper.cs +++ b/Assets/Scripts/Actions/ActionHelper.cs @@ -159,8 +159,8 @@ public class ActionHelper } case "HighLight": { - var strAction = (XMLTool.StringListAction)act; - return HighLightAction.Allocate(act.Value, strAction.args[0], strAction.args[1]); + var strAction = (XMLTool.DictionaryAction)act; + return HighLightAction.Allocate(act.Value, strAction.args); } case "LoadRes": { diff --git a/Assets/Scripts/Actions/HighLightAction.cs b/Assets/Scripts/Actions/HighLightAction.cs index 3ffdb92d..ce7e9687 100644 --- a/Assets/Scripts/Actions/HighLightAction.cs +++ b/Assets/Scripts/Actions/HighLightAction.cs @@ -1,5 +1,6 @@ using HighlightPlus; using System; +using System.Collections.Generic; using UnityEditor; using UnityEngine; @@ -22,18 +23,26 @@ namespace QFramework string path; Color color = Color.green; bool isHigh = true; - public static HighLightAction Allocate(string path, string isHigh, string color, System.Action OnFinished = null) + string deviceName = string.Empty; + public static HighLightAction Allocate(string path, Dictionary datas, System.Action OnFinished = null) { var retNode = mPool.Allocate(); retNode.ActionID = ActionKit.ID_GENERATOR++; retNode.Deinited = false; retNode.Reset(); retNode.path = path; - if (string.IsNullOrEmpty(color) == false) + + if (datas.ContainsKey("color")) { - retNode.color = Utility.ToColor(color); + + retNode.color = Utility.ToColor(datas["color"]); + } - bool.TryParse(isHigh, out retNode.isHigh); + if (datas.ContainsKey("isHigh")) + { + bool.TryParse(datas["isHigh"], out retNode.isHigh); + } + retNode.deviceName = datas.ContainsKey("deviceName") ? datas["deviceName"] : string.Empty; retNode.OnFinished = OnFinished; return retNode; } @@ -44,7 +53,16 @@ namespace QFramework public void OnStart() { - GameObject obj = Utility.FindObj(path); + GameObject obj = null; + if (string.IsNullOrEmpty(deviceName) == false) + { + obj = DeviceController.Instance.GetDeviceObj(deviceName); + } + else + { + obj = Utility.FindObj(path); + } + if (obj != null) { if (isHigh) diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index 5e112adf..9d04ce66 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -763,24 +763,21 @@ namespace XMLTool break; case "HighLight": { - var act = new StringListAction(); + var act = new DictionaryAction(); XAttribute isHigh = action.Attribute("isHigh"); if (isHigh != null) { - act.args.Add(isHigh.Value); - } - else - { - act.args.Add("true"); + act.args.Add("isHigh", isHigh.Value); } XAttribute color = action.Attribute("color"); if (color != null) { - act.args.Add(color.Value); + act.args.Add("color", color.Value); } - else + XAttribute deviceName = action.Attribute("deviceName"); + if (deviceName != null) { - act.args.Add(""); + act.args.Add("deviceName", deviceName.Value); } newAction = act; } diff --git a/Doc/Xml配置文档.xml b/Doc/Xml配置文档.xml index 03669536..48307bd2 100644 --- a/Doc/Xml配置文档.xml +++ b/Doc/Xml配置文档.xml @@ -57,8 +57,8 @@ - - + + - - + + @@ -112,7 +112,7 @@ needClick如果为true 动画结束后不会自动小时 需要点击空白处 reverse 是时钟倒计时动画是否倒序播放 format="{0:F1}" F1代表保留1位小数 F2代表2位 F0代表不保留小数 - --> + -->