/// <summary> /// Gets called When Widget Pushed. /// </summary> /// <param name="IsPlayTween"> Play OnHide Tween of Current Widget </param> public void Show(bool IsPlayTween = true) { if (OnShow != null) { OnShow.Invoke(); } gameObject.SetActive(true); if (IsPlayTween) { if (Tweens != null) { Tweens.PerformOnShowTweens(gameObject); } } IsActive = true; CanvasGroup.interactable = true; }
/// <summary> /// Gets called when Widget poped /// </summary> /// <param name="IsPlayTween"> Play OnShow Tween of previous widget </param> public void Hide(bool IsPlayTween = true) { if (OnHide != null) { OnHide.Invoke(); } if (IsPlayTween) { if (Tweens != null) { Tweens.PerformOnHideTweens(gameObject, () => { gameObject.SetActive(false); }); } } else { gameObject.SetActive(false); } IsActive = false; }
/// <summary> /// 派发事件 /// </summary> protected void DipatchEvent() { TriggerHandler?.Invoke(this); }