58 lines
1.4 KiB
C#
58 lines
1.4 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.IO;
|
|||
|
using LitJson;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
public class MailObject : MonoBehaviour
|
|||
|
{
|
|||
|
public Button btnMail;
|
|||
|
public Button btnDel;
|
|||
|
public Text txtMail;
|
|||
|
|
|||
|
private MailInfo mailInfo;
|
|||
|
|
|||
|
public GameObject imgGet;
|
|||
|
|
|||
|
// Start is called before the first frame update
|
|||
|
void Awake()
|
|||
|
{
|
|||
|
imgGet.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
void Start()
|
|||
|
{
|
|||
|
btnMail.onClick.AddListener(() =>
|
|||
|
{
|
|||
|
if (!mailInfo.isOpen)
|
|||
|
{
|
|||
|
UIManager.Instance.ShowPanel<MailTwoPanel>().UpedatePanel(mailInfo,imgGet);
|
|||
|
}
|
|||
|
});
|
|||
|
btnDel.onClick.AddListener(()=>
|
|||
|
{
|
|||
|
if (mailInfo.isOpen)
|
|||
|
{
|
|||
|
Destroy(gameObject);
|
|||
|
}
|
|||
|
});
|
|||
|
btnDel.onClick.AddListener(() =>
|
|||
|
{
|
|||
|
UIManager.Instance.GetPanel<MailPanel>().info.Remove(mailInfo);
|
|||
|
UIManager.Instance.GetPanel<MailPanel>().SaveMailData();
|
|||
|
UIManager.Instance.GetPanel<MailPanel>().UpdatePanel();
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
public void UpdatePanel(MailInfo mail)
|
|||
|
{
|
|||
|
mailInfo = mail;
|
|||
|
txtMail.text = "<22>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> "+ mail.mailData.send_at+ "\n<>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> "+mail.mailData.send_end;
|
|||
|
if (mail.isOpen)
|
|||
|
{
|
|||
|
imgGet.SetActive(true);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|