新增input单位
This commit is contained in:
parent
7fb8fd3c64
commit
2d2a660edf
@ -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<TextMeshProUGUI>().text = item.name;
|
||||
input.transform.Find("Unit").GetComponent<TextMeshProUGUI>().text = item.unit;
|
||||
var inputField = input.transform.Find("Input").GetComponent<TMP_InputField>();
|
||||
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()
|
||||
|
||||
@ -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"))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user