public static void ShowPopup(GameObject popup, Action callback = null) { // Reset button scale popup.ResetButtonScale(true); // Show popup popup.Show(); // Fade-in popup.Play(FadeAction.FadeTo(popupEndOpacity, popupDuration)); // Content GameObject content = popup.FindInChildren("Popup"); if (content != null) { content.transform.localScale = popupStartScale; var zoomOut = ScaleAction.ScaleTo(popupEndScale, popupDuration * 0.7f); var zoomIn = ScaleAction.ScaleTo(Vector3.one, popupDuration * 0.3f); var action = SequenceAction.Create(zoomOut, zoomIn); content.Play(action, callback); } else { if (callback != null) { callback(); } } }
public virtual void Show(Action callback = null) { // Hide gameObject.SetAlpha(0, true); // Hide touch and overlay SetShowTouchAndOverlay(false); // Disable UI SetUIEnabled(false); // Show gameObject.Show(); // Overlay gameObject.Play(FadeAction.FadeTo(0.8f, this.OverlayDuration), () => { // Background background.Play(FadeAction.RecursiveFadeIn(fadeDuration), () => { OnShowFinished(callback); }); }); }