using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using DG.Tweening; public class TaskPanel : Base { public List taskId = new List(); public Transform contentTrans; public GameObject taskPrefab; public JSONReader JSONReader; public Dictionary taskDic = new Dictionary(); public Button closeBtn; private bool isOpen = false; // Start is called before the first frame update void Start() { closeBtn.onClick.AddListener(CloseBtn); InitTask(); } public void InitTask() { for(int i = 0; i < taskId.Count;i++) { GameObject go = GameObject.Instantiate(taskPrefab, contentTrans); go.transform.name = "Task_" + i; } } public void CloseBtn() { if (isOpen)//关闭任务面板 { isOpen = false; } else//打开任务面板 { isOpen = true; } } // Update is called once per frame void Update() { } }