Exemple #1
0
        /// <summary>
        /// 进入视图
        /// </summary>
        /// <param name="viewId">视图id</param>
        /// <param name="options">选项</param>
        /// <param name="callback">进入完成回调</param>
        public void Enter(int viewId, EnterOptions options = EnterOptions.None, Action callback = null)
        {
            ProcessEnterOptions(IntGroup.Get(viewId), options);

            ViewState state;

            _viewDic.TryGetValue(viewId, out state);

            if (!state.active)
            {
                state.active     = true;
                _viewDic[viewId] = state;

                OnViewEnterStartEvent?.Invoke(viewId);

                _uiModule?.Enter(viewId, () =>
                {
                    callback?.Invoke();
                    _uiModule?.Focus(viewId);
                    OnViewEnterCompletedEvent?.Invoke(viewId);
                });
            }
            else
            {
                _uiModule?.Focus(viewId);
                callback?.Invoke();
            }
        }
Exemple #2
0
 /// <summary>
 /// 处理进入选项
 /// </summary>
 private void ProcessEnterOptions(IntGroup viewGroup, EnterOptions options)
 {
     if (options.HasFlag(EnterOptions.PushStack) && !options.HasFlag(EnterOptions.CombineStackTop))
     {
         ProcessPushStack(viewGroup);
     }
     else if (options.HasFlag(EnterOptions.PushStack) && options.HasFlag(EnterOptions.CombineStackTop))
     {
         ProcessPushCombineStackTop(viewGroup);
     }
     else if (!options.HasFlag(EnterOptions.PushStack) && options.HasFlag(EnterOptions.CombineStackTop))
     {
         ProcessCombineStackTop(viewGroup);
     }
 }
Exemple #3
0
        /// <summary>
        /// 进入视图
        /// </summary>
        /// <param name="viewGroup">视图组</param>
        /// <param name="options">选项</param>
        /// <param name="callback">进入完成回调</param>
        public void Enter(IntGroup viewGroup, EnterOptions options = EnterOptions.None, Action callback = null)
        {
            ProcessEnterOptions(viewGroup, options);

            int all  = viewGroup.Count;
            int done = 0;

            for (int i = 0; i < all; i++)
            {
                Enter(viewGroup[i], EnterOptionsFilter(EnterOptions.CombineStackTop | EnterOptions.PushStack, options), () =>
                {
                    done++;
                    if (done >= all)
                    {
                        callback?.Invoke();
                    }
                });
            }
        }
Exemple #4
0
 /// <summary>
 /// 进入视图
 /// </summary>
 /// <param name="viewGroup">视图组</param>
 /// <param name="options">选项</param>
 /// <param name="callback">进入完成回调</param>
 public void Enter(IntGroup viewGroup, EnterOptions options = EnterOptions.None, Action callback = null)
 {
     _module.Enter(viewGroup, options, callback);
 }
Exemple #5
0
 /// <summary>
 /// 进入视图
 /// </summary>
 /// <param name="viewId">视图id</param>
 /// <param name="options">选项</param>
 /// <param name="callback">进入完成回调</param>
 public void Enter(int viewId, EnterOptions options = EnterOptions.None, Action callback = null)
 {
     _module.Enter(viewId, options, callback);
 }
Exemple #6
0
 /// <summary>
 /// 进入选项过滤器
 /// </summary>
 private EnterOptions EnterOptionsFilter(EnterOptions filter, EnterOptions src)
 {
     return(src & (~filter));
 }