예제 #1
0
 public void Enable()
 {
     //父UI执行Enable之前,需要把显示列表的UI执行Enable
     for (int i = 0; i < showList.Count; i++)
     {
         ChildUI childUI = showList[i];
         if (childUI != null)
         {
             childUI.EnableAsync().ConfigureAwait(true);
         }
     }
 }
예제 #2
0
        private async void OpenAsync(string uiName, Action <UI> callback, params object[] args)
        {
            await WaitAnimationFinished();

            MaskManager.Instance.SetActive(true);

            Task loadTask = UIManager.Instance.LoadUIAsync(uiName);
            {
                //容错处理,UI可能不存在
                if (loadTask == null)
                {
                    MaskManager.Instance.SetActive(false);
                }
                await loadTask;
            }

            ChildUI childUI = null;

            if (childDic != null)
            {
                if (!childDic.TryGetValue(uiName, out childUI))
                {
                    MaskManager.Instance.SetActive(false);
                }
                else
                {
                    if (!showList.Contains(childUI))
                    {
                        showList.Add(childUI);
                    }

                    //设置子UI层级
                    childUI.SetCavansOrder(childUI.ParentUI.SortingOrder + 1);

                    if (childUI.UIState == UIStateType.Awake)
                    {
                        await childUI.StartAsync(args);
                    }
                    else if (childUI.UIState == UIStateType.Start || childUI.UIState == UIStateType.Disable)
                    {
                        await childUI.EnableAsync();
                    }
                }
            }

            MaskManager.Instance.SetActive(false);

            callback?.Invoke(childUI);
        }