Exemplo n.º 1
0
        private static WindowInfo CreateWindowInfo(BaseUI ui)
        {
            var uiType = ui.GetType();

#if WINDOWS_UWP
            var floating  = uiType.GetTypeInfo().IsDefined(typeof(UIFloatingAttribute), false);
            var exclusive = uiType.GetTypeInfo().IsDefined(typeof(UIExclusiveAttribute), false);
#else
            var floating  = uiType.IsDefined(typeof(UIFloatingAttribute), false);
            var exclusive = uiType.IsDefined(typeof(UIExclusiveAttribute), false);
#endif
            return(new WindowInfo()
            {
                IsFloating = floating ? floating : ui.Floating,
                IsExclusive = exclusive ? exclusive : ui.IsExclusive,
                Order = ui.SortOrder,
                UI = ui
            });
        }
Exemplo n.º 2
0
 /// <summary>
 /// 当UI显示
 /// </summary>
 /// <param name="name"></param>
 private static void OnShow(BaseUI ui)
 {
     if (windows.ContainsKey(ui))
     {
         var window     = windows[ui];
         var windowList = window.IsFloating ? showedFloatingWindows : showedWindows;
         if (window.IsExclusive)
         {
             var array = windowList.ToArray();
             for (var i = 0; i < array.Length; i++)
             {
                 if (window.ContainBrother(array[i].UI) || array[i].UI.Equals(ui))
                 {
                     continue;
                 }
                 array[i].UI.Hide();
             }
         }
         PrevWindow    = CurrentWindow;
         CurrentWindow = window;
         var sortWindows = new List <WindowInfo>(new WindowInfo[] { CurrentWindow });
         var brothers    = CurrentWindow.UI.UIGroup;
         for (var i = 0; i < brothers.Count; i++)
         {
             if (brothers[i] && windows.ContainsKey(brothers[i]))
             {
                 var brotherWindow = windows[brothers[i]];
                 sortWindows.Add(brotherWindow);
             }
         }
         sortWindows.Sort();
         for (var i = 0; i < sortWindows.Count; i++)
         {
             var sortWindow = sortWindows[i];
             if (!windowList.Contains(sortWindow))
             {
                 windowList.Add(sortWindow);
             }
             sortWindow.SetOrder(showedFloatingWindows.Count, Instance.transform.childCount, i);
         }
     }
 }
Exemplo n.º 3
0
 public bool ContainBrother(BaseUI ui)
 {
     return(UI && UI.UIGroup.Contains(ui));
 }