/// <summary> /// Given data, show overlay /// </summary> /// <param name="data"></param> public void ShowOverlay(OverlayBehavior data) { overlayBehaviorsToDisplay.Enqueue(data); if (currentlyDisplayingOverlay == null) { currentlyDisplayingOverlay = StartCoroutine(ShowingOverlay()); } }
/// <summary> /// Given data, show overlay. /// Only works once per application per overlay data /// </summary> public void ShowOverlayOncePerApplication(OverlayBehavior data) { if (PlayerPrefs.HasKey(data.uniqueID)) { return; } PlayerPrefs.SetInt(data.uniqueID, 1); ShowOverlay(data); }
public void Init(OverlayBehavior behavior) { if (behavior.NumberOfSteps == 0) { return; } Data = behavior; currentStep = 0; closeOverlayButton.gameObject.SetActive(false); UpdateStepButtonStatus(); UpdateCurrentStep(); gameObject.SetActive(true); }
/// <summary> /// Iterates and displays all queued overlays /// </summary> private IEnumerator ShowingOverlay() { while (overlayBehaviorsToDisplay.Count != 0) { OverlayBehavior data = overlayBehaviorsToDisplay.Dequeue(); PrimaryInit(data.GetScreenPositionOfOverlay()); primaryOverlay.Init(data); yield return(new WaitUntil(() => closeOverlayFlag)); closeOverlayFlag = false; } currentlyDisplayingOverlay = null; }