public void HideChildren(FreeUIObject[] children, bool instantly, LayoutActionCompleted onCompleted) { if (waitForHideFunction != null) { StopCoroutine(waitForHideFunction); waitForHideFunction = null; } if (instantly) { for (int i = 0; i < children.Length; i++) { children [i].Hide(true); } if (onCompleted != null) { onCompleted(); } } else { waitForHideFunction = WaitOnChildren(children, true, onCompleted); StartCoroutine(waitForHideFunction); } }
IEnumerator WaitOnChildren(FreeUIObject[] children, bool waitOnHide, LayoutActionCompleted onCompleted) { bool waiting = true; for (int i = 0; i < children.Length; i++) { if (!waitOnHide) { children [i].Show(false); } else { children [i].Hide(false); } } while (waiting) { waiting = false; for (int i = 0; i < children.Length; i++) { if (!waitOnHide) { if (!children [i].IsInteractive()) { waiting = true; } } else { if (children[i].IsUIObjectVisible()) { waiting = true; } } } yield return(eof); } if (onCompleted != null) { onCompleted(); } if (waitOnHide) { waitForHideFunction = null; } else { waitForShowFunction = null; } }
void LayoutHidden() { if (_layoutHidden != null) { _layoutHidden(); } _layoutHidden = null; CachedGameObject.SetActive(false); }
public void HideLayout(bool instantly, LayoutActionCompleted onCompleted) { if (alwaysHideInstantly) { instantly = true; } _layoutHidden = onCompleted; _layoutShowCompleted = null; _layoutHideCompleted = onCompleted; OnHideLayout(instantly, LayoutHidden); }
public void ShowLayout(bool instantly, LayoutActionCompleted onCompleted) { Initialize(); if (alwaysShowInstantly) { instantly = true; } CachedGameObject.SetActive(true); _layoutShowCompleted = onCompleted; _layoutHideCompleted = null; OnShowLayout(instantly, onCompleted); RefreshLayout(); }
public abstract void OnHideLayout(bool instantly, LayoutActionCompleted onCompleted);