TaiZhouChangChu/Assets/Script/LH/TaskControl/TaskModelBase.cs

108 lines
2.4 KiB
C#

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
//输入类型
public enum InputValueType
{
None,
InputField, //输入框
Toggle, //判断
Text, //文本框
DropDown //下拉框
}
//任务题目类型
public enum TaskType
{
None,
ObjOpration, //操作
Judgment, //判断
Blank, //填空
UIClick, //UI点击
ModelClick //模型点击
}
public class TaskModelBase : MonoBehaviour
{
//任务名称
public string taskName;
//任务分数
public float score;
//任务是否是单一的操作
public bool isSingle;
//任务类型
public TaskType type = TaskType.None;
//任务是否完成
public bool isComplete;
//任务关联的物体
public List<Transform> selcetTrans = new List<Transform>();
//输入类型
public InputValueType inputType;
//任务答案
public string answerText;
// Start is called before the first frame update
protected virtual void Start()
{
//Invoke("StartCheck", 2);
}
// Update is called once per frame
void Update()
{
}
public void StartCheck()
{
if (GameMannage.instance)
{
string name = "";
//GameMannage.instance.allTaskMessage.Add()
}
switch (type)
{
case TaskType.None:
break;
case TaskType.ObjOpration:
break;
case TaskType.Judgment:
break;
case TaskType.Blank:
break;
case TaskType.UIClick:
break;
case TaskType.ModelClick:
break;
}
switch (inputType)
{
case InputValueType.InputField:
answerText = selcetTrans[0].GetComponent<InputField>().text;
break;
case InputValueType.Toggle:
answerText = selcetTrans[0].GetComponent<Toggle>().isOn ? "true" : "false";
break;
case InputValueType.Text:
answerText = selcetTrans[0].GetComponent<Text>().text;
break;
case InputValueType.DropDown:
answerText = selcetTrans[0].GetComponent<Dropdown>().captionText.text;
break;
}
}
}