2024-12-11 14:24:06 +08:00
|
|
|
|
using System;
|
2024-12-06 11:29:20 +08:00
|
|
|
|
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>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-12-06 11:29:20 +08:00
|
|
|
|
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
|
|
|
|
|
2024-12-06 11:29:20 +08:00
|
|
|
|
public JSONReader jr;
|
|
|
|
|
|
|
|
|
|
public Text tasktxt;
|
|
|
|
|
|
2024-12-11 20:16:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-11 14:24:06 +08:00
|
|
|
|
|
2024-12-06 11:29:20 +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()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-12 11:04:48 +08:00
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-12-06 11:29:20 +08:00
|
|
|
|
public void SetInfo(int id,JSONReader js)
|
|
|
|
|
{
|
2024-12-11 20:16:45 +08:00
|
|
|
|
taskId = id;
|
2024-12-06 11:29:20 +08:00
|
|
|
|
jr = js;
|
2024-12-11 20:54:34 +08:00
|
|
|
|
|
2024-12-06 11:29:20 +08:00
|
|
|
|
UpdateTxt();
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-12 11:04:48 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>Text
|
2024-12-06 11:29:20 +08:00
|
|
|
|
void UpdateTxt()
|
|
|
|
|
{
|
|
|
|
|
|
2024-12-11 20:16:45 +08:00
|
|
|
|
Task_ info = jr.GetTaskByID(taskId);
|
2024-12-12 11:04:48 +08:00
|
|
|
|
//Debug.Log(info);
|
2024-12-11 20:54:34 +08:00
|
|
|
|
tasktxt.text = info.Note;
|
2024-12-06 11:29:20 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-12 11:04:48 +08:00
|
|
|
|
// <20><><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public void AddTrigger(int triggerType, string value)
|
|
|
|
|
{
|
|
|
|
|
triggers.Add(triggerType);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-12 14:50:53 +08:00
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>õĺ<C3B5><C4BA><EFBFBD>
|
|
|
|
|
public void OnTaskCompleted()
|
|
|
|
|
{
|
|
|
|
|
TaskPanel.instance.RemoveTask(taskId);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-06 11:29:20 +08:00
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|