Пример #1
0
        /// <summary>
        /// 退出视图
        /// </summary>
        /// <param name="viewId">视图id</param>
        /// <param name="options">选项</param>
        /// <param name="callback">退出完成回调</param>
        public void Quit(int viewId, QuitOptions options = QuitOptions.None, Action callback = null)
        {
            ViewState state;

            if (_viewDic.TryGetValue(viewId, out state))
            {
                if (state.active)
                {
                    state.active     = false;
                    _viewDic[viewId] = state;

                    OnViewQuitStartEvent?.Invoke(viewId);

                    _uiModule?.Quit(viewId, () =>
                    {
                        callback?.Invoke();
                        _uiModule?.UnFocus(viewId);
                        OnViewQuitCompletedEvent?.Invoke(viewId);
                    }, options.HasFlag(QuitOptions.Destroy));
                }
                else
                {
                    callback?.Invoke();
                }
            }
            else
            {
                callback?.Invoke();
            }

            ProcessQuitOptions(IntGroup.Get(viewId), options);
        }
Пример #2
0
 public void Quit(int viewId, bool anim = false, Action callback = null, bool destroy = false)
 {
     _uiModule?.Quit(viewId, anim, callback, destroy);
 }