protected virtual void addEventsToList() { _showReadyEvent = UIEvents.Event(_UIType, UIEventEnum.SHOW_READY); _hideReadyEvent = UIEvents.Event(_UIType, UIEventEnum.HIDE_READY); addInterestedEvent(_showReadyEvent); addInterestedEvent(_hideReadyEvent); }
public virtual void Hide(bool playAnimation = true, FuncCallback0 onReadyCallback = null) { _hideReadyCallback = onReadyCallback; if (playAnimation && _Animator != null) { _Animator.Play(HIDE_STATE); } else { if (_UIType == UITypeEnum.UI_UNKNOWN) { onHideReady(); } else { GIIControlCenter.Instance.FireEvent(UIEvents.Event(_UIType, UIEventEnum.HIDE_READY)); } } }
public virtual void Show(bool playAnimation = true, FuncCallback0 onReadyCallback = null) { _showReadyCallback = onReadyCallback; if (_Canvas != null) { _Canvas.SetActive(true); } gameObject.SetActive(true); UpdateData(); GIIControlCenter.Instance.RegisterEventObserverEx(this); // BUG:直接显示在屏幕上的UI可能因为没有注册消息,导致无法关闭 if (playAnimation && _Animator != null) { _Animator.Play(SHOW_STATE); } else { GIIControlCenter.Instance.FireEvent(UIEvents.Event(_UIType, UIEventEnum.SHOW_READY)); // onShowReady (); } }