28 lines
771 B
C#
Raw Normal View History

2025-05-28 10:27:04 +05:00
using UnityEngine;
2025-06-03 04:27:14 +05:00
using System.Collections.Generic;
using System.Collections;
2025-06-23 14:13:43 +05:00
using System.Linq;
2025-05-28 10:27:04 +05:00
public class EmailLoader : MonoBehaviour
{
public Transform contentParent;
public GameObject emailItemPrefab;
2025-06-23 14:13:43 +05:00
public List<EmailData> emails;
2025-06-03 04:27:14 +05:00
IEnumerator Start()
2025-05-28 10:27:04 +05:00
{
2025-06-03 04:27:14 +05:00
yield return new WaitUntil(() => LanguageManager.Instance != null && LanguageManager.Instance.languageSetBool == true);
2025-05-28 10:27:04 +05:00
LoadEmails();
}
void LoadEmails()
{
2025-06-23 14:13:43 +05:00
emails = emails.OrderBy(e => Random.value).ToList();
2025-05-28 10:27:04 +05:00
foreach (var email in emails)
{
GameObject go = Instantiate(emailItemPrefab, contentParent);
var controller = go.GetComponent<EmailUIController>();
controller.Setup(email);
}
}
}