60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
|
|
using Assets.Scripts;
|
|||
|
|
using Assets.Scripts.Apis.Models;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.UI;
|
|||
|
|
|
|||
|
|
public class MailDetailController : PFUIPanel
|
|||
|
|
{
|
|||
|
|
// Start is called before the first frame update
|
|||
|
|
ScrollRect scroll;
|
|||
|
|
protected override void Awake()
|
|||
|
|
{
|
|||
|
|
UIManager.AddEvent(transform.Find("Container/Exit").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, async b =>
|
|||
|
|
{
|
|||
|
|
CloseSelf();
|
|||
|
|
});
|
|||
|
|
UIManager.AddEvent(transform.Find("Container/BtnDelete").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
|||
|
|
{
|
|||
|
|
UIManager.ShowConfirm(App.GetLocalString("Delete"), App.GetLocalString("Are you sure you want to delete this email?"), async () =>
|
|||
|
|
{
|
|||
|
|
if (mail != null)
|
|||
|
|
{
|
|||
|
|
await ConfigHelper.mailApi.Delete(mail.Id);
|
|||
|
|
Utils.showToast(null, "Success", type: 1);
|
|||
|
|
UIManager.CloseConfirm();
|
|||
|
|
CloseSelf();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
scroll = transform.Find("Container/Content/Scroll View").GetComponent<ScrollRect>();
|
|||
|
|
}
|
|||
|
|
void Start()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Update is called once per frame
|
|||
|
|
void Update()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
MailModel mail;
|
|||
|
|
public async void Initial(MailModel item)
|
|||
|
|
{
|
|||
|
|
this.mail = item;
|
|||
|
|
await ConfigHelper.mailApi.MarkRead(item.Id);
|
|||
|
|
transform.Find("Container/Title").GetComponent<Text>().text = item.Title;
|
|||
|
|
scroll.content.Find("Text").GetComponent<Text>().text = $"{item.Desc}\n\n{item.SendNickName}";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private async void CloseSelf()
|
|||
|
|
{
|
|||
|
|
Close();
|
|||
|
|
await MailReceiver.Instance().GetMessage();
|
|||
|
|
UIManager.Instance.MailListController.Show();
|
|||
|
|
}
|
|||
|
|
}
|