public void OnPointerDown(PointerEventData eventData) { if (windowInterface != null) { windowInterface.SetAsLastSibling(); } if (!popupOpen) { return; } var popups = GetComponentsInChildren <CW_Popup>(); for (int i = popups.Length - 1; i >= 0; i--) { CW_Popup popup = popups[i]; if (popup == null) { continue; } if (!popup.gameObject.activeSelf) { FadePopup(popup); continue; } RectTransform r = popup.GetComponent <RectTransform>(); if (r == null) { continue; } if (RectTransformUtility.RectangleContainsScreenPoint(r, eventData.position, eventData.pressEventCamera)) { continue; } FadePopup(popup); popupOpen = false; } }
public void FadePopup(CW_Popup p) { popupOpen = false; p.FadeOut(p.ClosePopup); }