2024-12-05 16:31:46 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
using DG.Tweening;
|
|
|
|
|
|
|
|
|
|
public class TaskPanel : Base
|
|
|
|
|
{
|
2024-12-06 11:29:20 +08:00
|
|
|
|
public static TaskPanel instance;
|
|
|
|
|
|
2024-12-05 20:21:15 +08:00
|
|
|
|
public List<int> taskId = new List<int>();
|
|
|
|
|
|
|
|
|
|
public Transform contentTrans;
|
|
|
|
|
|
|
|
|
|
public GameObject taskPrefab;
|
|
|
|
|
|
|
|
|
|
public JSONReader JSONReader;
|
|
|
|
|
|
|
|
|
|
public Dictionary<int, Language> taskDic = new Dictionary<int, Language>();
|
|
|
|
|
|
2024-12-05 16:31:46 +08:00
|
|
|
|
public Button closeBtn;
|
|
|
|
|
|
|
|
|
|
private bool isOpen = false;
|
|
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
2024-12-06 11:29:20 +08:00
|
|
|
|
instance = this;
|
2024-12-05 16:31:46 +08:00
|
|
|
|
closeBtn.onClick.AddListener(CloseBtn);
|
2024-12-05 20:21:15 +08:00
|
|
|
|
|
2024-12-06 11:29:20 +08:00
|
|
|
|
|
2024-12-05 20:21:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void InitTask()
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < taskId.Count;i++)
|
|
|
|
|
{
|
|
|
|
|
GameObject go = GameObject.Instantiate(taskPrefab, contentTrans);
|
|
|
|
|
go.transform.name = "Task_" + i;
|
2024-12-06 11:29:20 +08:00
|
|
|
|
TaskItem item = go.GetComponent<TaskItem>();
|
|
|
|
|
item.SetInfo(taskId[i], JSONReader);
|
2024-12-05 20:21:15 +08:00
|
|
|
|
}
|
2024-12-05 16:31:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-12-05 20:21:15 +08:00
|
|
|
|
|
2024-12-06 11:29:20 +08:00
|
|
|
|
public void SetInfo(int id)
|
|
|
|
|
{
|
|
|
|
|
taskId.Add(id);
|
|
|
|
|
InitTask();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-12-05 16:31:46 +08:00
|
|
|
|
public void CloseBtn()
|
|
|
|
|
{
|
|
|
|
|
if (isOpen)//<2F>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isOpen = false;
|
|
|
|
|
}
|
|
|
|
|
else//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isOpen = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-05 20:21:15 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-05 16:31:46 +08:00
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
2024-12-06 11:29:20 +08:00
|
|
|
|
if(Input.GetKeyDown(KeyCode.J))
|
|
|
|
|
{
|
|
|
|
|
SetInfo(11001);
|
|
|
|
|
}
|
2024-12-05 16:31:46 +08:00
|
|
|
|
}
|
|
|
|
|
}
|