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/EmailPopupManager.cs

47 lines
1.2 KiB
C#

1 month ago
using UnityEngine;
public class EmailPopupManager : MonoBehaviour
{
public static EmailPopupManager Instance;
[Header("Alert Popup Reference")]
public GameObject hackedAlertImage; // 🔴 Assign in Inspector
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
return;
}
Instance = this;
if (hackedAlertImage != null)
hackedAlertImage.SetActive(false); // Hide on start
}
/// <summary>
/// Call this to show the hacked alert popup.
/// </summary>
/// <param name="linkID">Optional: the link clicked</param>
public void ShowPopup(string linkID)
{
Debug.Log($"🔐 Showing popup due to link: {linkID}");
if (hackedAlertImage != null)
{
hackedAlertImage.SetActive(true);
hackedAlertImage.transform.SetAsLastSibling();
}
// Optional: You could log/report/phish-specific response here
// e.g., start a fake login simulation, trigger scene event, etc.
}
public void HidePopup()
{
if (hackedAlertImage != null)
hackedAlertImage.SetActive(false);
}
}