You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PhishingAwarenessSimulation/Assets/Scripts/EmailLoader.cs

28 lines
771 B
C#

using UnityEngine;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
public class EmailLoader : MonoBehaviour
{
public Transform contentParent;
public GameObject emailItemPrefab;
public List<EmailData> emails;
IEnumerator Start()
{
yield return new WaitUntil(() => LanguageManager.Instance != null && LanguageManager.Instance.languageSetBool == true);
LoadEmails();
}
void LoadEmails()
{
emails = emails.OrderBy(e => Random.value).ToList();
foreach (var email in emails)
{
GameObject go = Instantiate(emailItemPrefab, contentParent);
var controller = go.GetComponent<EmailUIController>();
controller.Setup(email);
}
}
}