public virtual void Close(bool force) { if (_needCloseFader) { _needCloseFader = false; DialogFader.FadeOut(this, _faderDuration, force, () => FaderVisible = false); } _canvasGroup.blocksRaycasts = false; if (force) { if (_state == FormState.Closed && !gameObject.activeSelf) { return; } OnClose(); if (CloseEvent != null) { CloseEvent(); } OnClosed(); if (ClosedEvent != null) { ClosedEvent.Invoke(); } gameObject.SetActive(false); } else { if (IsClose) { return; } _state = FormState.Closing; OnClose(); if (CloseEvent != null) { CloseEvent(); } if (_processRoutine != null) { StopCoroutine(_processRoutine); } _processRoutine = CloseAsync(); StartCoroutine(_processRoutine); } }
public virtual void Destroy() { if (_needCloseFader) { _needCloseFader = false; DialogFader.FadeOut(this, true, () => FaderVisible = false); } if (gameObject != null) { if (UIManager.UseCache && UIManager.Instance.IsFormCached(this)) { gameObject.SetActive(false); } else { Destroy(gameObject); } } }
private void OpenInternal(bool setAsLastSibling, params object[] args) { if (IsOpen) { return; } WasEnabled = !gameObject.activeSelf; gameObject.SetActive(true); _canvasGroup.blocksRaycasts = true; if (setAsLastSibling) { transform.SetAsLastSibling(); } if (_showFader) { _needCloseFader = true; DialogFader.FadeIn(this, _faderDuration, () => FaderVisible = true); } _state = FormState.Opening; OnOpen(args); if (OpenEvent != null) { OpenEvent.Invoke(); } if (_processRoutine != null) { StopCoroutine(_processRoutine); } _processRoutine = OpenAsync(); if (!IsClose) // form might be closed in OpenEvent handlers { StartCoroutine(_processRoutine); } }