public void DoShowUI(ShowHideDirection dir) { if (mShow) { return; } mShow = true; _DoShowUI(dir); _OnShow(); if (onShow != null) { onShow(); } }
public void DoHideUI(ShowHideDirection dir) { if (!mShow) { return; } mShow = false; if (GetComponent <Animation>() && GetComponent <Animation>().enabled&& dir != ShowHideDirection.none) { StartCoroutine("crRollOutAndHide", dir); } else { gameObject.SetActive(false); } _OnHide(); }
protected void _DoShowUI(ShowHideDirection dir) { StopAllCoroutines(); NGUITools.SetActive(gameObject, true); gameObject.AddMissingComponent <UIManagedPanel>(); NGUITools.BringForward(gameObject); if (GetComponent <Animation>() && GetComponent <Animation>().enabled) { GetComponent <Animation>().Rewind(); if (dir == ShowHideDirection.left) { GetComponent <Animation>().Play("UIRollInL"); } else if (dir == ShowHideDirection.right) { GetComponent <Animation>().Play("UIRollInR"); } } }
IEnumerator crRollOutAndHide(ShowHideDirection dir) { if (GetComponent <Animation>() && GetComponent <Animation>().enabled) { GetComponent <Animation>().Rewind(); if (dir == ShowHideDirection.left) { GetComponent <Animation>().Play("UIRollOutL"); } else if (dir == ShowHideDirection.right) { GetComponent <Animation>().Play("UIRollOutR"); } yield return(new WaitForSeconds(1)); gameObject.SetActive(false); } }