diff --git a/Assets/Scripts/UI/UIInput.cs b/Assets/Scripts/UI/UIInput.cs index d0621feb..87e8d159 100644 --- a/Assets/Scripts/UI/UIInput.cs +++ b/Assets/Scripts/UI/UIInput.cs @@ -14,6 +14,7 @@ namespace QFramework.Example public string name; public string var; public string answer; + public string unit; } public class BtnData { @@ -55,6 +56,7 @@ namespace QFramework.Example GameObject input = GameObject.Instantiate(InputItem.gameObject, InputContent); input.name = item.name; input.transform.Find("Name").GetComponent().text = item.name; + input.transform.Find("Unit").GetComponent().text = item.unit; var inputField = input.transform.Find("Input").GetComponent(); inputField.onEndEdit.AddListener(value => { @@ -158,17 +160,17 @@ namespace QFramework.Example } else { - + if (!list.Contains(VarController.Instance.Get(item.var).ToString())) { - + allCorrect = false; // 变量值不匹配时标记为有错误 } } } return allCorrect; // 返回所有输入是否都正确的结果 - + } protected override void OnShow() diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index 712b94bf..9ac4a4f4 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -1529,6 +1529,7 @@ namespace XMLTool inputData.answer = item.Attribute("answer")?.Value; inputData.var = item.Attribute("var")?.Value; inputData.name = item.Attribute("name")?.Value; + inputData.unit = item.Attribute("unit")?.Value; act.data.inputs.Add(inputData); } foreach (var item in action.Elements("Btn"))