2024-11-08 18:21:41 +08:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
public class LosePanel : MonoBehaviour
|
|
|
|
{
|
|
|
|
[SerializeField] private Button nextButton;
|
|
|
|
|
|
|
|
[SerializeField] private Button closeButton;
|
2024-11-26 15:44:50 +08:00
|
|
|
[SerializeField] private List<TaskItem> _taskItems;
|
2024-11-08 18:21:41 +08:00
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
private void OnEnable()
|
|
|
|
{
|
|
|
|
nextButton.onClick.AddListener(NextEvent);
|
|
|
|
closeButton.onClick.AddListener(CloseEvent);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnDisable()
|
|
|
|
{
|
|
|
|
nextButton.onClick.RemoveListener(NextEvent);
|
|
|
|
closeButton.onClick.RemoveListener(CloseEvent);
|
|
|
|
}
|
2024-11-26 15:44:50 +08:00
|
|
|
public void SaveData(int id)
|
|
|
|
{
|
|
|
|
var data=JsonTab.Instance.tables.Level.Get(id);
|
|
|
|
_taskItems[0].InitData(id, data.Maintasks);
|
|
|
|
for (int i = 1; i < _taskItems.Count; i++)
|
|
|
|
{
|
|
|
|
_taskItems[i].gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
for (int i = 0; i < data.Additionaltasks.Count; i++)
|
|
|
|
{
|
|
|
|
_taskItems[i+1].gameObject.SetActive(true);
|
|
|
|
_taskItems[i+1].InitData(id,data.Additionaltasks[i]);
|
|
|
|
}
|
|
|
|
}
|
2024-11-08 18:21:41 +08:00
|
|
|
void NextEvent()
|
|
|
|
{
|
2024-11-26 15:44:50 +08:00
|
|
|
MainPanel.ins.AddTourPanel(10);
|
|
|
|
gameObject.SetActive(false);
|
2024-11-08 18:21:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void CloseEvent()
|
|
|
|
{
|
2024-11-26 15:44:50 +08:00
|
|
|
MainPanel.ins.ClosePanelEvent();
|
2024-11-08 18:21:41 +08:00
|
|
|
}
|
|
|
|
}
|