UIInput支持单位配置
This commit is contained in:
parent
9d0bd2119f
commit
6145e8636a
@ -14,6 +14,7 @@ namespace QFramework.Example
|
|||||||
public string name;
|
public string name;
|
||||||
public string var;
|
public string var;
|
||||||
public string answer;
|
public string answer;
|
||||||
|
public string unit;
|
||||||
}
|
}
|
||||||
public class BtnData
|
public class BtnData
|
||||||
{
|
{
|
||||||
@ -55,6 +56,7 @@ namespace QFramework.Example
|
|||||||
GameObject input = GameObject.Instantiate(InputItem.gameObject, InputContent);
|
GameObject input = GameObject.Instantiate(InputItem.gameObject, InputContent);
|
||||||
input.name = item.name;
|
input.name = item.name;
|
||||||
input.transform.Find("Name").GetComponent<TextMeshProUGUI>().text = 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>();
|
var inputField = input.transform.Find("Input").GetComponent<TMP_InputField>();
|
||||||
inputField.onEndEdit.AddListener(value =>
|
inputField.onEndEdit.AddListener(value =>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1548,6 +1548,7 @@ namespace XMLTool
|
|||||||
inputData.answer = item.Attribute("answer")?.Value;
|
inputData.answer = item.Attribute("answer")?.Value;
|
||||||
inputData.var = item.Attribute("var")?.Value;
|
inputData.var = item.Attribute("var")?.Value;
|
||||||
inputData.name = item.Attribute("name")?.Value;
|
inputData.name = item.Attribute("name")?.Value;
|
||||||
|
inputData.unit = item.Attribute("unit")?.Value;
|
||||||
act.data.inputs.Add(inputData);
|
act.data.inputs.Add(inputData);
|
||||||
}
|
}
|
||||||
foreach (var item in action.Elements("Btn"))
|
foreach (var item in action.Elements("Btn"))
|
||||||
|
|||||||
@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
<!--输入框
|
<!--输入框
|
||||||
title 显示的题目
|
title 显示的题目
|
||||||
Input 为输入框(可多个) var里面存储是输入值
|
Input 为输入框(可多个) var里面存储是输入值 unit 为输入框后面的内容
|
||||||
btn 为按钮(可多个)
|
btn 为按钮(可多个)
|
||||||
checkAnswer 是否开启检查答案
|
checkAnswer 是否开启检查答案
|
||||||
answer 是正确答案 用|分割 可以支持多个正确答案
|
answer 是正确答案 用|分割 可以支持多个正确答案
|
||||||
@ -93,7 +93,7 @@
|
|||||||
wrongScore错误的分数 (每错一次扣一次分)
|
wrongScore错误的分数 (每错一次扣一次分)
|
||||||
-->
|
-->
|
||||||
<Action type="Input" title="请输入" finishedEvent="UI关闭事件通知用StrEvent接收">
|
<Action type="Input" title="请输入" finishedEvent="UI关闭事件通知用StrEvent接收">
|
||||||
<Input name="数字1:" var="变量1" answer="100|200"></Input>
|
<Input name="数字1:" var="变量1" answer="100|200" unit=""></Input>
|
||||||
<Input name="数字2:" var="变量2" answer="200|400"></Input>
|
<Input name="数字2:" var="变量2" answer="200|400"></Input>
|
||||||
<Btn name="确定" clickEvent="确定点击" checkAnswer="true" wrongLabel="输入错误" wrongCount="3" autoHide="-1" scoreStepName="" rightScore="0" wrongScore="-1"></Btn>
|
<Btn name="确定" clickEvent="确定点击" checkAnswer="true" wrongLabel="输入错误" wrongCount="3" autoHide="-1" scoreStepName="" rightScore="0" wrongScore="-1"></Btn>
|
||||||
<Btn name="取消"></Btn>
|
<Btn name="取消"></Btn>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user