public void SetVisible(bool visible) { if (uiRoot == null) { return; } if (!tabButton.isEnabled == visible) { return; } tabButton.SetButtonActive(!visible); if (visible) { GetComponentInParent <UIPanel>().ArrangeRenderQueue(); GetContents(seed, () => { // tab selection may be changed after GetContents() is called if (!tabButton.isEnabled) { PreOpen(); eventReg.RegisterEvents(); uiRoot.SetActive(true); if (buttons != null) { buttons.enabled = true; } SetContents(); NGUIUtil.Reposition(transform); } }); } else { if (tabButton.isEnabled) { uiRoot.SetActive(false); if (buttons != null) { buttons.enabled = false; } eventReg.DeregisterEvents(); PostClose(); } } TabSelectChange(visible); }
private void OnShowBegin() { try { if (window.buttonHandler != null) { window.buttonHandler.enabled = false; } log.Debug("{0} ShowBegin", name); EventRegistry.SendEvent(name, this); baseLayer = InputListenerStack.inst.GetStackTop(); InputListenerStack.inst.Push(this); PreOpen(); eventReg.RegisterEvents(); if (onShowBegin != null) { onShowBegin(); } } catch (Exception ex) { log.Error(ex); } }