2022-03-10 18:10:34 +08:00
|
|
|
|
using Assets.Scripts;
|
|
|
|
|
|
using Assets.Scripts.Apis.Models;
|
2022-03-02 17:03:29 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
|
|
public class MailListController : PFUIPanel
|
|
|
|
|
|
{
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
|
ScrollRect scroll;
|
|
|
|
|
|
GameObject mail;
|
|
|
|
|
|
protected override void Awake()
|
|
|
|
|
|
{
|
|
|
|
|
|
UIManager.AddEvent(transform.Find("Container/Exit").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
|
|
|
|
|
{
|
|
|
|
|
|
Close();
|
|
|
|
|
|
});
|
|
|
|
|
|
scroll = transform.Find("Container/Content/Right/Scroll View").GetComponent<ScrollRect>();
|
|
|
|
|
|
#if UNITY_STANDALONE_WIN
|
|
|
|
|
|
mail = Resources.Load<GameObject>("UI/Prefab/Mail/MailItem");
|
2022-03-03 14:38:51 +08:00
|
|
|
|
#else
|
|
|
|
|
|
mail = Resources.Load<GameObject>("UI/Prefab/Mail/MailItem-mob");
|
2022-03-02 17:03:29 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
public override void Show()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Show();
|
|
|
|
|
|
DisplayMails(App.CurrentUserMails);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void DisplayMails(List<MailModel> list)
|
|
|
|
|
|
{
|
2022-03-10 18:10:34 +08:00
|
|
|
|
if (list == null) return;
|
|
|
|
|
|
scroll.content.DestroyChildren();
|
2022-03-02 17:03:29 +08:00
|
|
|
|
if (mail != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
|
{
|
|
|
|
|
|
var obj = Instantiate(mail);
|
|
|
|
|
|
obj.GetComponent<MailItemController>().Initial(item);
|
|
|
|
|
|
//obj.SendMessage("Initial", );
|
|
|
|
|
|
obj.transform.SetParent(scroll.content.transform);
|
|
|
|
|
|
obj.transform.localScale = new Vector3(1, 1, 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
|
void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|