Пример #1
0
    public async Task <UIViewBase> ShowView(UIViewName viewName, params object[] args)
    {
        SO_UIViewConfig config = GetConfig(viewName);

        if (config == null)
        {
            return(null);
        }

        UIViewBase view = null;

        if (config.unique)
        {
            //界面是唯一打开的
            for (int i = 0; i < viewList.Count; i++)
            {
                if (viewList[i].Config.viewName == viewName)
                {
                    //打开过
                    view = viewList[i];
                    break;
                }
            }
            //界面被打开过
            if (view != null)
            {
                if (view.LayerController == null)
                {
                    Debug.LogError($"展示界面错误: {viewName}, 没有层级");
                    return(null);
                }
                view.SetArguments(args);
                view.LayerController.Push(view);
            }
            else
            {
                Task <UIViewBase> handle = ShowViewFromCacheOrCreateNew(config, args);
                await             handle;
                if (handle.Status == TaskStatus.RanToCompletion)
                {
                    view = handle.Result;
                }
            }
        }
        else
        {
            Task <UIViewBase> handle = ShowViewFromCacheOrCreateNew(config, args);
            await             handle;
            if (handle.Status == TaskStatus.RanToCompletion)
            {
                view = handle.Result;
            }
        }

        return(view);

        //刷新显示、隐藏状态
        //UpdateViewHideState();
    }
Пример #2
0
 private void PushViewToLayer(UIViewBase view, params object[] args)
 {
     if (view != null)
     {
         view.SetArguments(args);
         viewList.Add(view);
         viewLayerDic[view.Config.viewLayer].Push(view);
     }
 }