_xiaofang/xiaofang/Assets/Prefabs/HYLPrefabs/TaskItem.cs

80 lines
1.3 KiB
C#
Raw Normal View History

2024-12-11 14:24:06 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
2024-12-11 20:16:45 +08:00
public enum TaskStatus
{
NotAccepted, // δ<><CEB4><EFBFBD><EFBFBD>
InProgress, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Completed, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Failed // ʧ<><CAA7>
}
public class TaskItem : MonoBehaviour
{
2024-12-11 20:16:45 +08:00
public int taskId;
public string taskName;
public TaskStatus status;
public List<int> triggers; // <20><EFBFBD><E6B4A2><EFBFBD>񴥷<EFBFBD><F1B4A5B7><EFBFBD><EFBFBD><EFBFBD>
2024-12-11 14:24:06 +08:00
public JSONReader jr;
public Text tasktxt;
2024-12-11 20:16:45 +08:00
2024-12-11 14:24:06 +08:00
// Start is called before the first frame update
void Start()
{
}
2024-12-11 20:16:45 +08:00
//<2F><><EFBFBD><EFBFBD><ECBAAF>
public TaskItem(int id, string name)
{
taskId = id;
taskName = name;
status = TaskStatus.NotAccepted;
triggers = new List<int>();
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
public void SetStatus(TaskStatus newStatus)
{
status = newStatus;
}
2024-12-11 14:24:06 +08:00
private void OnClickButton()
{
}
public void SetInfo(int id,JSONReader js)
{
2024-12-11 20:16:45 +08:00
taskId = id;
jr = js;
UpdateTxt();
}
void UpdateTxt()
{
2024-12-11 20:16:45 +08:00
Task_ info = jr.GetTaskByID(taskId);
Debug.Log(info);
tasktxt.text = info.Note;
}
// Update is called once per frame
void Update()
{
}
}